cancel
Showing results for 
Search instead for 
Did you mean: 

Hardfault error while writing to EEPROM(Flash) in STM32WLE5 module

sandeep_kumar_v
Associate II

Hi,
I’m working on STM32WLE5 module for storing values in EEPROM. I want to use the last page of flash for storing configuration values of lora.

I have used EE library from GITHUB which uses HAL functions.

I followed 2 sequences for writing into flash:

  1. Erasing the page 127(which I use for writing the values), read and write worked perfectly. Values are being stored correctly in flash.
  2. Read the values from page 127 and then erasing the page and writing to it. I get hardfault error everytime.

if I erase the page 1st and write to it, then there is no use of storing in it. So, If I read the flash, I’m not able to write to it.
I have also moved all the functions used for writing into flash to RAM by adding __attribute__((section(“.RamFunc”))) in function definition so that there won’t be stalling of CPU. I have checked in disassembly while debugging that all the related code is running from RAM.

sandeep_kumar_v_0-1756615709266.png

I get hardfault error while HAL_FLASH_Unlock() after erasing the page. Is there any other configuration I need to do for using flash as eeprom.
I want to do the procedure as follows:
Read EEPROM → Erase&update the new values in Flash.

0 REPLIES 0