Watchdog won't start

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Watchdog won't start

751件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ben1976de on Sat Jul 31 15:31:19 MST 2010
Hi,

I tried to initialize the watchdog but it won't start at all.
This is my init code:
//SYSAHBCLKCTRL(Bit 15) is already turned on
void Watchdog_Init(uint32_t ResetTimeOutMs, uint8_t SoftReset)
{
    LPC_SYSCON->WDTCLKSEL = 0x1;    /*select Main Clock*/
    LPC_SYSCON->WDTCLKUEN = 0x1;
    LPC_SYSCON->WDTCLKUEN = 0x0;
    LPC_SYSCON->WDTCLKUEN = 0x1;
    while (!(LPC_SYSCON->WDTCLKUEN & 0x01));

    LPC_SYSCON->WDTCLKDIV = (SystemCoreClock/1000000);    /*1MHz*/

    NVIC_EnableIRQ(WDT_IRQn);

    LPC_WDT->TC = (ResetTimeOutMs*1000/4);     /*Timeout in ms*/

    if(SoftReset)
        LPC_WDT->MOD = WDEN|WDRESET;
    else
        LPC_WDT->MOD = WDEN;

    LPC_WDT->FEED = 0xAA;    /*Feed Sequence*/
    LPC_WDT->FEED = 0x55;
}
The registers are set correctly, I can see that with the debugger, but the WDTV register stays at 0xFF. When I change workspace to the sample code it seems that something work. I do not use CMSIS. Is that a problem?

Thanks in advance for answering.

Original Attachment has been moved to: 1100572_main_serial.zip

0 件の賞賛
返信
2 返答(返信)

667件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Jesse.Rosenberg on Mon Aug 02 11:52:36 MST 2010
What device are you targeting (LPC11xx/13xx/17xx) ? Have you seen the "wdt" example projects which are included in LPCXpresso ?

Are you enabling clock power to the WDT elsewhere in your project? I suspect you're missing some code along the lines of:

LPC_SYSCON->SYSAHBCLKCTRL |= (1<<15);
0 件の賞賛
返信

667件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ben1976de on Sun Aug 01 03:21:46 MST 2010
Correction, I use CMSIS code base. Problem still there.
0 件の賞賛
返信