Using WWDT to trigger reset

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by KiloMike on Tue Mar 18 14:34:17 MST 2014

I've just started development of new firmware for a project that uses the LPC812 processor. I have the LPCxpresso LPC812 development board and the LPC Link 2 board configured as a SEGGER J-link JTAG. I have experience with several other LPC processors but I have never before used the LPC812.

I am having trouble getting the watchdog timer to start however. I figure I must be missing something subtle but I've been hacking away at it for the past 6 hours and it is time to cry uncle. I found a thread about the WWDT on the LPC4357 processor on these forums but the solution described there doesn't work in my case. Maybe someone here can see what I've done wrong and point me in the right direction?

My reset function is as follows:

void Reset(void)
    // enable WDT clock
    SYSAHBCLKCTRL |= 0x00020000;

    // configure the watchdog timer to run at 1 MHz ±40%
    WDTOSCCTRL = 0x00000181;

    // Enable the watchdog clock in the power control register (taking care
    // to set bits 8:14 as required per user manual paragraph 4.6.32)
    PDRUNCFG = ( (PDRUNCFG & 0x000080BF) | 0x00006D00 );

    // set number of watchdog timer to minimum number of ticks before timeout
    WDTC = 0x000000FF;

    // load WDTC into watchdog timer countdown register

    // enable watchdog timer resets
    WDMOD = 0x00000003; // 0x00000023;



and my watchdog feed function is defined as:

static void Watchdog_Feed(void)
      WDFEED = 0x000000AA;
      WDFEED = 0x00000055;

The watchdog registers are defined in my compiler as:

  #define WDMOD          (*(volatile unsigned long *)0x40004000)
  #define WDTC           (*(volatile unsigned long *)0x40004004)
  #define WDFEED         (*(volatile unsigned long *)0x40004008)
  #define WDTV           (*(volatile unsigned long *)0x4000400C)

And the relevant clock control registers are defined as:

  #define SYSAHBCLKCTRL  (*(volatile unsigned long *)0x40048080)
  #define WDTOSCCTRL     (*(volatile unsigned long *)0x40048024)
  #define PDRUNCFG       (*(volatile unsigned long *)0x40048238)

I have checked the values of the following registers after calling the reset function:

WDTOSCCTRL = 0x00000181
WDTV = 0x00000000
WDMOD = 0x00000000

Notice that WDTV and WDMOD stay stubbornly stuck at 0? Even adding a delay of a few microseconds after calling the reset function doesn't make a difference. Does anyone have any ideas about what I might be missing? If I had to guess, it would be that the feed isn't working properly. I have tried moving the writes to WDFEED around in the code but nothing seems to make a difference.

Thanks in advance!