lpcware

WWDT in LPC811 not work correctly

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by MICHALKO12 on Mon May 11 04:46:42 MST 2015
WWDT in LPC811 not work correctly. Feed causes the counter stop and reset the processor.

static void
InitWDT( void )
{
volatile uint32_t x;
LPC_SYSCON->SYSAHBCLKCTRL |= (1<<17);
LPC_SYSCON->PDRUNCFG &= ~( 1<<6 );
LPC_SYSCON->WDTOSCCTRL = (1<<5) | 0x1F;// 0,6MHZ/64 = ~9,3kHz (±40%)
LPC_WWDT->TC = ((uint32_t)( WDT_CLK / 4 * WDT_TIMEOUT ));
LPC_WWDT->WARNINT = ((uint32_t) (WDT_CLK / 4 * WDT_WARNING ));
//LPC_WWDT->WINDOW = ((uint32_t) (WDT_CLK / 4 * WDT_TIMEOUT ));
LPC_WWDT->MOD = 0b111001;
for( x = 0; x < 1000; x++);
LPC_WWDT->FEED = 0xAA;
LPC_WWDT->FEED = 0x55;
LPC_WWDT->MOD = 0b111001;
//NVIC_EnableIRQ(WDT_IRQn);
}

void
WWDTFeed( void )
{
uint32_t primask  = __get_PRIMASK();

__disable_irq();
LPC_WWDT->FEED = 0xAA;
LPC_WWDT->FEED = 0x55;
__set_PRIMASK( primask );
}


void ResetWWDT( void )     // Called every 1s from main()
{
static uint32_t cnt = 0;
UsartPutHex32(LPC_WWDT->MOD);
UsartPutChar( ' ' );
UsartPutHex32(LPC_WWDT->TV);
UsartPutChar( ' ' );
if( ++cnt > 3 )
{
cnt = 0;
WWDTFeed();
}

UsartPutHex32(LPC_WWDT->MOD);
UsartPutChar( ' ' );
UsartPutHex32(LPC_WWDT->TC);
UsartPutChar( ' ' );
UsartPutHex32(LPC_WWDT->TV);
UsartPutChar( ' ' );
UsartPutHex32(LPC_WWDT->WARNINT);
UsartPutChar( ' ' );
UsartPutHex32(LPC_WWDT->WINDOW);
UsartPutChar( ' ' );
UsartPutHex32(LPC_SYSCON->SYSRSTSTAT);
LPC_SYSCON->SYSRSTSTAT = 0x1f;
UsartSendString(_eol);
}



Log file:
   MOD      TV      MOD      TC        TV     WARNINT  WINDOW  SYSRSTSTAT
00000031 00007F2B 00000031 0000883B 00007F26 0000019F 00FFFFFF 00000001
00000031 0000761A 00000031 0000883B 00007615 0000019F 00FFFFFF 00000000
00000031 00006D09 00000031 0000883B 00006D04 0000019F 00FFFFFF 00000000
00000031 000063F8 00000031 0000883B 000063F4 0000019F 00FFFFFF 00000000
0000003C 000063F4 0000003C 0000883B 000063F4 0000019F 00FFFFFF 00000000
0000003C 000063F4 0000003C 0000883B 000063F4 0000019F 00FFFFFF 00000000
0000003C 000063F4 0000003C 0000883B 000063F4 0000019F 00FFFFFF 00000000
0000003C 000063F4 0000003C 0000883B 000063F4 0000019F 00FFFFFF 00000000
0000003C 000063F4 0000003C 0000883B 000063F4 0000019F 00FFFFFF 00000000
0000003C 000063F4 0000003C 0000883B 000063F4 0000019F 00FFFFFF 00000000
0000003C 000063F4 0000003C 0000883B 000063F4 0000019F 00FFFFFF 00000000
0000003C 000063F4 0000003C 0000883B 000063F4 0000019F 00FFFFFF 00000000
0000003C 000063F4 0000003C 0000883B 000063F4 0000019F 00FFFFFF 00000000
0000003C 000063F4 0000003C 0000883B 000063F4 0000019F 00FFFFFF 00000000
0000003C 000063F4 0000003C 0000883B 000063F4 0000019F 00FFFFFF 00000000
0000003C 000063F4 0000003C 0000883B 000063F4 0000019F 00FFFFFF 00000000
0000003C 000063F4 0000003C 0000883B 000063F4 0000019F 00FFFFFF 00000000
0000003C 000063F4 0000003C 0000883B 000063F4 0000019F 00FFFFFF 00000000
0000003C 000063F4 0000003C 0000883B 000063F4 0000019F 00FFFFFF 00000000
0000003C 000063F4 0000003C 0000883B 000063F4 0000019F 00FFFFFF 00000000
0000003C 000063F4 0000003C 0000883B 000063F4 0000019F 00FFFFFF 00000000
0000003C 000063F4 0000003C 0000883B 000063F4 0000019F 00FFFFFF 00000000
0000003C 000063F4 0000003C 0000883B 000063F4 0000019F 00FFFFFF 00000000
0000003C 000063F4 0000003C 0000883B 000063F4 0000019F 00FFFFFF 00000000
0000003C 000063F4 0000003C 0000883B 000063F4 0000019F 00FFFFFF 00000000


Outcomes