cancel
Showing results for 
Search instead for 
Did you mean: 

Getting Hard Fault Issue as Part of Flash Erase Operation.

Hi Team,

We are using the Flash Operations as part of Data saving in specific page. As part of that we are erasing the page and writing the new data.

As Part of the Flash Erase operation, we are Entering into HardFault_Handler() function through the FLASH_FlushCaches() function.

Original Flash Erase operation was success like FLASH_PageErase(), after that we are getting this issue in the function FLASH_FlushCaches().

Could you please provide the insight on this one, why Flush operation is failing randomly, is there any changes or additional initializations are required for flash Erase before going to execute the Erase operation.

Regards,

Srinivas.V

6 REPLIES 6
Hdd
ST Employee

Have you seen and tried the example in the STM32CubeWB? : FLASH_EraseProgram .

TDK
Guru

Are you erasing code currently being executed? MCU doesn't behave randomly, be systematic in debugging. Not sure you've provided enough info to track things down here.

What is the reason for the hard fault and what is the offending assembly instruction?

If you feel a post has answered your question, please click "Accept as Solution".

Hi Team,

  1. Not Erasing the code currently Being executed, we have dedicated page for our config data storage. we are doing the operations for that page.
  2. we are able to Erase and Write and Read properly.
  3. After erase operation we are doing cache memory flushing, where we are getting the issue.
  4. Inside this function FLASH_FlushCaches() we are getting the Hard fault; it is part of the HAL_FLASHEx_Erase().

Please let us know is there any other changes are required from Flash side.

Regards,

Srinivas

Hdd
ST Employee

can you share your code here please ?

Hi Team,

Please find my Flash Driver code for your reference. Here with i am attaching the Error screen shot as well.

0693W00000WKaIxQAL.jpg

Remy ISSALYS
ST Employee

Hello,

Can you share the call stack and the disassembly when the issue occurs?

Best Regards