Firmware updates using the USB communication interface

Bootloader configuration

In order to perform firmware updates with the OpenBLT through the USB communication interface, double-check that this communication interface is configured in “blt_conf.h”. The following macro should have a value of 1. If this macro did not yet have a value of 1, the bootloader should be rebuild after making the change.

#define BOOT_COM_USB_ENABLE            (1)

USB driver installation

Once the bootloader is programmed and running on your microcontroller system, you will be prompted to install the USB driver, after connecting the system to your PC's USB port. The driver installation is described on a seperate page: OpenBLT USB driver installation instructions.

Using MicroBoot

The MicroBoot utility needs to be configured to communicate via USB:

  • Start MicroBoot by double-clicking “\Host\MicroBoot.exe” (on Linux it is “\Host\MicroBoot”).
  • Click the “Settings”-button and select “XCP on USB” from the “Interface selection” dropdown box.

Once you saved the settings by clicking the “OK”-button, MicroBoot is now ready for action!

After building your user program, its S-record formatted firmware file can be downloaded to the remaining flash memory using the bootloader. In MicroBoot click the “Browse”-button and select your user program's firmware file. For the demo programs, this one is located in the ”.\Prog\bin\” directory. Once the firmware file was selected, the download should automatically start.

Once the download completed, the newly programmed software will be started by the bootloader. For the demo program's you can verify this by checking that the LED blinks. Congratulations! That's all there is to using the bootloader.

Using BootCommander

The BootCommander command line interface (CLI) program allows you to configure all communication settings via options on the command line. The following example demonstrates how to call BootCommander for making a firmware update with one of the demo programs.

BootCommander -s=xcp -t=xcp_usb demoprog_olimex_stm32p405.srec

The example assumes that the S-record of the demo user program is located in the same directory as where the BootCommander executable itself resides. If not, then simply prepend the absolute (or relative) directory to the name of the S-record firmware file.


When using USB as the communication interface, the bootloader stays active a bit longer than usual. This extension time can be configured via configuration macro BOOT_COM_USB_BACKDOOR_EXTENSION_MS in “blt_conf.h”. This extra time is needed for the USB device to enumerate on the PC, to the point that the bootloader can detect firmware update requests.

This time might not be long enough in the situation where the USB driver was just installed on the host PC and the USB enumeration takes place for the first time. For this reason it is highly recommended to implement an additional method to force the bootloader to stay active. This latter case happens when the CpuUserProgramStartHook()-function is enabled and returns BLT_FALSE. All OpenBLT demo programs that support firmware updates via USB have such a method implemented for forcing the bootloader to stay active. Typically if a push-button stays pressed for a few seconds during and after a microcontroller reset. Refer to the CpuUserProgramStartHook()-function in the bootloader demo programs for more details.

manual/usb_demo.txt · Last modified: 2018/07/27 23:29 by voorburg
Powered by PHP Driven by DokuWiki