Skip to main content
HRadt.1
Associate III
September 29, 2020
Solved

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

  • September 29, 2020
  • 1 reply
  • 1544 views

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.
Best answer by HRadt.1

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.1AuthorAnswer
Associate III
September 29, 2020

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.