Robostix i2c bootloader

The i2c-Bootloader consists of two components, the bootloader itself, which is installed on the robostix (or any other ATMega processor), and the i2c-load program which runs on the gumstix.

The bootloader itself must be programmed using an ISP programmer (either using an external one, or using the Robostix-Gumstix-ISP. Once the i2c bootloader has been programmed into the robostix, new programs can be downloaded over the i2c bus. This is especially useful if you have multiple robostix, or other atmega processors connected to the gumstix via the i2c bus.

The i2c-load program (which runs on the gumstix) is also quite small (around 32k), which is considerably smaller than uisp and the associated C++ support libraries.

Setup I2C on the gumstix
You'll need to get i2c working on the gumstix. This is covered on the I2C on the Gumstix page.

The BootLoader
A precompiled version of the i2c-BootLoader is available as: i2c-Boot-m128-16MHz.hex

Building the i2c-BootLoader from source
The source code for the i2c-BootLoader is available from SVN. You'll also need the Common and Shared directories.

You can also fetch them from SVN using the following commands: cd to the directory containing gumstix-buildroot svn co http://svn.gumstix.com/gumstix-buildroot/branches/projects/robostix robostix and then build it using: cd robostix/i2c-BootLoader make

Installing the i2c-BootLoader
In order to use the i2c-BootLoader, some of the fuse settings on the robostix will need to be changed. The Robostix-Fuses page gives an overview. You'll want to make the following changes:

For AVR Studio Check Preserve EEPROM memory through the Chip Erase Cycle [EESAVE=0]  Check Boot Flash section size=2048 words [BOOTSZ=01]  Check Boot Reset Vector Enabled [BOOTRST=0] 

For PonyProg2000: Check EESAVE Uncheck BOOTSZ1 Check BOOTSZ0 Check BOOTRST

For uisp: ./uisp --wr_fuse_l=0xbf --wr_fuse_h=0xc2 --wr_fuse_e=0xff

There are now a couple of scripts in SVN for programming the fuses. pgm-fuse-standalone is suitable for downloading programs using uisp. pgm-fuse-bootloader is designed for use with the i2c-BootLoader.

Then to install the actual bootloader: ./uisp --erase --upload if=i2c-Boot-m128-16MHz.hex

IMPORTANT: If you're using PonyProg, make sure that you're using v2.06fBETA or newer. Older versions of PonyProg2000 seems to have problems reading the i2c-Bootloader .hex file properly.

i2c-BootLoader modes
When the i2c-BootLoader first starts, it will flash the red LED 5 times per second for a period of time determined by the boot-delay (default is 5 seconds). If a BL_REG_GET_INFO command is not received in that period, the main program will be launched.

If no main program has yet been downloaded, or a BL_REG_GET_INFO is received during the boot-delay, or the force jumper is installed, then the bootloader will enter bootloader mode. While in bootloader mode, the red LED will flash 2 times per second, and the bootloader will wait indefinitely for commands.

Installing a jumper between pins 9 and 10 on the ISP header (the two end pins furthest away from pin 1) will force bootloader mode, whether a main program exists or not.

Troubleshooting
If you don't see the red LED flashing, but you do see it flash briefly when you power on the gumstix, then take a look at the Robostix power page. There are also some steps for testing the i2c hardware connection on the Robostix i2c test page.