Skip to main content
Graduate
November 30, 2023
Solved

STM32H5 bank swap and EDATA

  • November 30, 2023
  • 2 replies
  • 1632 views

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?

    This topic has been closed for replies.
    Best answer by PieterG

    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.

    2 replies

    PieterGAuthorAnswer
    Graduate
    November 30, 2023

    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.

    Explorer II
    February 13, 2024

    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.