2020-08-19 06:14 AM
I have my custom STM32WB55CE board. I had programmed the example code "EEPROM_Emul" from"X-CUBE-EEPROM_V2.0.0" package on it. It was working fine. Then I did FUS upgrade with BLE full stack binary programming on it. After that, the same EEPROM emulation example code gets stuck at EE_Init() function. It goes into Hardfault handler. I did a FLASH erase and reprogrammed the example code. On my STM32WB55 Neucleo board, it works fine. Please guide on this.
Thank you.
2021-01-04 04:58 AM
Hi again GBehe,
According to AN5289 part 5 (https://www.st.com/resource/en/application_note/dm00598033-building-wireless-applications-with-stm32wb-series-microcontrollers-stmicroelectronics.pdf), the SW part of a BLE application as the BLE_HeartRate_ota should be customized through app_entry.c or your own app_***.c as it is done for the X-CUBE-EEPROM app (no need to modify main.c which is dedicated to HW configuration).
I propose you to first check if implementing the EEPROM_Emul_Init (not a task) and registering the task EEPROM_Emul_Operation as done in the X-CUBE-EEPROM example is working fine.
If yes, it can be a good starting point before cleaning and keeping only what you need.
As you will see in EEPROM_Emul_Operation there is some code managing semaphores so that the flash can be accessed safely by your app while it (the flash) is also used by the BLE stack. It can be a reason why you see that sometimes the flash is not updated: because it was used by the BLE stack.
If you don't want to use EEPROM_Emul_Operation you should at least copy the semaphore mechanism as it is done in this function.
BR,
Adam