AnsweredAssumed Answered

Stm32F411 Software DFU (STM32CubeMX based)

Question asked by Stanislav Silnicki on Dec 7, 2017
Latest reply on Dec 8, 2017 by Stanislav Silnicki



I'm facing a problem with flashing my firmware into dedicated sectors of MCU.

Memory layout I use is following (link script fragment):


/* Specify the memory areas */
FRAM (xrw)      : ORIGIN = 0x20000000, LENGTH = 32K
RAM (xrw)      : ORIGIN = 0x20008000, LENGTH = 96K
STARTUP (rx)   : ORIGIN = 0x8000000, LENGTH = 16K
EEPROM (rw)    : ORIGIN = 0x8004000, LENGTH = 48K
FIRMWARE (rx)  : ORIGIN = 0x8010000, LENGTH = 64K
FLASH (rx)     : ORIGIN = 0x8020000, LENGTH = 374K


All CubeMX generated stuff go in FLASH section, FIRMWARE accumulates the code I wish to update time to time.


Software base DFU implementation in attachment and follows example code, provided with CubeMX. Basically, it works (HAL_FLASH_Program and HAL_FLASHEx_Erase return HAL_OK).


The problem, which I see, is frustrating:

If i upload and flash existing firmware (that is flashed alongside with main code when I reprogram MCU over SWD), MCU boots and everything looks fine after power reset. But when I modify firmware part and upload it, DFU process finishes without errors, but MCU doesn't reveal any signs of life after power reset. So I just forced to reprogram it in conventional way. I tied to align firmware to the size of sector (64K) and it doesn't help.


Any clues?