cancel
Showing results for 
Search instead for 
Did you mean: 

Bank Swap works on H743 but not H745

jondoe0608
Associate II

I'm having some trouble performing a bank-swap on an STM32H745. The function works perfectly fine on an H743, but when porting over to the H745, it doesn't run the firmware that was swapped in.

Firmware 1: prints "1.0". A button press will trigger a bank-swap & reset

Firmware 2: prints "2.0". A button press will trigger a bank-swap & reset

1. Erase the chip, everything reads 0xFF
2. Flash firmware1.bin at 0x08000000 (bank 1)
3. Press user button to perform a bank swap
4. Banks are now swapped, and 0x08000000 is now empty (0xFF...)
5. Flash firmware2.bin at 0x08000000
6. Pressing the user button continuously will print "1.0" and "2.0" to the console alternately


This sequence works fine on a H743 Nucleo board, but when tried on a H745 Disco board, it will immediately stop working if another firmware is flash after step 4. And any firmware flashed after step 4 will not run until the whole chip is erased with STM32-Utility.

Does anyone know why this is happening on the H745? My only suspicion right now is that the H745 is a dual core (M7 and M4), and after reading the AN5557 manual, it seems like the M4 core is executing at flash address 0x08100000 (bank 2), so maybe it's executing the code that was swapped in from previous bank and caused some sort of timing issue.

I've tried disabling the M4 core by setting the BCM4 option byte to 0 with STM32CubeProgrammer to prevent the M4 core from booting, but no luck. So, I'm curious if there are additional steps required to carry out a Bank Swap on H745.

Currently, I'm using Mbed-OS to do this test.

4 REPLIES 4

What's the fully qualified part# for both these devices?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
jondoe0608
Associate II

NUCLEO-H743ZI2 and STM32H745-DISCO are what I have.

I have tried changing the boot address option bytes for the M4 core to somewhere on the very last sector on the flash at 0x081F0000, and this seems to make bank-swapping work on the H745. I'm assuming the test firmwares are not big enough to overrun to that sector when swapped.

So, I'm guessing it does have something to do with the M4 booting the code on Bank 1 after swapping. Curious as to why disabling the M4 core from booting by setting BCM4 to 0 did not help.

KDJEM.1
ST Employee

Hello @jondoe0608 ,

 

Could you please refer and follow the steps and the recommendations shared in these FAQs:

These FAQs described an Swap bank example using NUCLEO-H745ZI-Q.

 

I hope this help you!

Kaouthar

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hi Kaouthar, I have read that article before. I have not test it out since I'm using Mbed-OS and not STM32CubeMX. But my swapping function was heavily copied from that post, and it works great. My problem arises after banks are successfully swapped on the H7450i-Disco.

My suspicion right now is that after swapping, the M4 core seems to be booting from the firmware that was previously resides bank 1, (which is now bank 2 after swapping), since on the H745, the M4 core is executing from flash address 0x08100000, which is bank 2. This somehow causes the M7 firmware to not boot. 

I have tried to clock gating the M4 core by unsetting the option byte BOOT_CM4 using STM32-Utility but no luck.

The only way I was able to get it to work is moving the CM4_BOOT_ADDRESS from 0x08100000 to 0x081F0000, which is the last 64KB of the flash. However, this is just a bandage fix for now.

I guess my question now would be how properly disable the M4 core from booting since unsetting the BOOT_CM4 option byte didn't really seem to help.