Friday, April 4, 2014

Raspberry pi i2c and spi bus notes



I ran across some notes about using i2c with the pi.  For my version, debian_version 7.0, Wheezy this page describes how to enable the access to the controller and install a simple program to access the ic chip

BC2708 it would appear.

http://www.cooking-hacks.com/forum/viewtopic.php?f=37&t=3512

This example is for a board which adapts arduino shields to the Pi, so you will get nowhere if not using a board with the chip attached.


1. Install i2c-tools on your Pi:
Code:
sudo apt-get install python-smbus
sudo apt-get install i2c-tools


2. If you have Raspbian, check /etc/modprobe.d/raspi-blacklist.conf and comment "blacklist i2c-bcm2708" by running sudo nano /etc/modprobe.d/raspi-blacklist.conf and adding a # (if its not there).
If you're running Wheezy you will need to
add the following lines to /etc/modules file
i2c-dev
i2c-bcm2708

3. Run i2cdetect (You need to specify the i2c bus where the ADC is attached, there are different for Rev1 and Rev2). THE BRIDGE MUST BE ATTACHED TO YOUR RASPBERRY PI.
Code:
# For Raspberry Pi rev2
sudo i2cdetect -y 1

#For Raspberry Pi rev1
sudo i2cdetect -y 2


No comments:

Post a Comment