Skip to main content
Visitor II
June 7, 2024
Question

Why I am getting FLASH->SR reset value is 0xC0

  • June 7, 2024
  • 1 reply
  • 807 views

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

Flash_SR_1.PNG

2- executed `FLASH->SR |= FLASH_FLAG_SR_ERRORS;`

Flash_SR_2.PNG

3- executed `HAL_Init();`

Flash_SR_3.PNG

4- executed `FLASH->SR |= FLASH_FLAG_SR_ERRORS;`

Flash_SR_4.PNG

5- executed `SystemClock_Config();`

Flash_SR_5.PNG

6- executed `FLASH->SR |= FLASH_FLAG_SR_ERRORS;`

Flash_SR_6.PNG

7- executed `HAL_FLASH_Unlock();`

Flash_SR_7.PNG

8- executed `FLASH->SR |= FLASH_FLAG_SR_ERRORS;`

Flash_SR_8.PNG

9- executed `MX_GPIO_Init();`

Flash_SR_9.PNG

You can see I failed to permanently clearing FLASH-SR

 

Thanks

-Namir

    This topic has been closed for replies.

    1 reply

    Technical Moderator
    June 11, 2024

    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.

    KDJEM1_1-1718115258640.pngKDJEM1_2-1718115342808.png

    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