AnsweredAssumed Answered

STM32CubeProgrammer with DFU erase error

Question asked by Ben K on May 1, 2018

I recently started using the STM32CubeProgrammer for flashing MCUs via their DFU bootloader in the system memory. (After resolving the windows driver conflict with DfuSe, the lesson is: use Zadig instead of the batch file.) When using the DFU bootloader in the system memory to flash an ELF file, I get the following error log:

21:53:04 : Memory Programming ...
21:53:04 : Openeing and parsing file: E:\Workspace\DfuBoot\F4xxxGxx\DfuBoot.elf
21:53:04 :   File          : E:\Workspace\DfuBoot\F4xxxGxx\DfuBoot.elf
21:53:04 :   Size          : 8040 Bytes
21:53:04 :   Address       : 0x08000000
21:53:04 : Erasing memory corresponding to segment 0:
21:53:04 : Erasing internal memory sector 0
21:53:04 : erasing sector 0000 @: 0x08000000 done
21:53:04 : Erasing memory corresponding to segment 1:
21:53:04 : Error: Operation exceeds memory limits
21:53:04 : Error: Failed to erase memory
21:53:04 :   Address:      : 0x0
21:53:09 : Error: Start operation failed

The target MCU is an STM32F407VGT6 (Discovery board). My suspicion is that there is a bug when handling images with smaller size then a single flash sector. Why else would it try to erase sector 1, where nothing is allocated to in the image?

 

The USB packet log shows that the programmer

1. sets address to 0x08000000

2. erases sector at address 0x08000000

3. sets address to 0x00000000

After step 3 the bootloader enters DFU_DNLOAD_BUSY then DFU_ERROR state with error=TARGET, most likely highlighting the incorrect address.

 

At this point the programmer's GUI displays the error, however it keeps polling the bootloader DFU status endlessly, which I would also consider an incorrect behavior. It should send a DFU CLRSTATUS request instead, and wait for new user command.

Outcomes