Raspberry Pi Getting Started notes

Source: Internet
Author: User
Tags gz file

First, about open source hardware

The concept of open source hardware is simple to understand that the electronic hardware design detailed parameters are public, such as circuit diagrams, BOM and PCB layout and so on.

Main types: Arduino, Cubieboard, Raspberrypi, Pcduino, Beaglebone, Kiwiboard, and Mixteil

Open source China Community-Open source hardware zone Http://www.oschina.net/hardware

Second, choose Raspberry Pi Raspberrypi

The most popular open source hardware is Arduino, Raspberry Pi and Beaglebone. How do I choose the open source hardware for my development?

①arduino The main frequency 16MHz, the price within 40$, and the external device connection is good, does not support the Linux operating system.

The ②beaglebone processor is the am335x of the ARMv7 cotex-a8 architecture, with a frequency of 1GHz, supporting the Linux operating system and is said to be a product tailored for Linux players. Hardware extensibility, support network, without HDMI video output, the price is slightly more expensive than the other two models. and the Raspberry Pi difference to here a look at http://www.geekfan.net/5246/

③ Raspberry Pi Frequency standard case 700MHz, overclocking up to 1.5GHz, with embedded computer, card computer title, cheap 35$, support Linux operating system, support excellent image interface and video output, support network. Official homepage https://www.raspberrypi.org/. Currently the standard import Raspberry Pi is mainly divided into 1 generations and 2 generations. 1 generations of A, A +, B, b+,2 generation is only B type. The main difference is that the 1-generation processor is a single-core Broadcom BCM2835, the processor is ARMV6 ARM11 architecture, 2 generations of processors currently using 4-core Broadcom BCM2836, belonging to the ARMv7 cotex-a8 architecture, the normal maximum maximum frequency 900MHz, Officially, the performance is 6 times times that of 1 generations. The other differences between the models are mainly in memory size, interface support, the number of interfaces.

Raspberry Pi Linux development: Download the Raspbian system firmware to the official website, make the boot SD card (SD card preferably above 4G, class4 above), If you want to compile your own kernel needs to copy the config.gz file from the production SD card as the kernel source configuration file, detailed instructions see behind. Raspberry Pi application Programming is very convenient, the development environment directly on the Raspberry Pi build and then directly on the development, this is not the same as other arm9,arm11,210 development. Choose Raspberry Pi for development, taking into account development costs and the need for video output. The next section is about my Learning notes when I get started with Raspberry Pi.

Iii. preparatory work before development

Hardware ready to start to do some preparation for development, mainly platform construction, the preparation of the development of source tools.

① Download Raspberry Pi 2B firmware:

Official website https://www.raspberrypi.org/downloads/

Firmware selection: raspbian--official Linux operating system

To make a startup SD card:

Can be burned using software under Windows: Download Tool Http://fedoraproject.org/wiki/Fedora_ARM_Installer

You can also use the "dd" command on a Linux host to burn: instructions

umount/dev/sdb* (all partitions of SD are to be uninstalled)

sudo dd bs=4m if=2015-05-05-raspbian-wheezy.img of=/dev/sdb

View Burn-Write progress: sudo pkill-usr1-n-x DD

② under Linux Host: Install and build a cross-compilation environment

The development kit is more than 500 MB, there are two ways to download

Windows side: Https://github.com/raspberrypi/tools

Ubuntu side: Make sure the Raspberry Pi can surf the internet and make sure Git tools are installed: sudo apt-get install git

Create a folder to hold the cross-tool chain source code: mkdir rpi2b; CD rpi2b

Get tool chain Source: Git clone git://github.com/raspberrypi/tools.git speed is very slow! I finally chose the 1th way.

Put the compression pack under Linux and unzip it and go to the tool to unzip the directory CD arm-bcm2708

The LS arm-bcm2708 has the following 4 directories:

Arm-bcm2708hardfp-linux-gnueabi

Arm-bcm2708-linux-gnueabi

Gcc-linaro-arm-linux-gnueabihf-raspbian for 32-bit Linux development hosts

Gcc-linaro-arm-linux-gnueabihf-raspbian-x64 is used to install 64-bit Linux development hosts to build cross-compilation tools.

I've copied the files in this directory to the/opt/rpi/4.8.3 directory, *x64.

To configure environment variables:

Modify/etc/environment, that is, add the following sentence

Path= "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/arm-gdb/bin:/opt/ embedsky/4.4.6/bin:/opt/rpi/4.8.3 "

or modify/ETC/BASH.BASHRC, and add the following

Export path= $PATH:/opt/rpi/4.8.3/bin

To make effective: Source/etc/environment or SOURCE/ETC/BASH.BASHRC

Test: (a) arm-linux-gnueabihf-gcc-v see version number (b) write a test program compile: ARM-LINUX-GNUEABIHF-GCC hello.c-o Hello, put on the Raspberry Pi run ....

I installed the cross-compilation environment on Ubuntu mainly considering the need to compile the kernel driver of the Raspberry Pi. If you just compile your application, build the build environment directly on the Raspberry Pi.

Build the build environment on the Raspberry Pi:

Copy the contents of the above Arm-bcm2708-linux-gnueabi folder to the Raspberry Pi, then modify the environment variables, and the method is basically the same as on the host, no longer be described.

③ Let Raspberry Pi support SSH login:

If the current Raspberry Pi is already logged into the graphical desktop system, open the terminal, enter sudo raspi-config into the configuration menu, select SSH, and then select Enable, restart is ready to use. After SSH support, you can use SECURECRT to log in to the Raspberry Pi, and you can also use the CuteFTP tool to transfer files.

