the raspberry pi computer - lemona
TRANSCRIPT
http://www.raspberrypi.org/
The Raspberry Pi Computer
Author: Peter Bauer Edition 1 / Jannuary 2013
Seite 1 / 26 Contact: [email protected] Edition 1
Table of contents1. INTRODUCTION............................................................................................................................32. Abbreviations and Terms..................................................................................................................43. Hardware Overview Raspberry Pi Typ B.........................................................................................6
3.1 The LED's of the Raspberry Pi..................................................................................................73.2 Type B Revisionen.....................................................................................................................7
4. Software Overview Raspberry Pi.....................................................................................................84.1 Preparing the SD card on a Windows computer........................................................................84.2 Preparing the SD card on a Linux computer ...........................................................................104.3 Preparing the SD card on a Mac OS X computer ...................................................................114.4 Content of the boot Partition....................................................................................................124.5 RISC OS on the Raspberry PI..................................................................................................13
5. Startup of the Raspberry Pi.............................................................................................................145.1 Configuration via raspi-config script.......................................................................................15
6. The Raspberry Pi in Detail.............................................................................................................176.1 Debian or Raspbian as operating system ................................................................................17
6.1.1 Connect to LAN...............................................................................................................186.1.2 Audio and Video output on RPI using Debian.................................................................216.1.3 Configuration via config.txt.............................................................................................22
6.2 The GPIO connector ...............................................................................................................236.2.1 Control GPIO Pins with Python and Shellscript..............................................................24
6.4 Report Linux bugs .................................................................................................................257. Resources for the Raspberry Pi on the Internet .............................................................................26
Seite 2 / 26 Contact: [email protected] Edition 1
1. INTRODUCTION
This book should serve as a hobbyists help for getting started with the Raspberry PI. It was created because there is a wealth of information on the Internet, but unfortunately everything around is very scattered and an orderly book is the best way to describe something and learn something.
In this book RPI is used as a shortcut for Raspberry Pi.
Currently there are two different Types of the RPI called the Model A and Model B.
Model A has one USB connector und no Ethernet connector.Model B has two USB connectors and one Ethernet interface.
The software of the RPI is still in development, with Raspbian the developers succeeded to produce a stable Linux distribution with good performance. It's up to the user to explore this Linux distribution and to find the right program for a particular purpose.
For pure multimedia playback it is worthwhile taking a look at Raspbmc. Currently the operation of Raspbmc is still a little lame, here is still some potential for improvement.
If you liked this little book, you can purchase an extended version via email for 2 Euro.For questions about the RPI I am also available by email.
http://bitkistl.blogspot.co.at/2013/01/raspberry-pi-e-book.html
If you found this book useful you can donate via Paypal to support this E-Book project.
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QNKHGXF3MDV9W
Have fun with the Raspberry Pi,
Peter Bauer
Seite 3 / 26 Contact: [email protected] Edition 1
2. Abbreviations and Terms
API Application Programming Interface
APT Advanced Packaging Tool, a software package management tool for Linux. With APT single programs can be installed or the whole Linux
distribution can be updated.
ARM Advanced Risc Machines, british Chip Design Developer.The ARM Chips are produced from many companies.
armel Name of the current port of Debian for the ARM v6 architecture
armhf "hard float" means support for fast floating point calculations via hardware
Raspbian Port of the Debian Operating system, this port is optimized for theskills of the RPI CPU.
CPU Central Processing Unit
GPU Graphics processor, Broadcom Videocore IV.Can play Videos in high definition and supports acceleration of graphics.Supported Standards are OpenGL ES 2.0, OpenVG 1.1. The GPU must
share the available RAM with the CPU. The RAM for the GPU isconfigurable in the size of 32,64 or 128 MB.
IP Internet Protocol
IRC Internet Relay Chat, it is possible to chat with the developers and other users by the use of an IRC Client program.
OpenGL ES 3D API for embedded systems
OpenVG 2D API for Vektor- and Bitmap graphics
binary blob Software which is not Open Source, the RPI uses a binary blob to control the GPU. The Raspberry Pi Foundation delivers this binary blob with all linux
images.
RPI Raspberry Pi Computer, a product of the Raspberry Pi Foundation
USB 2.0 Universal Serial Bus - here mouse, keyboard and other devices are connected. If you need more than two connectos or more then 100 mA current an active USB Hub is required.
LED Light emitting Diode
Seite 4 / 26 Contact: [email protected] Edition 1
HDMI High Definition Multimedia Interface (Version 1.3a)
RAM Random Access Memory, the main memory of the RPIis 256 (Model A) or 512 MByte (Model B).
SD Card Secure Digital Memory Card The RPI boots from an SD card.
If you buy an SD card its good to choose a class 4 or 6 card. These are known to work good with the RPI.
RCA Radio Corporation of America, analogue video connector.Here a cable to a TV with Cinch Plug can be connected.
CSI Camera Serial Interface, this year a camera module with 5 Megapixels should be available. It should cost around 25 Euros.
DSI Display Serial Interface, not documented for the end user
DHCP Dynamic Host Configuration Protocol Is used to get a valid IP Address.
GPIO General Purpose Input/Output
GUI Graphical User Interface, some Linuxprograms have no GUI e.g.: omxplayer (Multimedia Player).
JTAG Joint Test Action GroupConnector for Test and Debugging of the RPI Hardware.This is an interface for the developers.
BCM 2835 SoC contains CPU,GPU and FPU of the RPI from Broadcom. The CPU computes with 32 Bit and a clock rate of 700 Mhz.
This CPU(ARM1176JZFS) is from the architectural point of view an ARM11 based on the ARM v6 family.
overclocking The RPI can be overclocked up to 1Ghz.This can be done with the script raspi-config.
SoC System on Chip, means that different functions are integrated on one chip
UNIX multiuser operating system, the Open Source variant is called Linux
XBMC Open Source Media Player, there are several port for the RPI (Raspbmc, OpenELEC, XBian)
X Windows also known as X11 is the window manager of Unix and Linux
Seite 5 / 26 Contact: [email protected] Edition 1
3. Hardware Overview Raspberry Pi Typ B
S
Seite 6 / 26 Contact: [email protected] Edition 1
EthernetUSB 2.02x
HDMIoutput
GPIO
Input andoutput
RPI Typ B:
RCAVideooutput
DSIDisplay connector
CSI cameraconnector
Micro USBPower supply5 Volt, 1 Ampere
BCM 2835ARM 11700 MHz
AudioOutput3,5 mmjack
LED's
3.1 The LED's of the Raspberry Pi
The RPI has 5 LEDs which show the state of the device.
OK green Blinks during Boot and during SD card access
PWR red PowerOn, ist directly connected to the 3,3V voltage of the RPI
FDX green FullDuplex
LNK green Blinks, off during Ethernet activity
10M yellow 100 Mbit LED
3.2 Type B Revisionen
Model und Revisionen Code(s) commentModel B Revision 1.0 2Model B Revision 1.0 3 no polyfuses, D14 removedModel B Revision 2.0 4, 5, 6 with 2,5 mm mounting holes
Request of CPU Version and RPI serial number via terminal:
pi@raspberrypi ~ $ cat /proc/cpuinfo
Processor : ARMv6-compatible processor rev 7 (v6l)BogoMIPS : 697.95Features : swp half thumb fastmult vfp edsp java tlsCPU implementer : 0x41CPU architecture: 7CPU variant : 0x0CPU part : 0xb76CPU revision : 7
Hardware : BCM2708Revision : 0002 Serial : 0000000025cd2f93
Since October 2012 the RPI Model B is deliverd with 512 MB RAM.
Seite 7 / 26 Contact: [email protected] Edition 1
4. Software Overview Raspberry PiThere are several unix like operating systems for the RPI and there is an operating system called RISC OS that has its origin at the developers of the first ARM chips.
The Raspberry Pi Foundation recommends the use of the following Linux Distributions and offers these for Download:
• Debian 7 ("Wheezy") /* Soft Float (slow floating point calculations) Oracle JVM requires this
• Raspbian ("Wheezy") /* has its origin in Debian 7 - recommended Distribution of the RPI Foundation
• Arch Linux ARM
• QtonPi
Download link for the operating system images for the RPI:
http://www.raspberrypi.org/downloads
For booting the RPI a SD card is necessary. The RPI Foundation recommends a SD card with 4 GB. For flashing the image to the SD card there are programs for the PC running Winodws, Mac OS X or Linux.
4.1 Preparing the SD card on a Windows computer
You need a SD Cardreader/writer, the Win32DiskImager and the operating system image.
1. Download the operating system image
2. Unzip the file *.zip to *.img
3. Insert the SD Card in your SD Cardreader and remember the drive letter.
4. Download Win32DiskImager , the download links are on the right side.
5. Unzip the Win32DiskImager and start it.
6. Select the file *.img
7. Select the drive letter in the device box (Attention: When you select the wrong drive letter your harddisc can be damaged)
8. Click write und wait for the completion
9. Quit the Win32DiskImager und take out the SD card from your Cardreader.
10. Insert the SD Card in your RPI and connect the power supply.The RPI should boot now.
Seite 8 / 26 Contact: [email protected] Edition 1
Alternative methode if your RPI does not boot:
1. Download the operating system image
2. Unzip the file *.zip to *.img
3. Insert the SD Card in your SD Cardreader and remember the drive letter.
4. Download the program http://shounen.ru/soft/flashnul/ and unzip it.
5. Start button > All Programs > Accessories > Command Prompt (start with right mouse click as Admin)
6. C:/flashnul/flashnul.exe -p
Available physical drives:
0 size = 250059350016 (232 Gb)1 size = 1990197248 (1898 Mb) --> SD Card values
Available logical disks:C:\D:\F:\G:\H:\
Press ENTER to exit.
7. C:/flashnul/flashnul.exe 1 -L C:/<folder>/*.img(The number 1 is the number of your SD Card and was printed by the previous command on the left side)
If you get the error message "access denied" try it again with the assigned drive letter.
C:/flashnul/flashnul.exe H: -L C:/<ordner>/*.img
Seite 9 / 26 Contact: [email protected] Edition 1
4.2 Preparing the SD card on a Linux computer
1. Download the operating system image
2. Unzip the file *.zip to *.img
3. Check with the command df -h which discs are mounted
4. Insert the SD Card in your SD Cardreader
5. Check again with df -h which disc are mountedThe newly added disc is your SD Card
6. enter as root user:
unmount /dev/sdd1 /* Could have a different name The unmount is necessary for the following command
7. enter as root user:dd bs=1M if=~/<folder>/*.img of=/dev/sdd
After the "if" (short for input file) the filename and pathfor the image files must be entered
The dd command has no process indicator and can take a while
8. enter command: syncTo ensure that all data are written to the SD Card and you can safely removethe SD Card from the SD Cardreader
9. Insert the SD Card in your RPI and connect the power supply.The RPI should boot now.
Seite 10 / 26 Contact: [email protected] Edition 1
4.3 Preparing the SD card on a Mac OS X computer
1. Download the operating system image
2. Unzip the file *.zip to *.img
3. Start df -h vom Terminal
4. Insert the SD card in your SD cardreader
5. Check with df -h which discs are mountet The newly added discs is your SD card Remember the discs name e.g. /dev/disk3s1
6. Unmount this disccommad: diskutil unmount /dev/disk3s1
7. Determine the disc name for the raw device:/dev/disk3s1 --> /dev/rdisk3 (disk --> rdisk, s1 is leaved off)
8. command:sudo dd bs=1m if=~/Downloads/<folder>/*.img of=/dev/rdisk3
After the "if" (short for input file) the filename and pathfor the image files must be entered
9. enter command: diskutil eject /dev/rdisk3
10. Insert the SD Card in your RPI and connect the power supply.The RPI should boot now.
Seite 11 / 26 Contact: [email protected] Edition 1
4.4 Content of the boot Partition
The boot partition of the SD card is formatted as FAT32 (data are readable form Windows PC)
It contains the following files:
• bootcode.bin 2nd stage bootloader, starts with switched off SDRAM
• loader.bin 3rd stage bootloader, starts with activated SDRAM
• start.elf GPU firmware image, provided by the Raspberry Pi Foundation
• kernel.img default Linux operating system kernel
• kernel_cutdown.img cutdown Kernel
• kernel_emergency.img Kernel version for emergency (kernel.img does not work)
• cmdline.txt Parameter for the Kernel
Optional files:
• config.txt a configuration file which is read by the GPU on bootYou can change the Video Mode, the System clock and voltages
• vlls folder optional GPU programs (e.g. codecs)
Seite 12 / 26 Contact: [email protected] Edition 1
4.5 RISC OS on the Raspberry PI
Since October 2012 RISC OS is released for the RPI. RISC OS was originally developed for the Acorn Archimedes and the Risc PC. This operating system was running on the first types of the ARM processor from ARM2 up to the StrongArm.
The advantages of RISC OS can be explained quickly:
• uses low resources, most of the RISC OS programs do not require a fast processor, do not use many memory and do not require a large harddsisc
• RISC OS boots in just about 10 seconds in a graphical desktop
• for operation a three key mouse is required, the keys have the function select, menu and adjust
• the configuration of the operating system is done completely via the desktop GUI
• RISC OS is a single user, multi tasking operating system. It uses cooperative multitasking. This means that a single program gives control to the next program when it has finished its task.
Release Note und Download:
https://www.riscosopen.org/news/articles/2012/10/26/risc-os-pi-released-risc-os-for-the-raspberry-pi
http://downloads.raspberrypi.org/images/riscos/
The Installation of the operating system to the SD card is done like in chapter 4.1 bis 4.3.
RISC OS includes some useful applications:
• the slim Webbrowser Netsurf (Youtube does not work)
• Draw, Paint and Edit for drawing and editing
• SwiftJPEG, ChangeFSI for viewing and conversion of pictures
• Omniclient to access fileshares (Samba or CIFS)
• a paket manager and App Store (in Development) named Store.With the paket manager and the App Store many additionalprograms can be installed, many of them are free of cost
RISC OS is not good in:
• playing videos ist slow, the GPU is not used
Seite 13 / 26 Contact: [email protected] Edition 1
5. Startup of the Raspberry PiYou will need the following things to startup the Raspberry Pi for the first time:
• USB keyboard und USB mouse. The current is limited to 100 mAper USB connector
• Prepared SD card with the operating system (see chapter 4)
• A TV with HDMI or Composite connector or monitor with HDMI connector (perhaps an adapter from HDMI to DVI if your monitor has such a connector)VGA is not supported by the RPI !
• A power supply with micro USB plug. The power supply should supply at least 700 mA at 5 Volt. Der RPI has a fuse rated with 1100 mA on the PCB.
• One ethernet lan cabel (optional)
A good overview with pictures can be found here:
http://www.raspberrypi-spy.co.uk/2012/03/raspberry-pi-cables-connectors/
Insert the prepared SD card into your RPI, plug in all required cables. It is a good idea to plug in the power supply lastly.
Your RPI boots and you should be able to watch the boot process in your monitor.If your RPI is connected with a lan cable to your network it will try to obtain an IP addressvia DHCP.
Now you can login with username and password.For Debian Linux or Raspbian the username is "pi" and the password is "raspberry"
With the command: startx you can now start the desktop GUI
The valid passwords for your SD card image can be found at theRaspberry Downloads
http://www.raspberrypi.org/downloads
With the command sudo you can get Superuser (root user) rights
Seite 14 / 26 Contact: [email protected] Edition 1
5.1 Configuration via raspi-config script
Debian 7 and Raspbian:
command: sudo raspi-config
• info - Informaion about this toolDisplays a short text about the raspi-config program.
• expand_rootfs - Expand root partition to fill SD cardThe images for the RPI fit nicely on a 4 GB SD card. If you usea larger SD card you need to enlarge your system partition or youmake an additional partition. This is necessary when you want to usethe additional free space. This menu option does all the work. Afterinvoking this option a reboot is required to activate the resizing of thepartition, this may take some time.
• overscan - Change overscanThis allows us to switch on or off the oversacan. When overscan isenabled the RPI generates a black border around the visible screen.This may be useful for some TV sets. For newer TV sets and TFT monitorsoverscan can be set to disabled. Changes will become effective after reboot.
• configure_keyboard - Set keyboard layoutHere the keyboard layout can be choosen. You can choose the keyboard layoutfrom a list. If you can't find your keyboard just choose a generic 105-key one.You also need to select your language version.
• change_pass - Change password for 'pi' userThe user 'pi' is per default present on the RPI system. The useris there to do every days work. With this option you can change thepassword for this user.
• change_locale - Set localeThis option sets the character set and language of the system. When setto your language the programs will display texts in your language if available.
• change_timezone - Set timezoneHere you can choose your timezone.
• memory_split - Change memory splitThe 256 or 512 MB main memory of your RPI are shared between the CPU and GPU.Currently you can select one of four memory splits. These reserve 32\64\128\256 MBfor the GPU, the rest for the ARM11 CPU. When you don't use expensive graphics the 32 MB memory split will work. For a media center or 3D graphics the 128 MB memory split will fit better. Changes will become effective after reboot. The default value is 64 MB.
Seite 15 / 26 Contact: [email protected] Edition 1
• overclock - configure overclockingThe RPI can be overclocked dynamically in several steps. Dynamically meens that the RPIis overclocked on demand. The software also takes care of the temperature of the CPU, thetemperature is limited to 85 degrees celsius. If you find that your RPI does not run stable with the the overclock you are using, just try a lower one. There exists widgets for the LXDE Desktop which display the clock frequency and the temperature. When your RPI hasa problem with overclockking during boot, you can switch off overclocking by pressing the shift key. Afterwards a reconfiguration of overcocking can be done.
• ssh - Enable or disable ssh serverBy using SSH you can access a text based console (shell) over the network. You can use for example the putty program to access your RPI from a remote PC. The connection is encrypted per default. To allow this access the SSH server program on the RPI must run.
• boot_behaviour - Start desktop on boot?Here you can choose to automatically start the desktop during boot. If you don't chooseto start the desktop you can start it later by invoking the startx command from the shell.
• update - Try to upgrade raspi-config
If your RPI is connected to your home network the raspi-config script itself can be updated to the newest version which may offer enhanced or new functionality.
Seite 16 / 26 Contact: [email protected] Edition 1
6. The Raspberry Pi in Detail
6.1 Debian or Raspbian as operating system
Debian Linux for ARM contains about 35.000 software packages
If your RPI is connected to the Internet you can check this with the following command.
apt-cache pkgnames /* all available packages are listed
If you want to know the currently installed packages:
command:
dpkg -l /* alle installed packages are listed
If you would like to install software XXX.
Here you need root user rights.
command:
sudo -i /* now you have root rights
command:
apt-cache search <name> /* search for packages
apt-get install <name> /* install software packages
apt-get remove <name> /* remove software packages
apt-get purge <name> /* remove software package and its configuraton files
With apt-get update the database of software packages can be updated.This is necessary before you apt-get upgrade the whole Linux Distribution.
If you want to know which files are installed for a particular software package:
dpkg -L <name> /* list files for a package
Details about Debian and the ARM Port can be found here:
http://www.debian.org/ports/arm/index.de.html
sudo apt-get install synaptic /* install paket management tool with GUI /* LXDE -> Administration -> Synaptic
Seite 17 / 26 Contact: [email protected] Edition 1
6.1.1 Connect to LAN
hostname -I /*What IP Addresse has my RPI ?
ifconfig /*What state have my network interfaces pi@raspberrypi:~$ ifconfig
eth0 Link encap:Ethernet Hardware Adresse b8:27:eb:2b:c3:50
inet Adresse:192.168.1.25 Bcast:192.168.255.255 Maske:255.255.0.0
inet6-Adresse: fe80::ba27:ebff:fe2b:c350/64 Gültigkeitsbereich:Verbindung
UP BROADCAST RUNNING MULTICAST MTU:1500 Metrik:1
RX packets:2182737 errors:0 dropped:0 overruns:0 frame:0
TX packets:563997 errors:0 dropped:0 overruns:0 carrier:0
Kollisionen:0 Sendewarteschlangenlänge:1000
RX bytes:3195864956 (2.9 GiB) TX bytes:57555644 (54.8 MiB)
lo Link encap:Lokale Schleife
inet Adresse:127.0.0.1 Maske:255.0.0.0
inet6-Adresse: ::1/128 Gültigkeitsbereich:Maschine
UP LOOPBACK RUNNING MTU:16436 Metrik:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
Kollisionen:0 Sendewarteschlangenlänge:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
In the section eth0 see inet address for the IP address and the subnet mask.The lo (loopback Interface) serves the local communication.
The IP configuration for the LAN can be found in the following two files:
/etc/network/interfaces /* interface configuration/etc/resolv.conf /* DNS server entries
/etc/network/interfaces when using DHCP:# The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet dhcp /* DHCP vorhanden
/etc/resolv.conf:nameserver <IP-Adresse> /* In most cases IP-Address of the router
/etc/network/interfaces when using a fixed IP-Configuration:# The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet static /* IP address
Seite 18 / 26 Contact: [email protected] Edition 1
address <IP-Adresse> /* IP address of the RPI netmask <Netz Maske> /* In home network mostly 255.255.255.0gateway <IP-Adresse> /* IP address of the router
After changing the network configuration a restart of the network services is necessary
sudo /etc/init.d/networking restart
If the network interface is not working try the following:
sudo ifdown eth0 /* deactivate interface
and
sudo ifup eth0 /* activate interface
With the Ping command you can test if packets are transmitted and answered
ping -c1 www.google.at /* test if network endpoint answesPING www.google.at (173.194.35.183) 56(84) bytes of data.
64 bytes from muc03s02-in-f23.1e100.net (173.194.35.183): icmp_req=1 ttl=52 time=34.2 ms
--- www.google.at ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 34.293/34.293/34.293/0.000 ms
Seite 19 / 26 Contact: [email protected] Edition 1
With the program lsof (list open files) you can list the running Internet services and the applicationrunning behind. If lsof is not yet installed on your RPI you can install itwith sudo apt-get install lsof.
pi@raspberrypi ~ $ sudo lsof -i
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
ntpd 1369 ntp 16u IPv4 3473 0t0 UDP *:ntp
ntpd 1369 ntp 17u IPv4 3477 0t0 UDP localhost:ntp
ntpd 1369 ntp 19u IPv4 4118 0t0 UDP raspberrypi:ntp
dhclient 1593 root 9u IPv4 3932 0t0 UDP *:bootpc
dhclient 1593 root 20u IPv4 3917 0t0 UDP *:32549
sshd 1635 root 3u IPv4 4111 0t0 TCP *:ssh (LISTEN)
Of particular interest are the "listening sockets", those are the TCP / IP ports whereApplications provides service. In our example it is only the application sshd(secure shell daemon). The protocol ssh provides login option on theInternet to a shell.
Seite 20 / 26 Contact: [email protected] Edition 1
6.1.2 Audio and Video output on RPI using Debian
The RPI supports the sound through the ALSA sound system.Sound output can either be via the 3.5 mm stereo jack orvia HDMI. The default is auto which outputs via HDMI if possible.
play test sample:
sudo aplay /usr/share/sounds/alsa/Front_Center.wav
configure audio output:
sudo amixer cset numid=3 <n>n is 0=auto, 1=jack connector, 2=hdmi.
The omxplayer ist pre installed and can play audio and video files. Since August 2012 omxplayer and the XBMC variants plays MPEG-2 und VC-1 coded videos. The required codecs can be bought from the Raspberry PI Foundation for a small amount.
http://www.raspberrypi.com/ /*Raspberry Pi Store
pi@raspberrypi ~ $ omxplayer <dateiname>.mp3
file : *.mp3 reult 0 format mp3 audio streams 1 video streams 0 chapters 0 subtitles 0
Audio codec mp3 channels 2 samplerate 44100 bitspersample 16
Subtitle count : 0 state off : index 0
Supported hardware accelerated video formats:MPEG-2,MPEG-4,VC-1 and H264
With apt-get install mplayer you can install an additional media player.Mplayer is not hardware accelerated but videos (MPEG 2) with low res (e.g. 640x480) are ok.
On my RPI I need to use the following options:
mplayer -ao sdl <filename>
Seite 21 / 26 Contact: [email protected] Edition 1
6.1.3 Configuration via config.txt
sudo nano /boot/config.txt /* change configurationsudo reboot /* Restart the RPI
When changing the configurtion a reboot is required.
# uncomment if you get no picture on HDMI for a default "safe" mode #hdmi_safe=1
# uncomment this if your display has a black border of unused pixels visible # and your display can output without overscan disable_overscan=1
# uncomment the following to adjust overscan. Use positive numbers if console # goes off screen, and negative if there is too much border #overscan_left=16 #overscan_right=16 #overscan_top=16 #overscan_bottom=16
# uncomment to force a console size. By default it will be display's size minus # overscan. (sehr nützlich wenn Ihnen die Bildschirmdarstellung zu klein ist)framebuffer_width=1280 framebuffer_height=720
# uncomment if hdmi display is not detected and composite is being output #hdmi_force_hotplug=1
# uncomment to force a specific HDMI mode (this will force VGA) #hdmi_group=1 #hdmi_mode=1
# uncomment to force a HDMI mode rather than DVI. This can make audio work in # DMT (computer monitor) modes #hdmi_drive=2
# uncomment to increase signal to HDMI, if you have interference, blanking, or # no display #config_hdmi_boost=4
# uncomment for composite PAL #sdtv_mode=2
#uncomment to overclock the arm. 700 MHz is the default. #arm_freq=800
#for more options see http://elinux.org/RPi_config.txt
Seite 22 / 26 Contact: [email protected] Edition 1
6.2 The GPIO connector
The RPI has a 26 pin connector with freely programable I/O Pins.
The connector has two rows with 13 pins.PIN 1 is clearly marked on the PCB.
The numbering works with even numbers on the top row andodd numbers on the bottom row.
PIN 1 carries 3V3 with a maximum curremt of 50 mA.PIN 2 carries 5V which are directly connected to the power supply.
Each I/O Pin can source a maximum of 16 mA
Attention: Most I/O Pins are connected direct to the Broadcom chip, a short circuit can damage your RPI.
http://www.element14.com/community/docs/DOC-43484/l/raspberry-pi-gpio-expansion--low-level-peripherals ... Details about the GPIO connector at Element14
Assignment of the Pins (REV 1 and REV 2 Boards are different):Pins marked DNC (do not connect) should not be used.
Here are 8 I/O Pins, and the I2C,SPI and UART Pins. The control of the pins can be done easily with the programming language Python. This requires the installation of a library.
http://www.raspberrypi-spy.co.uk/2012/05/install-rpi-gpio-python-library/
Seite 23 / 26 Contact: [email protected] Edition 1
6.2.1 Control GPIO Pins with Python and Shellscript
Python script:
import RPi.GPIO as GPIO
# configure GPIO Pins - one input and one outputGPIO.setup(11, GPIO.IN)GPIO.setup(12, GPIO.OUT)
# read input from pin 11 input_value = GPIO.input(11)
# output to Pin 12 GPIO.output(12, True)
The Numbering of the Pins 11 and 12 in this example refers to the physical Pins GPIO 17 and GPIO 18 see picture.
Shell script:
#!/bin/sh
# GPIO numbers should be from this list# 0, 1, 4, 7, 8, 9, 10, 11, 14, 15, 17, 18, 21, 22, 23, 24, 25# Note that the GPIO numbers that you program here refer to the pins# of the BCM2835 and *not* the numbers on the pin header. # So, if you want to activate GPIO7 on the header you should be # using GPIO4 in this script. Likewise if you want to activate GPIO0# on the header you should be using GPIO17 here.
# set up GPIO 4 and set to outputecho "4" > /sys/class/gpio/exportecho "out" > /sys/class/gpio/gpio4/direction
# set up GPIO 7 and set to inputecho "7" > /sys/class/gpio/exportecho "in" > /sys/class/gpio/gpio7/direction
# write outputecho "1" > /sys/class/gpio/gpio4/value
# read from inputcat /sys/class/gpio/gpio7/value
# clean upecho "4" > /sys/class/gpio/unexportecho "7" > /sys/class/gpio/unexport
Seite 24 / 26 Contact: [email protected] Edition 1
6.4 Report Linux bugs
If you use the RPI and install a lot of hardware and software packages, you can easily discover an error. Depending on the Linux distribution, there are several ways to report the error.
Before writing a bug report it is good to investigate whether this error may have been reported by of another user.
Important: Only known errors can be corrected, so do not be shy when writing error messages.
Debian:
Error Database: http://www.debian.org/Bugs/
Program for writing Error report: reportbug
Raspbian:
Error Database: https://bugs.launchpad.net/raspbian
Report an Error: Raspberry Pi Forum in section Raspbian and on IRC
Archlinux:
Error Database: https://bugs.archlinux.org/
Report an Error: register with the error database and login
It is possible to request features in the form of an error message. It is also useful to report errors in the documentation (e.g. man pages are sometimes incomplete).
Seite 25 / 26 Contact: [email protected] Edition 1
7. Resources for the Raspberry Pi on the Internet
http://www.raspberrypi.org/ The Homepage of the Raspberry Pi Foundation
http://elinux.org/R-Pi_Hub RPI Wiki in several languages
http://elinux.org/RPi_VerifiedPeripherals working Hardware
http://www.element14.com/community/groups/raspberry-pi Datasheets and more
http://www.raspbian.org/ Linux variant optimized for the RPI
http://www.raspbmc.com Linux variant for multimedia
http://rastrack.ryanteck.org.uk/ The RPI Tracker, where is already an RPI ?
http://www.themagpi.com/ monthly Magazin
IRC channels: Chat with the developers
#raspberrypi, #raspbian
Seite 26 / 26 Contact: [email protected] Edition 1