stm32bootloaderstm32f4dfu

STM32 DFU USB - run the uploaded code without a hardware reset?


If using the standard DFU USB built-in bootloader to STM32F412, after uploading the new firmware, is it possible to run the uploaded code without a hardware reset or changing other GPIOs?

Or alternatively, is there some way I can trigger a reset using only the USB signals to STM32 (D+/-)? Cutting the power is not an option.


Solution

  • Application note AN2606 covers the system bootloader.

    From page 31:

    System memory boot mode can be exited by getting out from bootloader activation condition and generating hardware reset or using Go command to execute user code.

    Note: When executing the Go command, the peripheral registers used by the bootloader are not initialized to their default reset values before jumping to the user application. They must be reconfigured in the user application if they are used. So, if the application uses the IWDG, the IWDG prescaler value must beadapted to meet the requirements of the application (since the prescaler was set to its maximum value). For some products, not all reset values are set. For more information, refer to the known limitations detailed for each product bootloader version.

    Page 43:

    enter image description here

    Next, let's take a look at AN3156 USB DFU Bootloader Application Note, page 19 (there is more useful info on that page and just before it on specific commands you need to use to exit DFU to specific address, or do a system reset):

    Leave DFU mode
    It is possible to exit DFU mode (and bootloader) and jump to a loaded application (in the internal flash memory or in the embedded RAM) using the DFU download request.