2024-06-06 05:47 PM
Hi
I am using STM32L476ZG MCU development board. I created a new project without adding any interrupts. I noticed that FLASH->SR = 0xC0 at reset and when I try to clear it, it comes back after the next command I execute.
I'll add screen shots to clarify what I am experiencing.
1- Just entered the code, no command executed yet
2- executed `FLASH->SR |= FLASH_FLAG_SR_ERRORS;`
3- executed `HAL_Init();`
4- executed `FLASH->SR |= FLASH_FLAG_SR_ERRORS;`
5- executed `SystemClock_Config();`
6- executed `FLASH->SR |= FLASH_FLAG_SR_ERRORS;`
7- executed `HAL_FLASH_Unlock();`
8- executed `FLASH->SR |= FLASH_FLAG_SR_ERRORS;`
9- executed `MX_GPIO_Init();`
You can see I failed to permanently clearing FLASH-SR
Thanks
-Namir
2024-06-11 07:18 AM - edited 2024-06-11 07:18 AM
Hello @Namir and welcome to the Community 🙂,
Could you please try to connect your board using STM32CubeProgrammer.
Then, click on erase flash memory and check the status of Flash_SR register as shown in the below figures.
Also, could you please try this example STM32CubeL4/Projects/NUCLEO-L476RG/Examples/FLASH/FLASH_EraseProgram at master · STMicroelectronics/STM32CubeL4 · GitHub and check the FLASH->SR reset value.
I hope this help you to solve the issue.
Kaouthar
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.