Sometimes, WWDG was not working and CPU hang
My company uses the STM32G0071CB chip. but I faced some issue.
whenever I need to reboot main board, I have to reset the STM32G0071CB as wells.
so I used the WWDG for resetting the chip.
But sometimes, chip was not reset and CPU hang.(once a 400 times or randomly happen it)
I used the below code for initializing and resetting.
I didn't find anything wrong in my code.
Could you please give me any guide?
Thank you for your support in advanced.
= Code =
void Init_WWDG(void)
{
/* Enable the peripheral clock WWDG */
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_WWDG);
LL_WWDG_SetPrescaler(WWDG,LL_WWDG_PRESCALER_8); /* (1) */
LL_WWDG_SetWindow(WWDG,0x7E); /* (2) */
LL_WWDG_SetCounter(WWDG, 0x7E); /* (3) */
}
void Reset(void)
{
SCB->VTOR = 0x0; // Reset the Vector Table back to the bootloader
FLASH->CR |= FLASH_CR_LOCK_Msk;
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_WWDG);
LL_WWDG_SetPrescaler(WWDG, LL_WWDG_PRESCALER_8);
LL_WWDG_SetCounter(WWDG, 1);
LL_WWDG_Enable(WWDG);
}