④ for NFS

First make sure Ubuntu supports NFS

Sudo-s

Make sure the Raspberry Pi is installed Nfs-common:ls/etc/init.d/nfs-common

Method One:

Nano/etc/fstab

Enter in the last line:

192.168.1.106:/home/clbiao/nfs/mnt/nfs NFS _netdev,defaults,user,auto,noatime,intr 0 0

Restart Raspberry Pi Nfs:service nfs-common start

Method Two:

Direct Instruction Mount NFS instruction: sudo mount-t nfs-o wr 192.168.1.106:/home/clbiao/nfs/mnt/nfs

⑤ Installing the WIRINGPI library (in the Raspberry Pi environment)

Download Library Links: https://git.drogon.net/?p=wiringPi;a=summary

or download via git clone: Git clone git://git.drogon.net/wiringpi

Enter directory:

./build Start Installation

Installed by default in the/usr/local/lib and include directories

GPIO-V installation Successful?

Write a test program

⑥ Common directives:

Shutdown Now: Root privileges

Shutdown-h now

Halt

Poweroff

Init 0

More on the configuration of the Raspberry Pi can be found below this site: http://www.geekfan.net/category/hardware/raspberry-pi-hardware/

four, try to compile the Raspberry Pi Linux kernel :

Unzip the Linux kernel source code, try to compile

Log in to the Raspberry Pi to get the configuration file for the current kernel

ls./proc/config.gz

CP./proc/config.gz./boot/

Copy the config.gz file to Ubuntu development host via SD

Zcat config.gz >. config

To view the kernel version:

[Email protected]:/# uname-a

Linux raspberrypi 3.18.11-v7+ #781 SMP PREEMPT Tue Apr 18:07:59 BST armv7l gnu/linux

Modify Top level Makefile

ARCH = $ (subarch)

Cross_compile = $ (config_cross_compile: "%" =%)

= = "

ARCH? = Arm

Cross_compile? =/opt/rpi/4.8.3/bin/arm-linux-gnueabihf-

[Email protected]:~/rpi/linux-rpi-3.18.y# make Menuconfig

Make: * * * Arch/arm:is a directory. Stop.

This error occurs because the makefile file "ARCH = arm" cannot have spaces behind arm

Make Menuconfig

Make Zimage

Test the compiled kernel image

Then use the Rpitools/mkimage/*.gz tool to convert the Zimage into kernel.img

To compile the kernel module:

Make modules

Make Modules_install Install_mod_path=/home/clbiao/rpi/linux-rpi-3.18.y/modules

Install the new kernel: "To complete under Linux"

Cd/mnt

mkdir SDB SDB1 SDB2

Mount/dev/sdb2/mnt/sdb2

Copy the kernel.img to the boot directory in the sdb2 of the SD card:

CP ~/rpi/linux-rpi-3.18.y/kernel-new.img/mnt/sdb2/boot/

To modify the boot script of the Raspberry Pi bootloader: Not to Be continued ...

V. Problems encountered

problem. HDMI to VGA shows no problem

Resolved. The thing is, the HDMI interface to the VGA interface line sold on the internet there are several, such as the next, but I did not know the details of the hasty order.

① passive HDMI to VGA cable-without chip: generally within 10 dollars can buy

② passive HDMI to VGA cable-with chip: price between 40-50

③ Active HDMI VGA cable-with chip: The price is more than 100, or even more than 200

Sometimes, look at the price should be sensitive to the detection of the composition of the product Ah!!! Also have to remember to read the review, inside may have fallen into the pit of people. The VGA interface requires an analog signal, and the HDMI interface requires a digital signal. If your display is only a simple display, without integrated graphics, such as TV, computer independent display, projector, then the first ① line must not be used!!! The other two also need to choose according to the situation, according to the information on the Internet, if your output HDMI signal device itself is not very small (generally less than 2A), it is best to choose the ③ type of active, VGA display to the current suction ratio is large, so as to ensure that the equipment is working properly. At first, I thought it was a configuration problem, but I also recorded this configuration process:

1> Backup Raspberry Pi FAT32 partition inside the Config.txt file for Config.txt.bak

2> Change the contents of the Config.txt file inside the Raspberry Pi FAT32 partition to the following configuration:

#强制使用HDMI输出

Hdmi_force_hotplug=1

#HDMI信号增强

Config_hdmi_boost=4

#HDMI输出适配于计算机显示器

hdmi_group=2

#HDMI输出的分辨率及刷新频率

Hdmi_mode=9

#禁止树莓派检测显示器分辨率, directly using the resolution output set in the configuration file

hdmi_ignore_edid=0xa5000080

#禁止黑边

disable_overscan=

Attached: Common resolution of computer monitor

Hdmi_mode=4 640x480 60Hz
Hdmi_mode=9 800x600 60Hz
Hdmi_mode=16 1024x768 60Hz
Hdmi_mode=23 1280x768 60Hz
Hdmi_mode=32 1280x960 60Hz
Hdmi_mode=35 1280x1024 60Hz
hdmi_mode=39 1360x768 60Hz
hdmi_mode=47 1440x900 60Hz
hdmi_mode=81 1366x768 60Hz
hdmi_mode=82 1920x1080 60Hz

Summer internship end, this would like to take the school early to go home, these days Typhoon "Sudiro" in Fujian Putian side login, Guangdong side is affected or called larger, so had to wait for a few more days the weather improved again back.

Raspberry Pi Getting Started notes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.