Storing data in internal Flash during Fault interupt.
Team,
i'm trying to store data - by use of HAL lib - during Hardware,Memory.. and so on Fault Interrupt routine. Idea is to write some data at the very end of flash - allowable area.
So, the code is tested druing normal operation. However, placed in Hard Fault ISR its stooped/ failed during erase inside function HAL_FLASHEx_Erase(addr,bank) precisley at line __HAL_LOCK(&pFlash);
I was trying to figure it our on my own, however seems i'm not able to clear the Flash SR register bits - or IDE is not refresing correctly - doubtful.
FLASH->SR ^= 0x3FF; //or SR=0x0 // clears error bits in SR reg
FLASH->CR ^= 0x8404; // clears mer1 mer 2 and bker bit
Initializing erase procedure sets WPRERR bit anyway and after erase, errors are set back.
Result is, flash bank is not erased nor data stored. Im woring on STM32G474
Can anyone support me ?
