wiki:Stuff/FirmwareUpdate

Version 11 (modified by art, 13 years ago) (diff)

--

Firmware update

Firmware

As the firmware we call the software running on the OpenBM device, so which is programmed into the uC to control the button fields. Here I would like to show a protocol which I developed in order to update the firmware of the OpenBM device through IBus. Hence no extra hardware is required. A special application can send the firmware using this protocol to the OpenBM device. If sending was ok, no error, then the firmware will be written to the device flash.

Bootloader

Since I am using AVR ATmega32 as the uC the update of the firmware can only be done in the bootloader mode. Special code is written to the bootloader section of the uC and is executed on the start or reset. The bootloader checks for special commands and if nothing received it passes the execution to the main software. So in order to activate bootloader mode on the OpenBM device we do following:

  • reset OpenBM manually or by an ibus message:
    • manually: hold MENU+SELECT+EJECT and the release MENU
    • ibus command: FF 07 F0 FA BA AD FE ED .. (dst = BMBT:0xF0, src = FF(ignored), msg = OpenBM_Request:0xFA, data = [0xBA, 0xAD, 0xFE, 0xED])
  • OpenBM send its version information as a message over the ibus:
    • openbm send: F0 len FF FB 00 01 02 12 rr rr chk (major version 16bit = 1:00 01, minor version 16bit = 530:02 12, rr - reserved bytes)
  • now we have around one second time to send messages over ibus to set bootloader into "Firmware Update" mode:
    • send "Activate_Update_Mode" message incl. a password of up-to a length of 32 bytes (fill with 00 if not set): FF 24 F0 FA FF pp pp pp ... pp chk (password is specific to every OpenBM unit)

  • if password was correct bootloader answer with: F0 05 FF FB hh ll chk, where hhll is a 16bit number representing the sum of all password bytes
    • bootloader is activated and Yellow LED lights on
    • bootloader is deactivated if it not receive any firmware code chunks for the next 10 seconds (If boot loader is deactivated, Yellow LED turns off)
    • bootloader is also deactivated, when full firmware code was transmitted (see next section of how to transmit firmware)