Difference between revisions of "Raspberry Pi"
m |
m (→Startup) |
||
(25 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
* http://www.raspbian.org/ |
* http://www.raspbian.org/ |
||
* http://elinux.org/RaspberryPiBoard |
* http://elinux.org/RaspberryPiBoard |
||
+ | * http://www.element14.com/community/groups/raspberry-pi |
||
⚫ | |||
+ | Hardware: |
||
+ | * http://elinux.org/RPi_Low-level_peripherals |
||
+ | * http://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf |
||
+ | * http://www.raspberrypi.org/wp-content/uploads/2012/04/Raspberry-Pi-Schematics-R1.0.pdf |
||
+ | ==Startup== |
||
+ | Remotely: provide DHCP over Ethernet |
||
⚫ | |||
+ | <br>First time, the device propose to run [http://elinux.org/RPi_raspi-config raspi-config] |
||
+ | sudo raspi-config |
||
+ | <br>Then, better to renew SSH server keys, see [http://elinux.org/RPi_Remote_Access RPi remote access] |
||
+ | sudo rm /etc/ssh/ssh_host_* && sudo dpkg-reconfigure openssh-server |
||
+ | sudo apt-get update |
||
⚫ | |||
+ | ==Wi-Fi== |
||
⚫ | |||
+ | Using [http://www.element14.com/community/docs/DOC-48541/l/wi-pi-wlan-usb-module-for-the-raspberry-pi Wi-Pi] |
||
+ | <br>See [http://www.element14.com/community/servlet/JiveServlet/downloadBody/49107-102-1-257014/Wi_Pi.User_Manual.pdf user manual] for Raspbian. |
||
+ | <br>Edit /etc/network/interfaces and add wlan0 section similar to: |
||
+ | auto wlan0 |
||
+ | iface wlan0 inet dhcp |
||
+ | wpa-ssid <name of your WiFi network> |
||
+ | wpa-psk <password of your WiFi network> |
||
+ | Then |
||
+ | sudo /etc/init.d/networking restart |
||
+ | ==NFC== |
||
+ | apt-get install git autoconf libtool gcc libusb-dev |
||
+ | apt-get install dpkg-dev debhelper dh-autoreconf |
||
+ | git clone https://code.google.com/p/libnfc/ |
||
+ | cd libnfc |
||
+ | dpkg-buildpackage -b -uc -us |
||
+ | cd .. |
||
+ | dpkg -i *deb |
||
+ | For a SCL3711: |
||
+ | modprobe -r pn533 |
||
+ | echo blacklist pn533 > /etc/modprobe.d/pn533-blacklist.conf |
||
+ | |||
+ | ==GPIO== |
||
+ | RPi-GPIO is already pre-installed on Raspbian |
||
+ | dpkg -l|grep gpio |
||
+ | ii python-rpi.gpio 0.4.1a-1 armhf Python GPIO module for Raspberry Pi |
||
+ | ii python3-rpi.gpio 0.4.1a-1 armhf Python 3 GPIO module for Raspberry Pi |
||
+ | Usage: https://code.google.com/p/raspberry-gpio-python/wiki/BasicUsage |
||
+ | |||
+ | Refs: |
||
+ | * http://elinux.org/RPi_BCM2835_GPIOs |
||
+ | * http://elinux.org/RPi_Low-level_peripherals#General_Purpose_Input.2FOutput_.28GPIO.29 |
||
+ | |||
+ | ==SPI== |
||
+ | See http://elinux.org/RPi_Low-level_peripherals#General_Purpose_Input.2FOutput_.28GPIO.29 for pinout |
||
+ | ===Enable=== |
||
+ | Edit /etc/modprobe.d/raspi-blacklist.conf and comment: |
||
+ | #blacklist spi-bcm2708 |
||
+ | Reboot |
||
+ | <br>There should now be some /dev/spi* |
||
+ | $ ls /dev/spi* |
||
+ | /dev/spidev0.0 /dev/spidev0.1 |
||
+ | ===Test=== |
||
+ | wget "http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob_plain;f=Documentation/spi/spidev_test.c" -O spidev_test.c |
||
+ | gcc -o spidev_test spidev_test.c |
||
+ | sudo ./spidev_test -D /dev/spidev0.0 |
||
+ | We should get a bunch of zeroes. |
||
+ | <br>Now, be very careful!! |
||
+ | <br>Shortcut GPIO9(MISO)(pin21) and GPIO10(MOSI)(pin19). |
||
+ | <br>Check on [https://www.modmypi.com/blog/raspberry-pi-gpio-cheat-sheet a pinout diagram] first... |
||
+ | <br>And run again the command, now we should get some hex dump about dead beef and bad food ;-) |
||
+ | sudo ./spidev_test -D /dev/spidev0.0 |
||
+ | If test fails, see here for updating stuffs: |
||
+ | * http://www.brianhensley.net/2012/07/getting-spi-working-on-raspberry-pi.html |
||
+ | * see also [http://mitchtech.net/wp-content/uploads/2012/08/raspi_arduino_spi.png SPI pinout] example with an Arduino |
||
+ | ===SPI-Python=== |
||
+ | * http://louisthiery.com/spi-python-hardware-spi-for-raspi/ |
||
+ | * https://github.com/lthiery/SPI-Py |
||
+ | Warning: at time of writing, functions described in the [https://github.com/lthiery/SPI-Py/wiki/Functions wiki] didn't match code anymore. |
||
+ | |||
+ | wget https://raw.github.com/lthiery/SPI-Py/master/spi.c |
||
+ | wget https://raw.github.com/lthiery/SPI-Py/master/setup.py |
||
+ | apt-get install python2.7-dev |
||
+ | python setup.py build |
||
+ | Result spi.so is in build/lib.linux-armv6l-2.7/spi.so to be dropped in python path |
||
+ | |||
+ | ===SPI-NFC=== |
||
+ | tests... |
||
+ | |||
+ | max speed achieved with debug on: 7.8MHz (PN532 spec says 5MHz) |
||
+ | LIBNFC_DEFAULT_DEVICE=pn532_spi:/dev/spidev0.0:7800000 LIBNFC_LOG_LEVEL=3 utils/nfc-list |
||
+ | max speed achieved without debug: 480kHz |
||
+ | LIBNFC_DEFAULT_DEVICE=pn532_spi:/dev/spidev0.0:480000 LIBNFC_LOG_LEVEL=2 utils/nfc-list |
||
+ | ===Raspdancer=== |
||
+ | See [[Raspdancer]] |
||
+ | |||
+ | ===Untested=== |
||
+ | modprobe spidev?? |
Latest revision as of 17:36, 4 June 2013
Links
- Raspberry Pi on Wikipedia
- Raspbian on Wikipedia
- http://www.raspberrypi.org/
- http://www.raspbian.org/
- http://elinux.org/RaspberryPiBoard
- http://www.element14.com/community/groups/raspberry-pi
- http://elinux.org/RPi_VerifiedPeripherals
Hardware:
- http://elinux.org/RPi_Low-level_peripherals
- http://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf
- http://www.raspberrypi.org/wp-content/uploads/2012/04/Raspberry-Pi-Schematics-R1.0.pdf
Startup
Remotely: provide DHCP over Ethernet
Access via ssh, Username: pi Password: raspberry
First time, the device propose to run raspi-config
sudo raspi-config
Then, better to renew SSH server keys, see RPi remote access
sudo rm /etc/ssh/ssh_host_* && sudo dpkg-reconfigure openssh-server
sudo apt-get update
Wi-Fi
Using Wi-Pi
See user manual for Raspbian.
Edit /etc/network/interfaces and add wlan0 section similar to:
auto wlan0 iface wlan0 inet dhcp wpa-ssid <name of your WiFi network> wpa-psk <password of your WiFi network>
Then
sudo /etc/init.d/networking restart
NFC
apt-get install git autoconf libtool gcc libusb-dev apt-get install dpkg-dev debhelper dh-autoreconf git clone https://code.google.com/p/libnfc/ cd libnfc dpkg-buildpackage -b -uc -us cd .. dpkg -i *deb
For a SCL3711:
modprobe -r pn533 echo blacklist pn533 > /etc/modprobe.d/pn533-blacklist.conf
GPIO
RPi-GPIO is already pre-installed on Raspbian
dpkg -l|grep gpio ii python-rpi.gpio 0.4.1a-1 armhf Python GPIO module for Raspberry Pi ii python3-rpi.gpio 0.4.1a-1 armhf Python 3 GPIO module for Raspberry Pi
Usage: https://code.google.com/p/raspberry-gpio-python/wiki/BasicUsage
Refs:
- http://elinux.org/RPi_BCM2835_GPIOs
- http://elinux.org/RPi_Low-level_peripherals#General_Purpose_Input.2FOutput_.28GPIO.29
SPI
See http://elinux.org/RPi_Low-level_peripherals#General_Purpose_Input.2FOutput_.28GPIO.29 for pinout
Enable
Edit /etc/modprobe.d/raspi-blacklist.conf and comment:
#blacklist spi-bcm2708
Reboot
There should now be some /dev/spi*
$ ls /dev/spi* /dev/spidev0.0 /dev/spidev0.1
Test
wget "http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob_plain;f=Documentation/spi/spidev_test.c" -O spidev_test.c gcc -o spidev_test spidev_test.c sudo ./spidev_test -D /dev/spidev0.0
We should get a bunch of zeroes.
Now, be very careful!!
Shortcut GPIO9(MISO)(pin21) and GPIO10(MOSI)(pin19).
Check on a pinout diagram first...
And run again the command, now we should get some hex dump about dead beef and bad food ;-)
sudo ./spidev_test -D /dev/spidev0.0
If test fails, see here for updating stuffs:
- http://www.brianhensley.net/2012/07/getting-spi-working-on-raspberry-pi.html
- see also SPI pinout example with an Arduino
SPI-Python
Warning: at time of writing, functions described in the wiki didn't match code anymore.
wget https://raw.github.com/lthiery/SPI-Py/master/spi.c wget https://raw.github.com/lthiery/SPI-Py/master/setup.py apt-get install python2.7-dev python setup.py build
Result spi.so is in build/lib.linux-armv6l-2.7/spi.so to be dropped in python path
SPI-NFC
tests...
max speed achieved with debug on: 7.8MHz (PN532 spec says 5MHz)
LIBNFC_DEFAULT_DEVICE=pn532_spi:/dev/spidev0.0:7800000 LIBNFC_LOG_LEVEL=3 utils/nfc-list
max speed achieved without debug: 480kHz
LIBNFC_DEFAULT_DEVICE=pn532_spi:/dev/spidev0.0:480000 LIBNFC_LOG_LEVEL=2 utils/nfc-list
Raspdancer
See Raspdancer
Untested
modprobe spidev??