High-cycle data area of flash memory
The embedded flash memory of STM32H563/H573 and STM32H562 MCUs offers up to 96 Kbytes (maximum) memory area with high cycling capability (100 kcycles) to store data and emulate EEPROM. It can be accessed through the AHB system port from the following address: 0x0900_0000 to 0x0901_7FFF. It is mapped in the eight (or four) last sectors of Bank1 and 2. This area is protected by a robust 6-bit ECC, which enables a read and write granularity of 16 bits at the expense of having sector size shrunk to 6 Kbytes.
A threshold per bank (EDATA(1/2)_STRT) is programmable in user option bytes to determine the beginning of the data flash area. By default, all flash memories are used for code. For example, if 48 Kbytes of data are needed in Bank1, set EDATA1_EN to 1, and EDATA1_STRT to 7. If no data are needed in Bank2, set EDATA2_EN to 0. In this case, the data are accessible from address 0x0900_0000 to 0x0900_BFFF for Bank1. For greater efficiency, it is always recommended to use sector on the other bank for flash memory high-cycle data, so that the application benefits from the RWW capability of the dual-bank arrangement. When the SWAP_BANK feature is enabled, the banks are swapped. The flash memory 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.
A bus error is generated on:
- Attempt to access an address between 0x0900_0000 to 0x0901_7FFF while this address is not valid (EDATA(1/2)_EN not enabled or EDATA(1/2)_STRT not correct).
- Attempt to fetch instructions from flash memory high-cycle data area. Erasing the data area sector is possible by normal erase request for the corresponding user flash memory sector (120-127).
More information about the high-cycle data area and its protections are documented in AN4894_General-information.html#id_60716__entry_a2h_xy5_11c
