Robostix i2c load

From GumstixDocsWiki

Jump to: navigation, search

The i2c-load program runs on the gumstix and communicates with the i2c-BootLoader.


Contents

Using i2c-load

i2c-load --help produces the following output:

Usage: i2c-load [options] i2c-addr cmd file
Communicate with i2c boot loader
 
Only one of the following commands may be specified
Info         Display information about the bootloader
Read         Read from memory from th device
Write        Write to memory on the device (default)
Verify       Verify the contents of memory on the device
SetI2cAddr   Sets the i2c address (and reboots)
SetBootDelay Sets the time that the boot loader waits for an i2c command
SetNodeName  Sets the node name of the device
Reboot       Reruns the bootloader from the beginning
Run          Runs the user program
 
Only one of the following memory options may be specified
-f, --flash Perform the desired operation on flash memory (default)
-e, --eeprom Perform the desired operation on EEPROM memory
-s, --sram Perform the desired operation on SRAM memory
 
The following arguments may be used to modify the behaviour
--start-addr=addr Starting file addresses to use
--end-addr=addr   Ending file address to use (inclusive)
--length=len      Alternate way of specifying the stop address
--verbose         Print additional information
--quiet           Don't print anything (except errors)
--serial-log      Log lines received on /dev/ttyS2
--reset           Resets the robostix (only works if plugged into gumstix)
--reboot          Reboots into the bootloader
--help            Prints this information


Info i2c-addr

The info command prints information about the device that the i2c-BootLoader is installed on. The output for a robostix typically looks like this:

# ./i2c-load --reset 0x0b info
I2C Dev Addr: 0x0b
     Version: 1
  MinVersion: 1
 Part Number: 0x9702 (ATMega128)
    Reg Size: 256
    RAM Size: 4096
 EEPROM Size: 4096
   Page Size: 256
  Flash Size: 128k
   Node Name: 'TestNode'
  Boot Delay: unset, defaults to 5 seconds
    I2C Addr: unset, defaults to 0x0b


i2c-addr Read fileName.hex

The read command reads a region of memory from the i2c device and stores it in a .hex file. The --eeprom, --sram, and --flash modifiers can be used to control which region of memory is read (--flash is the default). The --start-addr, --end-addr, and --length options can be used to limit the amount of data read. If no location modifiers are specified, then the entire memory region will be read.


i2c-addr Write fileName.hex

The write command reads a .hex file and writes into the designated memory area. The --eeprom, --sram, and --flash modifiers can be used to control which region of memory is written to (--flash is the default). The --start-addr, --end-addr, and --length options can be used to limit the amount of data written. If no location modifiers are specified, then the entire contents of the .hex file will be written.

The write command also performs an automatic verification if writing to flash or eeprom. For flash devices, the i2c device is also instructed to reboot.

If you're updating the firmware of a program which is using the i2c slave code from the bootloader, then you should use the --reboot option to cause the main program to transfer control to the bootloader. Otherwise the write will almost certainly fail, as you'll be overwriting the code that's currently running.


i2c-addr Verify fileName.hex

The verify command reads a .hex file and compares it to a region of memory in the i2c device. The --eeprom, --sram, and --flash modifiers can be used to control which region of memory is verified (--flash is the default). The --start-addr, --end-addr, and --length options can be used to limit the amount of data compared. If no location modifiers are specified, then the entire contents of the .hex file will be verified.


i2c-addr SetI2cAddr new-i2c-addr

Changes the i2c address from it's current setting to the new setting. The i2c device is also instructed to reboot itself so that the new i2c address can take effect. The i2c address is persisted in EEPROM.


i2c-addr SetBootDelay bootDelay

Sets the boot delay for the i2c bootloader. This is the amount of time that the bootloader will wait for an i2c command before starting the application programmed into flash. The boot delay is persisted in EEPROM.


i2c-addr SetNodeName nodeName

The i2c-Bootloader reserves a few bytes of EEPROM to store a node name. This is intended to be used to provide a symbolic name for each i2c device.


i2c-addr Reboot

Instructs the i2c device to reboot itself.


i2c-addr Run

Runs the application program currently programmed into flash.


Installing i2c-load

You'll need to setup I2C on the gumstix as described on the I2CQuickStart page. You can then copy the ic-load executable into an appropriate place on the gumstix (line /bin). precompiled version can be found in the appropriate tarball:

Building i2c-load

The i2c-load source code is located in SVN. You'll also need the robostix/Shared and robostix/gumstix/Common directories. Once all of the source code is collected, i2c-load can be built using:

make

Troubleshooting

There are some steps for testing the i2c hardware connection on the Robostix i2c test page.

Personal tools