Hardware Reference
In-Depth Information
From this information, use the firmware code (revision) number to determine which
I2C bus to use:
SDA
SCL
Revision
I2C Bus
P1-03
P1-05
0002
0
GPIO-0
GPIO-1
0003
0
0004+
1
GPIO-2
GPIO-3
I2C Bus Speed
Unlike the SPI bus, the I2C bus operates at a fixed speed within Raspbian Linux. The SoC
document claims I2C operation up to 400 kHz, but the reported clock rate during the
Raspbian Linux boot is 100 kHz:
$ dmesg | grep -i i2c
[1005.08] i2c /dev entries driver
[1026.43] bcm2708_i2c bcm2708_i2c.0: BSC0 Controller at. . . (baudrate 100k)
[1026.43] bcm2708_i2c bcm2708_i2c.1: BSC1 Controller at. . . (baudrate 100k)
Don't be alarmed if the preceding grep command doesn't provide any output. Later
versions of Raspbian didn't load bcm2708_i2c at boot time. You should see the same
messages in the /var/log/syslog after you manually load the module as shown here:
$ sudo modprobe i2c_bcm2708
$ tail /var/log/syslog
. . .
Mar 12 20:16:55 raspberrypi kernel: [168.845802] bcm2708_i2c bcm2708_i2c.0: \
BSC0 Controller at 0x20205000 (irq 79) (baudrate 100k)
Mar 12 20:16:55 raspberrypi kernel: [168.846423] bcm2708_i2c bcm2708_i2c.1: \
BSC1 Controller at 0 x20804000 (irq 79) (baudrate 100k)
Tools
Working with I2C peripherals is made easier with the use of utilities. These I2C utilities
are easily installed using the following command:
$ sudo apt−get install i2c−tools
 
Search WWH ::




Custom Search