cancel
Showing results for 
Search instead for 
Did you mean: 

STM32h747 dual flash programming via DFU class USB bootloader and Cube Programmer fails when start programming second flash bank 2

Mralt.1
Associate

I have a bootloder - this is an application stored in the first sector in flash bank1 which at start is checking if USB is connected and going in flash update mode, otherwise is jumping to a application stored in the next flash sector.

The bootloder mode code has DUAL_ BANK enabled and in the .ld file FLASH is defined as 2048k.

Cube Programmer in USB connect with this bootloder successfully programs small application that fit in the FLASH_BANK1 but for bigger applications that go over to the second bank the operation fails and the CubeProgrammer

: erasing sector 0002 @: 0x08040000 done

 14:40:10 : erasing sector 0003 @: 0x08060000 done

 14:40:10 : Erasing memory corresponding to segment 1:

 14:40:10 : Download in Progress:

 14:41:08 : Error: Write failed at address: 0x8100400 

 14:41:08 : Error: failed to download Segment[1]

 14:41:08 : Error: failed to download the File

It seams is failing at the very start programing the FLASH_BASE_2 0x8100000

The bootloder code is using generic usbd_dfu_flash.c and usbd_cdc_interface.c

Any help will be appreciated.

1 REPLY 1
Mralt.1
Associate

More on the problem. It is hard to debug as the Cube Programmer is crashing or hangs if step the bootloader but was able to stop it when happen and it was in the while loop in HardFault_Handler().

Checked the CFSR and it had BFARVALID=1 and PRECISERR=1 and BFAR=0x8100040 and this is the address of the FLASH_BLOCK_2 first try to write in it.

Not sure why this can be error when the STMH747 has this address space of the BLOCK_2 internally.

Any comment and help is appreciated.