cancel
Showing results for 
Search instead for 
Did you mean: 

Independent Watchdog Timer

sukrubahadirarslan
Associate III
Posted on December 08, 2013 at 14:54

hello I want to learn how to use independent watchdog so I wrote this code but it doesnt work .

here is my code :

#include ''stm32f10x.h''

#include ''stm32_eval.h''

#include <stdio.h>

GPIO_InitTypeDef GPIO_Config_Anahtari;

void Rcc_Configuration(void);

void IWDG_Configuration(void);

void GPIO_Rcc_Configuration(void);

void GPIO_Configuration(void);

void _Delay(uint16_t);

int main(void)

{

GPIO_Rcc_Configuration();

GPIO_Configuration();

Rcc_Configuration();

IWDG_Configuration();

IWDG_Enable();

GPIO_SetBits(GPIOD,GPIO_Pin_7);

while(1);

}

#ifdef  USE_FULL_ASSERT

/**

  * @brief  Reports the name of the source file and the source line number

  *         where the assert_param error has occurred.

  * @param  file: pointer to the source file name

  * @param  line: assert_param error line source number

  * @retval None

  */

void assert_failed(uint8_t* file, uint32_t line)

  /* User can add his own implementation to report the file name and line number,

     ex: printf(''Wrong parameters value: file %s on line %d\r\n'', file, line) */

  /* Infinite loop */

  while (1)

  {

  }

}

#endif

void Rcc_Configuration()

{

RCC_LSICmd(ENABLE);

while(RCC_GetFlagStatus(RCC_FLAG_LSIRDY)==RESET);

}

void IWDG_Configuration()

{

IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);

IWDG_SetPrescaler(IWDG_Prescaler_16);

IWDG_SetReload(0xFFF);

IWDG_ReloadCounter();

IWDG_WriteAccessCmd(IWDG_WriteAccess_Disable);

}

void GPIO_Rcc_Configuration()

{

RCC_HCLKConfig(RCC_SYSCLK_Div1);

RCC_PCLK2Config(RCC_HCLK_Div1);

RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD,ENABLE);

}

void _Delay(uint16_t t)

{

uint8_t i=0;

    while(t--)

        for(i=0;i<10;i++);

}

void GPIO_Configuration()

{

GPIO_Config_Anahtari.GPIO_Mode = GPIO_Mode_Out_PP;

GPIO_Config_Anahtari.GPIO_Pin = GPIO_Pin_7;

GPIO_Config_Anahtari.GPIO_Speed = GPIO_Speed_50MHz;

GPIO_Init(GPIOD,&GPIO_Config_Anahtari);

}

So in this code I expect , iwdg creates an reset signal. So when reset signal created , led must be turn off and then turn on again. But in my board nothing change. So what is the problem ? 

Thanks for your help and sorry about my english
1 REPLY 1
Posted on December 08, 2013 at 20:53

Look to be using an old version of the library, but doesn't look to be the problem. Thought about trying the examples in the v3.5.0 library?

Are you sure it's not resetting? Can you output some text when you reset? Do you have something else driving the NRST pin in your design?
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..