2022-08-05 09:27 AM
Hello,
I am working on the USB DFU for a STM32H7A3ZGT6
I have two projects one for the DFU and one with the application to be updated.
My application works fine when I download it with the debugger.
The DFU part manages to erase and program the new app to the flash (I read it back with the ST link and there is no error nor address shift)
However, the app doesn’t work when it is loaded by the DFU program. I jump from the DFU app to the start address of the application which starts but seems to crash at random moments during execution (from seconds to minutes)
I have set up the app start app address in the DFU to
#define USBD_DFU_APP_DEFAULT_ADD 0x0800C000U
Then in the app software I have made the following :
In the FLASH.ID: FLASH (rx) : ORIGIN = 0x0800C000, LENGTH = 970K
In the system_stm32H7xx.c: #define VECT_TAB_OFFSET 0x0000C000UL
I suspected the interruption vector of the DFU app to still be working in a way but I can’t find a reason. I set it up in the right way with VECT_TAB_OFFSET
I also looked at the dual bank issues but as the binary file is loaded in the right place of the memory, I think it is not the problem here.
Have you ever seen this kind of issue?
Thank you,
Best Regards
Augustin
Solved! Go to Solution.
2022-08-08 08:35 AM
Hello and thank you for your answers it helped me find the issue
On this MCU, it comes from the dual bank definition of the flash. It has 1MB of flash separated in two banks and the base address of the second bank is set to 0x081000000 even though the flash is in one block, so this address is the end of the bank 2 and not the start hence the error
While copying the software with the dfu was working fine, at the execution is caused a crash.
Thanks a lot
2022-08-05 09:31 AM
Perhaps pick a basis that's some multiple of the flash sector size?
2022-08-05 10:05 AM
Why not internal system loader?
2022-08-05 10:19 AM
Reports someone else's VID/PID, doesn't support external memory?
People have their reasons, let's focus on why it's not working
2022-08-05 10:26 AM
Nevermind, 8KB Sectors on the H7A3
Perhaps have your SystemInit() code set the SCB->VTOR based on the linker symbol for the base of the vectors as built?
Find some way to debug the transfer of control.
Perhaps have very simple code in the ResetHandler to indicate it landed properly, and instrument everything so you can follow what's happening.
Integrity check the app image to confirm what was written matches what was sent/expected.
Most uses might expect basic integrity or signing to attain certification.
2022-08-05 10:55 AM
This working , but crash later. This is maybe because jump from DFU reinitializes peripherals and not all is ok. I recommend after update in DFU reboot to APP with some reset method , detect it in first DFU main line and jump to app.
@ABric.1 work your updated code after power off reset ?
2022-08-08 08:35 AM
Hello and thank you for your answers it helped me find the issue
On this MCU, it comes from the dual bank definition of the flash. It has 1MB of flash separated in two banks and the base address of the second bank is set to 0x081000000 even though the flash is in one block, so this address is the end of the bank 2 and not the start hence the error
While copying the software with the dfu was working fine, at the execution is caused a crash.
Thanks a lot