Friday, November 04, 2011

I2C on the Beagleboard xM

It's really easy driving I2C™ devices from the Beagleboard. I'm using the Trainer-xM from tincantools; that takes care of shifting voltage levels from the 1.8v used by the Beagleboard to the 5v levels that my I2C boards expect.

There are a few I2C coding examples on the web; since my BB image includes python and geany, I've written the I2C code in Python and can edit and test it on the board. Much faster than an edit-compile-upload-test cycle.

Here's the code:

import i2c, time

extender = i2c.I2C_device(0x20)
for count in range(0, 16):


monodlee said...

I am currently working on a project using pandaboard, a platform similar to beagleboard, and need to use I2C as well. Did you use some sort of library for the i2c or did you write it yourself?

choon said...

Can i use the i2c.h library? example the i2c_SMbus_write_byte(addr, command, data). There is 3 module of I2C, I2C0, I2C1 and I2C3 on the board, How I can link the device driver /dev/i2c-1 to module I2C1.