cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H5 bank swap and EDATA

PieterG
Associate III

I'm wondering what happens with the EDATA sectors when bank swapping is enabled.

In the GetBank_EDATA() helper function in the FLASH_EDATA_EraseProgram example, the FLASH_OPTSR_SWAP_BANK flag is not checked, so it would seem the EDATA areas do not swap when the banks are swapped.

Is that indeed the case?

1 ACCEPTED SOLUTION

Accepted Solutions
PieterG
Associate III

I think I found the answer:

https://www.st.com/resource/en/reference_manual/rm0481-stm32h563h573-and-stm32h562-armbased-32bit-mcus-stmicroelectronics.pdf

secton 7.3.10

"When SWAP_BANK feature is enabled, the banks are swapped: the flash high-cycle data in
Bank 2 are accessible from 0x0900_000 to 0x0900_BFFF and the data in Bank 1 are
accessible from 0x0900_C000 to 0x0901_7FFF"

This means the GetBank_EDATA() helper in the FLASH_EDATA_EraseProgram example is incomplete, it should have checked the FLASH_OPTSR_SWAP_BANK flag, just like the GetBank() helper in the FLASH_EraseProgram example does.

View solution in original post

2 REPLIES 2
PieterG
Associate III

I think I found the answer:

https://www.st.com/resource/en/reference_manual/rm0481-stm32h563h573-and-stm32h562-armbased-32bit-mcus-stmicroelectronics.pdf

secton 7.3.10

"When SWAP_BANK feature is enabled, the banks are swapped: the flash high-cycle data in
Bank 2 are accessible from 0x0900_000 to 0x0900_BFFF and the data in Bank 1 are
accessible from 0x0900_C000 to 0x0901_7FFF"

This means the GetBank_EDATA() helper in the FLASH_EDATA_EraseProgram example is incomplete, it should have checked the FLASH_OPTSR_SWAP_BANK flag, just like the GetBank() helper in the FLASH_EraseProgram example does.

robmilne
Associate III

I adjusted the 'X-CUBE-EEPROM v6.1.0' project from ST to accommodate bank switching for the H5 and it works!  I'm totally amazed.  Changes to the emulated eeprom contents will propogate to the opposite bank just as the RM states.  I wouldn't believe until I saw it.