cancel
Showing results for 
Search instead for 
Did you mean: 

Independent Watchdog never resets the processor

bmagnan
Associate II
Posted on June 30, 2010 at 15:38

Independent Watchdog never resets the processor

2 REPLIES 2
trevor23
Associate III
Posted on May 17, 2011 at 13:56

This is what I use and it is working:

static void start_watchdog(void)

{

    RCC_LSICmd( ENABLE );   // enable low speed internal clock used by watchdog

    while (IWDG->SR & 0x3); // wait for previos update operations to complete

    IWDG->KR = 0x5555;      // Enable independent watchdog register access

    IWDG->PR = 6;           // prescaller set to divice by 256 (min 6.4ms, max 26214.4ms)

    IWDG->RLR = 0xFFF;        // reload value (0xFFF max)

    IWDG->KR = 0xCCCC;      // start the watchdog

}

void stroke_watchdog(void)

{

    IWDG->KR = 0xAAAA;

}

Regards Trevor

Posted on May 17, 2011 at 13:56

  /* IWDG timeout equal to xxx ms (the timeout may varies due to LSI frequency dispersion) */

  IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable); /* Enable write access to IWDG_PR and IWDG_RLR registers */

  /* IWDG counter clock: 40KHz(LSI) / 32 = 1.25 KHz, 256 = 156 Hz (Prescaler 4..256)*/

  IWDG_SetPrescaler(IWDG_Prescaler_256);

  /* Set counter reload value to */

  IWDG_SetReload(4056); // 12-bit downcount (0-4095), 26 seconds

  IWDG_ReloadCounter(); /* Reload IWDG counter */

  IWDG_Enable(); /* Enable IWDG (the LSI oscillator will be enabled by hardware) */

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