2024-09-30 12:24 AM
I have configured the watchdog for the maximum duration possible, i.e, 1.7 sec. 
void watchdog_init(void)
{
CLK_ICKCR |= CLK_ICKR_LSION;
IWDG_KR = 0x55; 
IWDG_PR = 6; 
IWDG_RLR = 0xFF;
IWDG_KR = 0xCC; 
}
But it seems to be resetting in around 26 - 28 ms. I have also checked this timing with an oscilloscope by toggling a led. 
2024-09-30 12:33 PM
As explained in RM, the first step must be enable the watchdog. As is, the watchdog is using the reset values.
Use this code:
void watchdog_init(void)
{
CLK_ICKCR |= CLK_ICKR_LSION;
IWDG_KR = 0xCC; // enable
IWDG_KR = 0x55; // write access
IWDG_PR = 6;
IWDG_RLR = 0xFF;
IWDG_KR = 0xAA; // refresh
},
