Close

Remote Bootloader Update

A project log for HEXABITZ - Modular Electronics for REAL

A new kind of electronic prototyping!

hexabitzHexabitz 09/28/2018 at 18:070 Comments

Sometimes you don't have access to module programming port when it's embedded in the middle of the array and you don't want to use the SWD pins; Or sometimes you design your array so that programming ports are connected to other ports; Sometimes you're just feeling lazy and don't want to connect to each module to update its firmware! For all these cases, we added a feature to remotely update a module via nother one using ST factory bootloader and the ST Flash Loader Demonstrator tool. Check this article for a review of all firmware update methods in Hexabitz.

Usage

The same command used for normal bootloader update is used for remote update. There are two basic forms:

#3.update

where you remotely update module 3 via another module. Note in this case module programming port (marked with asterisk) must be in the shortest path to the module. Example of this is updating module 2 in the array before while connecting to module 1, port 1. 

The other format (via-port remote update) is:

update via #3 p5

where you remotely update the module that has its programming port connected to module 3, port 5. This format is useful in two situations:

Note: After remote updates, you need to power cycle the entire array to restore normal operation.

How does it work?

The remote update command backend stacks serial ports and DMA streams to construct a bidirectional pipeline between the the port connected to ST Flash Loader tool and the programming port of target MCU (which will be running ST factory bootloader through that port). However, few things must happen first, in the correct order, before a successful connection:

  1. The source module sends a message to target module asking it to jump to its bootloader. In the remote update format #n.update, n is the target module. In the remote via-port update format update via #n pm, the target module is the one connected to module n, port m. Note that if you want to update firmware on an empty module (or one that doesn't run Hexabitz firmware) that is not in its bootloader mode, you must force it into that mode.
  2. Baudrate for all involved serial ports must change to 57600 to be compatible with ST bootloader settings.
  3. Parity for all involved serial ports must change to EVEN to be compatible with ST bootloader settings.
  4. The last port before the target must swap its pins since the serial port in ST bootloader will restore its normal pinout configuration.
  5. Finally a bidirectional DMA stream must be established. The stream is setup with infinite timeout and number of bytes. Thus, once you're done with the update you must power cycle the array to restore everything to normal operation.

Examples

The video below shows a step-by-step guide of remote updating module 2 in the array above from module 1, port 1. 

This video demonstrates successful remote bootloader update of module 6 in the array above from module 1, port 1. Module 6 is three MCUs away from the ST Flash Loader tool!

Discussions