0

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

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

Calum Nicoll
  • 109
  • 5
  • 1
    Maybe you could explain why you would want to do that. This feels like an odd problem to want to solve. – pmacfarlane Jul 12 '23 at 20:02
  • Sure. External flash is connected to stm32, I want (the user) to connect stm32 to PC, then click a button on PC, then pc uploads new code to internal and external flashes, in one operation (I.e without requiring the user to press another button on stm). So new firmware is uploaded using dfu then this new firmware runs and loads the data to external flash. As far as I know it isn't possible to just flash both int and ext flashes using dfu and the builtin stm bootloader, in the same operation, or is it? – Calum Nicoll Jul 13 '23 at 02:29

1 Answers1

1

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.

Ilya
  • 992
  • 7
  • 14