Hard fault during EEPROM emulation Init with STM32C5A
Hello everyone,
I am having an issue with EEPROM Emulation initialization in my STM32 project.
I am currently trying to implement the EEPROM Emulation utility using STM32CubeMX2 v1.1.0.
The program starts with mx_system_init(), which initializes the peripherals and other required modules such as FLASH, RCC, etc. After that, I call mx_eeprom_emulation_init(). During this initialization, the MCU enters a HardFault.
Detailed information
The call hierarchy is:
main() → mx_eeprom_emulation_init() → EE_Init() → EE_FLITF_Init() → Page_GetState() → EE_ITF_FLASH_ReadData()
Inside EE_ITF_FLASH_ReadData(), the code tries to access address:
0x09000018
and immediately enters a HardFault.
I also analyzed the fault using the Fault Analyzer in STM32CubeProgrammer. The results are:
- SCB_BFAR:
0x09000018 - BusFault: Precise data access error (
PRECISERR) - The BusFault is escalated to a HardFault (
FORCED)
I also checked the EDATA_EN option bit in STM32CubeProgrammer, and it appears to be enabled correctly.
At this point, I am not sure why accessing the EDATA region causes a BusFault.
Has anyone experienced a similar issue with EEPROM Emulation / EDATA on STM32C5 devices?
Is there any additional configuration required, such as MPU/SAU memory region configuration, privilege settings, or FLASH security/access configuration, before accessing the EDATA area?
Any suggestions would be greatly appreciated.
Thank you.
