Close

I2C Firmware Updates

A project log for MappyDot

Micro Smart LiDAR Sensor

bleckyBlecky 08/03/2017 at 07:580 Comments

Just a quick one to let you know that the I2C firmware updates are now working on the MappyDot. The software flow of the MappyDot firmware update proceedure is as follows:


The bootloader loads first on startup and waits for a bootloader start message on I2C address 0x07 for 200ms. This is a safety feature that allows you to recover modules with a bad flash or modified firmware that prevent it going into bootloader mode while running. You can power cycle the chip by briefly shorting the reset pin on the MappyDot if it is hard wired in to a bus. If you have multiple MappyDots on a bus that aren't functional, you can hold the reset line low on all of them and just do one at a time.

When the application is running, you can enter the bootloader to enable flashing at any stage while it's operational using it's auto addressed I2C address. Once it boots into bootloader mode, it switches to I2C address 0x07 for the bootloader process. The programming software automatically changes this address for you during the firmware flashing process.

The programming software works with any standard Linux I2C device, such as /dev/i2cX on the Raspberry Pi's Broadcom chipset. If you don't have an I2C device, or are using Windows, there is also an Arduino I2C->USB adapter sketch you can use to load the firmware with, which the application supports.

Here's the output from the software:

twiboot-arduino -a 0x08 -d /dev/ttyS4 -w flash:MappyDot.hex
device         : /dev/ttyS4       (address: 0x08)
version        : MDBOOT328PBv2.1  (sig: 0x1e 0x95 0x16 => ATmega328PB)
flash size     : 0x7c00 / 31744   (0x80 bytes/page)
eeprom size    : 0x0000 /     0
writing flash  : [**************************************************] (9642)
verifing flash : [**************************************************] (9642)

If the firmware fails to verify, you can run the flash operation again. If you power cycle the MappyDot after the firmware fails to verify, or you load a modified firmware that doesn't support the bootloader mode command, then you can always recover by entering the bootloader during startup of the MappyDot.

Discussions