cancel
Showing results for 
Search instead for 
Did you mean: 

I think IWDG Dosen't work

SShin.4
Associate

My board(STM32F103R8T6) sometimes stop.. So I use IWDG and it doesn't work. If my board doesn't work well, is it right that iwdg works and resets the core? Let my code work properly.

void IWDG_Configuration(void)
{
	IWDG->KR = 0x5555; 
	IWDG->RLR = 0x000F; 
	IWDG->PR = 0x0008; 
	IWDG->KR = 0xAAAA;
	IWDG->KR = 0xCCCC;
}
 
void TIM2_IRQHandler(void)
{
 if(TIM_GetITStatus(TIM2,TIM_IT_Update) != RESET)
    {
	IWDG->KR = 0xAAAA;
        uCnt1 ++;
        if (uCnt1 >= 500)
	    uCnt1 = 0; 
	if(ck_ldfg == 0) ck_ldfg = 1;
	    else ck_ldfg = 0;
	if (ck_ldfg == 0)
	    CPU_CHK_LED_LO();
	else 
	    CPU_CHK_LED_HI();
	TIM_ClearITPendingBit(TIM2, TIM_IT_Update);
    }
}

2 REPLIES 2

Are you driving the NRST pin externally?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

I've made it possible to reset the switch I've added.