Emulated EEPROM can be used in embedded applications where nonvolatile storage of data updated with a byte, half-word, or word granularity is required. Data size generally depends on application requirements such as sensor or communication-interface data size.
The EEPROM emulation firmware is designed to support byte, 16-bit half-word, and 32-bit word granularity (96-bit word granularity for STM32U5 series). However, to optimize the flash memory usage, the user application can gather all smaller sized data elements into 32-bit data elements before storing the content in emulated EEPROM. This would ensure an optimal use of the 64-bit flash memory line by simultaneously writing the 16-bit virtual address, the 16-bit CRC, and the 32-bit data value.
Conversely, it is possible to write the 32-bit data value on two 16-bit half-word with the 16-bit virtual address and the 16-bit CRC, allowing a 32-bit data granularity in the high-cycle data area available in STM32H5 series, which only supports 16-bit half-word granularity by line.
For STM32U5 and STM32H5 series, the user can gather all smaller sized data elements into 96-bit data elements before storing the content in emulated EEPROM. This ensures optimal use of the 128-bit flash memory line by simultaneously writing the 16-bit virtual address, the 16-bit CRC, and the 96-bit data value.
Note: The minimal write width in flash memory is 64 bits (128 bits for STM32U5 and STM32H5 series, or 16 bits for STM32H5 series using high-cycle data area) due to its ECC (error correcting code), commands, which cannot be switched off.