Tuesday, May 1, 2012

I2C Driver for the Raspberry Pi

I'm currently working on making a post on my blog writing a driver for the I2C buss controller(s) on the BCM2835 SoC that powers the Raspberry Pi.  In a previous post, I mentioned the RoboCutter lawn robot my son and I are (sometimes) working on.  I want it to have inclinometer, accelerometer and magnetic compass inputs and the only affordable, module level products I've found and like so far speak I2C.  As I also said in a previous post, the R-Pi should be great as a high level controller for Mr. RoboCutter, but, R-Pi's SoC brain doesn't have a Linux driver for I2C at this point (that I know of), so I'm digging in to try to create one.

So far I've:
  • Set up a cross-compiler toolchain to compile code for the Pi on x86 boxes I have on hand.
  • Got the BCM2835 peripheral datasheet at ready reference
  • Started coding a driver by examining existing Linux I2C drivers and using parts of a couple of them as templates.  Having and having read and used the "Linux Device Drivers" book should help ;)
  • Found two or three people who already have a Raspberry Pi who are willing and able to test driver code.
Currently I've had a couple of restarts on the coding effort and am currently suffering a "single Dad" episode while my wife is out of the country for a couple of weeks.  Still making some progress and I'm really looking forward to getting my own Rubus-3.14159265 *and* getting it talking to some cool sensors!