cancel
Showing results for 
Search instead for 
Did you mean: 

What is causing the STM32L4 Eval Kit to stay in DFU mode after flashing valid firmware? (Project Attached)

BCogh.3
Associate

(Project meant to run on STM32L4R9I-EVAL attached)

Ultimately, I am trying to put my device into DFU mode by having the device erase its own flash and reboot into system memory (the erase and reset code executes from RAM). Then flash firmware to the device via STM32CubeProgrammer and have the device automatically restart into this newly flashed firmware without having to remove power from the device.

The problem I am having is that after the device successfully wipes itself, boots into system memory, and is re-flashed, it restarts back to system memory (DFU). The BOOT0 pin is pulled low but regardless of my option byte user configuration in FLASH, or the MEM_MODE in SYSCFG, the device keeps booting back to system memory. If I fully power off the device or toggle any user configuration option bytes in flash (using STM32CubeProgrammer), it will boot into main flash. I need it to restart into main flash without changing option bytes or power cycling.

I have tried all valid combinations of option bytes, verified the BFB2 bit is not set and that the data at 0x08000000 is a valid SRAM address to use as the stack pointer.

The firmware I am re-flashing to it is the original firmware that puts it into DFU. This firmware simply starts the device and sits in a loop toggling an LED until a button is pressed. It then wipes itself and reboots.

I am using the STM32L4R9I-EVAL board with the BOOT0 selection set to 0. Below is a screenshot of the option bytes when in DFU mode:

0693W00000WL2SvQAL.png 

The references I have been using are the following:

  1. STM32L4 Reference Manual (STM32L4+ Series advanced Arm®-based 32-bit MCUs - Reference manual - specifically section 2.6)
  2. AN2606 STM32 Microcontroller System Memory Boot Mode (STM32 microcontroller system memory boot mode - Application note)
  3. UM2248 STM32L4R9I-EVAL User Manual (STM32L4R9I-EVAL - Evaluation board with STM32L4R9AI MCU - STMicroelectronics)

Any and all ideas are welcome. Thank you in advance for your time.

-Brian

0 REPLIES 0