Skip to main content
bmagnan
Associate
June 30, 2010
Question

Independent Watchdog never resets the processor

  • June 30, 2010
  • 2 replies
  • 573 views
Posted on June 30, 2010 at 15:38

Independent Watchdog never resets the processor

    This topic has been closed for replies.

    2 replies

    trevor23
    Associate III
    May 17, 2011
    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

    Tesla DeLorean
    Guru
    May 17, 2011
    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..