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!

Friday, February 24, 2012

FRS Radio hack + Raspberry Pi?

If you've recently felt a disturbance in the techno Force, you may be sensing the arrival of the Raspberry Pi. The R-Pi, as some are calling it, is a credit card size computer based on a Broadcomm SoC (BCM2835) that boasts an ARM processor, a 2D/3D GPU, general purpose IO and runs Linux. Its stated purpose is to be a low-cost educational platform for youngsters, but its announcement has stirred up an amazing amount of interest in the streets of Nerdtown, Earth. At this writing, the first batch of 10,000 units aren't available yet, but I, like a few thousand others, am already planning what I'll do with it. That is, if I can get one.

Even though, cost-wise, it still makes more sense to use a cheap microcontroller in my planned FRS radio hack, I'm imagining the possibilities with a full-blown network stack and a Real(tm) operating system...

I've another project that I haven't mentioned here before that has me eyeing the Pi. The "Semi-autonomous Lawn Maintenance Platform" (aka RoboCutter) is a project that my son (11 at the time) and I started last year. It uses the wheel drive motors from a power chair (mobility scooter) and the Cypress Semiconductor PSoC that I alluded to in my previous radio hack post. The plan was to use the PSoC to do the low-level smarts such as power management, drive control, sickle bar control, etc. The higher level intelligence was planned to be a headless netbook computer running Linux, connecting back to a base station computer via WiFi. One problem with that plan is that, while I have a netbook, it's not headless and I don't want it to be! Well, the Raspberry Pi has all that handled, along with weight and power savings.

More on all of that later.