I’ve been working on some bits of software that’ll allow the firmware of an MSP430 to be updated via I2C. This will allow us to upgrade the firmware in all of the Student Robotics boards via the web. The firmware updates will be shipped out in the zip archives that our web-based IDE spits out when teams program their robots.
I got this mostly working in early September but I’ve only just got around to cleaning it up and making it usable. I’ve written a utility called “flashb” that, when configured correctly, just takes the name of the board to program and the two binaries necessary for the flashing. Here’s a demonstration screencast of it working:
In that video I’m loading new firmware into the JointIO board. I have an OSIF plugged into my laptop that is in turn connected to the JointIO board. I’ve reflashed this thing at least 50 times today without any failures, which bodes well for deployment.
“Why two binaries?” I hear you say. Each of these binaries only uses half of the MSP430’s flash. The two binaries contain the same code but one is linked to reside in the top half of flash and the other resides in the bottom half. Only one of these is executing at one particular time whilst the other can be overwritten with a later firmware version. I went for this approach for two reasons. Firstly, I’m new to writing bootloaders and so I decided to do something simple that could easily be slotted in with our existing code. Secondly, I had already written some of the code to do this for the Formica robots.
There’s still a lot of room for improvement, but I’ve almost achieved something that’s shippable. The code for the Formica robots was written so that they could gradually receive new firmware whilst still operating. Student Robotics doesn’t place this constraint on the bootloader. The firmware could stop operating and jump to a small bootloader, which would erase all flash except for itself. For now we’re not doing that. The time to consider that will be when we run into code size issues.
As with all of the Student Robotics code, the source for these things can be found in the Student Robotics subversion repository. The JointIO firmware can be grabbed by doing this:
svn co http://svn.srobo.org/boards/jointio/firmware/trunk/
Similarly, the flashb code can be accessed like so:
svn co http://svn.srobo.org/slug/utils/flashb/trunk/
I just wrote a udev rule that would make any userspace i2c devices be owned by the i2c group:
(You can stick that in a file in /etc/udev/rules.d if you’re using Fedora).
I’ve been using various I2C things in Linux for the past year and a bit, and I’ve learnt a few things about it from that. Here I hope to collate some of this information.
Site by Rob Gilton. © 2008 - 2019