Playing with Raspberry Pi I have collected a bunch of more or less useful links, so I decided to put them all together.
At the time of this writing the standard Debian images (stable) distributed from the official Raspberry Pi website were built for 2GB SD cards. It is possible to copy them to larger cards and it will work but space above 2GB will be wasted.
There are a few simple steps to re-partition the card after the first boot.
Step by step:
printf "d\n3\nd\n2\nn\np\n2\n157696\n\nw\n" | sudo fdisk -cu /dev/mmcblk0 sudo shutdown -r now sudo resize2fs /dev/mmcblk0p2
How to install:
cd /tmp wget http://raspberry-gpio-python.googlecode.com/files/RPi.GPIO-0.2.0.tar.gz tar xzvf RPi.GPIO-0.2.0.tar.gz cd tar xzvf RPi.GPIO-0.2.0 python setup.py install
import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) pin = 4 GPIO.setup(pin, GPIO.OUT) while True: GPIO.output(pin, True) GPIO.output(pin, False)
This kernel is based the 3.2 branch. It comes with I2C drivers and a bunch of staging drivers (for example, WiFi).
echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device
Explanations why and how I2C was added to BootC RPi kernel:
Set up for using i2c with Raspberry Pi running the standard Debian squeeze distribution.
sudo dpkg-reconfigure tzdata sudo apt-get update sudo apt-get upgrade sudo apt-get install ca-certificates
Install hexxeh’s rpi-upgrade tool https://github.com/Hexxeh/rpi-update#readme:
sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update sudo chmod +x /usr/bin/rpi-update sudo apt-get install git-core sudo rpi-update
Restart rpi for updates to finish:
sudo shutdown -r now
Download Chris Boots’s kernel with the i2c drivers in as a Debian package from his website http://bootc.net. Navigate to where the Debian package was saved using command line and install the Debian package.
dpkg -i linux-image-3.2.18-rpi1+_5_armel.deb
Copy /boot/vmlinuz-3.2.18rpi1+ to /boot/kernel.img:
sudo cp /boot/vmlinuz-3.2.18rpi+ /boot/kernel.img
Restart RPi again:
sudo shutdown -r now
sudo apt-get install i2c-tools
If you run ls /dev/i2c* you will not be able to see any i2c ports (e.g. /dev/i2c-0) listed. At start up the i2c ports will not be active. Make it active using modprobe:
sudo modprobe i2c-dev
Now look to see if your i2c ports exist in /dev:
ls /dev/i2c* i2cdetect -l dmesg | grep i2c
You should see two i2c ports listed named /dev/i2c-0 and /dev/i2c-1. /dev/i2c-0 is the one we will be using. Another way of listing them is to run i2cdetect -l (a tool that came with the i2c-tools you installed earlier).
Change permissions of the i2c-0 port to let you access:
sudo chmod 666 /dev/i2c-0
You should now be able to download and run some of our example c code. You will need to modprobe i2c-dev and change the permissions of the i2c port every time you boot up as these setting are not saved by default.
Firmware should be up-to-date. Its update is harmless and cannot brick your RPi.
wget https://raw.github.com/Hexxeh/rpi-update/master/rpi-update -O /usr/bin/rpi-update && chmod +x /usr/bin/rpi-update sudo apt-get install ca-certificates rpi-update
wget https://raw.github.com/Hexxeh/rpi-update/master/rpi-update chmod +x rpi-update mv rpi-update /usr/bin/rpi-update sudo rpi-update
Olimex USB-SERIAL-CABLE Olinuxino console cable alternative to Raspberry Pi.
BLUE (GND) -> 0v GREEN (RX) -> GPIO 14/TxD (BCM), or 15 (wiringPi) RED (TX) -> GPIO 15/RxD (BCD), or 16 (wiringPi)
cd /tmp wget http://xbsd.nl/~martijn/log/osx-pl2303.kext.tgz tar xvzf osx-pl2303.kext.tgz cd osx-pl2303.kext sudo cp -R osx-pl2303.kext /System/Library/Extensions/ cd /System/Library/Extensions chmod -R 755 osx-pl2303.kext chown -R root:wheel osx-pl2303.kext cd /System/Library/Extensions kextload ./osx-pl2303.kext kextcache -system-cache
kextstat -b nl.bjaelectronics.driver.PL2303 Index Refs Address Size Wired Name (Version) <Linked Against> 74 0 0xffffff7f808ee000 0xb000 0xb000 nl.bjaelectronics.driver.PL2303 (1.0.0d1) <73 34 5 4 3>
Check “kextstat” first, and if “nl.bjaelectronics.driver.PL2303” is there, it can be unloaded by:
sudo kextunload /System/Library/Extensions/osx-pl2303.kext/
Kernel 3.2.21-rpi1+ already has this driver, but it requires firmware.
Add the following line to /etc/apt/sources.list:
deb http://backports.debian.org/debian-backports squeeze-backports non-free
Update the package index:
sudo apt-get update
Install firmware-realtek deb package:
sudo apt-get install firmware-realtek
sudo iwlist wlan0 scan
sudo vi /etc/network/interfaces auto wlan0 iface wlan0 inet dhcp wpa-ssid "your_ssid" wpa-psk "your_password"