Detecting a device connected to an I2C bus on a beaglebone

0
90

There are three I2C buses on the Beaglebone Black according to the reference Manual and their memory addresses are:

i2c-0: 0x44E0_B000
i2c-1: 0x4802_A000
i2c-2: 0x4819_C000

The i2c-0 bus is not present on the header pins while the i2c-1 bus can be used on cape add-on boards.

To check which of the three buses are enabled we can use i2cdetect:

debian@beaglebone:/var/lib/cloud9$ i2cdetect -l
i2c-2 i2c OMAP I2C adapter I2C adapter
i2c-0 i2c OMAP I2C adapter I2C adapter
debian@beaglebone:/var/lib/cloud9$

My beaglebone green showed two i2c devices as you can see above.

Now sometimes you may not know the exact I2C address of a device and there are circumstances where a device may support multiple addresses .To detect the devices connected to i2c-2:

debian@beaglebone:/var/lib/cloud9$ i2cdetect -r 2
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-2 using read byte commands.
I will probe address range 0x03-0x77.
Continue? [Y/n] y
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: — — — — — — — — — — — — —
10: — — — — — — — — — — — — — — 1e —
20: — — — — — — — — — — — — — — — —
30: — — — — — — — — — — — — — — — —
40: — — — — — — — — — — — — — — — —
50: — — — — UU UU UU UU — — — — — — — —
60: — — — — — — — — — — — — — — — —
70: — — — — — — — —
debian@beaglebone:/var/lib/cloud9$

In this case you can see that we have picked up a device connected to i2c-2 and it has an address of 1e. This is correct as I had an HMC5883L sensor attached

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.