Skip to main content
HRadt.1
Associate III
Sep 29, 2020 10:36 AM UTC
Solved

Refreshing IWDG without initializing it causes FLASH->SR->CFGBSY to be set

When trying to refresh IWDG when it has not been initialized, causes the FLASH->SR->CFGBSY bit to get stuck on SET. It will not return to zero ever.

Also mentioned in this post: https://community.st.com/s/question/0D50X0000Bh5LOVSQ2/trouble-programming-flash-with-halflashprogram by JHuan.1

I couldn't find anything in the reference manual, nor in the errata sheet of the STM32WB55 cpu. Is there a link between IWDG and FLASH that I'm not aware of? Or how could IWDG have any effect on FLASH?

This topic has been closed for replies.
HRadt.1
HRadt.1Best answer
Associate III
Sep 29, 2020 8:31 PM UTC

Okay, this one is clearly my fault, but in case someone stumbles on the same symptoms:

Not calling MX_IWDG_Init() leaves the hiwdg handle uninitialized. Invoking the refresh through the HAL then effectively causes a flash write to address 0, which is an alias for FLASH_BASE (0x08000000). Just writing that address then causes the CFGBSY bit to get stuck.

1 reply

HRadt.1
HRadt.1AuthorBest answer
Associate III
Sep 29, 2020 8:31 PM UTC

Okay, this one is clearly my fault, but in case someone stumbles on the same symptoms:

Not calling MX_IWDG_Init() leaves the hiwdg handle uninitialized. Invoking the refresh through the HAL then effectively causes a flash write to address 0, which is an alias for FLASH_BASE (0x08000000). Just writing that address then causes the CFGBSY bit to get stuck.