Firmware Updates
Each of the SensorDots is able to be firmware updated via the I2C lines, even while connected in circuit. Once powered on and connected to an I2C adapter/device, the software flow of the SendorDot firmware update procedure 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 SensorDot if it is hard wired in to a bus. If you have multiple SensorDots 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 twiboot 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 in the repositories you can use to load the firmware with, which the twiboot-arduino application supports (each of these applications gets built by the Makefile).
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 SensorDot 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 SensorDot.