User Tools

Site Tools


manual:usb_demo

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
manual:usb_demo [2014/07/24 16:31]
voorburg [Notes]
manual:usb_demo [2023/06/27 09:35] (current)
voorburg [USB driver installation]
Line 1: Line 1:
 ====== Firmware updates using the USB communication interface ====== ====== Firmware updates using the USB communication interface ======
 +
  
 ===== Bootloader configuration ===== ===== 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. 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.
 +
 <​code>​ <​code>​
 #define BOOT_COM_USB_ENABLE ​           (1) #define BOOT_COM_USB_ENABLE ​           (1)
Line 8: Line 11:
  
 ===== USB driver installation ===== ===== 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: [[manual:​demos:​usb_driver_install|OpenBLT USB driver installation instructions]]. 
  
-===== Preparing Microboot ===== +Once the bootloader is programmed and running on your microcontroller system, you might 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[[manual:​demos:​usb_driver_install|OpenBLT USB driver installation instructions]].
-The Microboot utility needs to be configured ​to communicate via USB:+
  
-  * Start Microboot by double-clicking "​\Host\**MicroBoot.exe**"​. +===== Using MicroBoot ​=====
-  * Click the "​**Settings**"​-button and select "​**OpenBLT using USB**" from the dropdown box.+
  
-Once you saved the settings by clicking the "​**OK**"​-button twice, Microboot is now ready for action!+The MicroBoot utility needs to be configured to communicate via USB:
  
-===== Downloading the user program ===== +  * Start MicroBoot by double-clicking "​\Host\**MicroBoot.exe**" (on Linux it is "​\Host\**MicroBoot**"​). 
-After building your user program, its S-record formatted firmware file can be downloaded to the remaining flash memory using the bootloaderIn **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+  * Click the "**Settings**"​-button and select "**XCP on USB**" ​from the "​Interface selection"​ dropdown box.
  
-{{:manual:demos:​olimex_stm32h103_download.gif?|}}+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.  
 + 
 +{{:manual:olimex_stm32p405_download_usb.png?|}}
  
 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. 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.
  
-===== Notes ===== +===== Using BootCommander ​===== 
-When using USB as the communication ​interface, it is not recommended ​to use the default backdoor functionality,​ which keeps the bootloader active for a short time after reset. In theory it works, however the time that the backdoor stays open should be at least long enough for the installation of the USB driver ​on the host PCThis is hard to estimate and relatively long, causing long delays between ​system reset and the actual starting ​of the user program.+ 
 +The BootCommander command line interface ​(CLI) program allows you to configure all communication settings via options ​on the command lineThe following example demonstrates how to call BootCommander for making ​firmware update with one of the demo programs
  
-It is recommended to implement a custom backdoor solution in this case. This is achieved by setting configurable BOOT_BACKDOOR_HOOKS_ENABLE to a value of 1. 
 <​code>​ <​code>​
-#define BOOT_BACKDOOR_HOOKS_ENABLE ​     (1)+BootCommander -s=xcp -t=xcp_usb demoprog_olimex_stm32p405.srec
 </​code>​ </​code>​
-You can now implement your own backdoor solution in the hook-functions **BackDoorInitHook()** and **BackDoorEntryHook()**Refer to the demo programs ​for an exampleThere a solution ​is implemented ​where the bootloader ​will always ​stay active ​after a reset if a specific digital input had a pre-defined value during reset. ​+ 
 +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 relativedirectory to the name of the S-record firmware file. 
 + 
 + 
 +===== Notes ===== 
 + 
 +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 activeThis 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.1406212269.txt.gz · Last modified: 2019/09/24 22:09 (external edit)