about 1 year ago
A bootloader for the ioNode
It's here at last! After spending the weekend working on this (and my new shower plumbing), the ioNode now has a bootloader.
Named Kiwi, it is provided with the Dooba SDK and built as just another application with the rest of the source tree.
I would like to thank Optiboot which was a great source of documentation.
Every ioNode shipped by Dooba comes pre-loaded with the Kiwi bootloader. All you need to do to flash an ioNode is connect it via USB to a computer equipped with any version of avrdude accepting the "-c arduino" arguments (all recent versions do).
Upon power-up, the ioNode will start its bootloader. From there you have 4 seconds to run avrdude to upload a firmware application. If nothing happens within this short delay, the bootloader starts whatever application is stored in flash memory.
ACT LED flashes to indicate bootloader is running
How it works
When the ioNode starts, the bootloader is run. The first thing Kiwi does is check the reason for the start (external reset? power-on-reset? watchdog timer reset?).
For any reason other than "WDT Reset" (which we'll look at later), the bootloader continues with normal operation, presenting a "simplified" STK500 programmer through the ioNode's USB UART.
During initialization, Kiwi also sets up a 2-second Watchdog Timer - if nothing happens for more than this timeout delay, the ioNode automatically resets, setting the reset reason to "WDT Reset".
WDT Reset start
If the reason is "WDT Reset" (Watchdog Timer Reset), the application is started immediately.
ioNode ready for USB programming