AnsweredAssumed Answered

LPC54608 WWDT Timeout Value

Question asked by Rex Lam on Aug 21, 2018
Latest reply on Aug 23, 2018 by Rex Lam

I have been using the OM13092 board to test the LPC54608 WWDT feature. Here is an excerpt from the WWDT example program:

#define WDT_CLK_FREQ CLOCK_GetFreq(kCLOCK_WdtOsc)

 

#if !defined (FSL_FEATURE_WWDT_HAS_NO_PDCFG) || (!FSL_FEATURE_WWDT_HAS_NO_PDCFG)
    POWER_DisablePD(kPDRUNCFG_PD_WDT_OSC);
#endif

 

    /* The WDT divides the input frequency into it by 4 */
    wdtFreq = WDT_CLK_FREQ / 4;
    NVIC_EnableIRQ(APP_WDT_IRQn);
    WWDT_GetDefaultConfig(&config);

 

    /*
     * Set watchdog feed time constant to approximately 2s
     * Set watchdog warning time to 512 ticks after feed time constant
     * Set watchdog window time to 1s
     */
    config.timeoutValue = wdtFreq * 2;
    //config.warningValue = 512;
    //config.windowValue = wdtFreq * 1;
    /* Configure WWDT to reset on timeout */
    //config.enableWatchdogReset = true;
    WWDT_Init(WWDT, &config);

 

According to the comments, wdtFreq*2 should be approximately 2s. In my tests, it came out to about 1.56s, which is much less than 2. The return value of CLOCK_GetFreq(kCLOCK_WdtOsc) is 500000, and thus wdtFreq is 125000. The value of SystemCoreClock is 48000000. I used the SysTick timer to measure the watchdog time:

    SysTick_Config(CLOCK_GetFreq(kCLOCK_BusClk)/1000);

 

From WDTOSCCTRL, DIVSEL=0 (divide by 2), and FREQSEL=5 (1.0MHz). This explains why WDT_CLK_FREQ = 500000 but it doesn't explain why the actual timeout is off by a factor of 1.28. I changed wdtFreq to 160000 (125000x1.28), and then the expected timeout is correct, i.e. the watchdog times out accurately for 1s, 2s, 5s, etc. with wdtFreq=160000. Can anyone explain why that is so?

Outcomes