Stm32F411 Software DFU (STM32CubeMX based)
- December 7, 2017
- 5 replies
- 1848 views
Hi!
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 */
MEMORY{FRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32KRAM (xrw) : ORIGIN = 0x20008000, LENGTH = 96KSTARTUP (rx) : ORIGIN = 0x8000000, LENGTH = 16KEEPROM (rw) : ORIGIN = 0x8004000, LENGTH = 48KFIRMWARE (rx) : ORIGIN = 0x8010000, LENGTH = 64KFLASH (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?
#dfu #stm32f411