EEPROM Emulation for STM32WB55 Example missing
Hi
I`m working on a customised STM32WB55 board and trying to implement eeprom emulation.
According to AN4894
there should be a BLE_HeartRate_EEPROM_Emul example somewhere but looking at STM32Cube_FW_WB_V1.12.0 package I can`t find it. I have also checked the STM32 github page but still no chance . Has anyone have access to this example ?

I have this piece of code which is called after HAL_Init and returns EE_ERASE_ERROR after calling EE_Init(EE_FORCED_ERASE);
void ReadMode() {
uint8_t configMode[4] = { 0 };
Flash_ReadNBytes(EEPROM_WRITE_MODE_ADDR, &configMode[0], 4);
if (configMode[0] == 0xAA && configMode[1] == 0xBB && configMode[2] == 0xCC
&& configMode[3] == 0xDD) {
moduleInfo.configMode = 1;
return 1;
}
moduleInfo.configMode = 0;
return 0;
}void Flash_ReadNBytes(uint16_t addr, uint8_t *data, uint32_t n) {
EE_Status ee_status = EE_OK;
HAL_FLASH_Unlock();
if (__HAL_PWR_GET_FLAG(PWR_FLAG_SB) == RESET) {
ee_status = EE_Init(EE_FORCED_ERASE);
if (ee_status != EE_OK) {
Error_Handler();
}
} else {
// Clear the Standby flag
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);
// Check and Clear the Wakeup flag
if (__HAL_PWR_GET_FLAG(PWR_FLAG_WUF) != RESET) {
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WUF);
}
ee_status = EE_Init(EE_CONDITIONAL_ERASE);
if (ee_status != EE_OK) {
Error_Handler();
}
}
for (int i = 0; i < n; i++) {
ee_status = EE_ReadVariable8bits(addr + i, &data[i]);
if (ee_status != EE_OK) {
Error_Handler();
}
}
//Start cleanup IT mode, if cleanup is needed
if ((ee_status & EE_STATUSMASK_CLEANUP ) == EE_STATUSMASK_CLEANUP) {
ErasingOnGoing = 1;
ee_status |= EE_CleanUp_IT();
}
HAL_FLASH_Lock();
}
However , there is also this code called later which works fine
void TestFlashRead(void) {
EE_Status ee_status = EE_OK;
HAL_FLASH_Unlock();
if (__HAL_PWR_GET_FLAG(PWR_FLAG_SB) == RESET) {
ee_status = EE_Init(EE_FORCED_ERASE); //this works fine
if (ee_status != EE_OK) {
Error_Handler();
}
} else {
// Clear the Standby flag
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);
// Check and Clear the Wakeup flag
if (__HAL_PWR_GET_FLAG(PWR_FLAG_WUF) != RESET) {
__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WUF);
}
ee_status = EE_Init(EE_CONDITIONAL_ERASE);
if (ee_status != EE_OK) {
Error_Handler();
}
}
if ((EE_ReadVariable32bits(EEPROM_BAUDRATE_ADDR, &config.baud)
& EE_STATUSMASK_ERROR ) == EE_STATUSMASK_ERROR) {
Error_Handler();
}
//Start cleanup IT mode, if cleanup is needed
if ((ee_status & EE_STATUSMASK_CLEANUP ) == EE_STATUSMASK_CLEANUP) {
ErasingOnGoing = 1;
ee_status |= EE_CleanUp_IT();
}
HAL_FLASH_Lock();
}
I would appreciate any support.
Thanks
