AnsweredAssumed Answered

WDOG unlock causes reset

Question asked by biafra on Mar 14, 2018
Latest reply on Mar 16, 2018 by Jing Pan

Hi everyone,

 

I'm having trouble on configuring WDOG.

I'm using a custom board based on MK66, MCUXpresso 10.1.1 and SDK 2.3.

 

I need to use the WDOG timer: since it is disabled in the startup function SystemInit(), I need to enabled it at the beginning of my program (after hardware init):

 

WDOG_GetDefaultConfig( &WdogConfig );
WdogConfig.clockSource = kWDOG_AlternateClockSource;
WdogConfig.prescaler = kWDOG_ClockPrescalerDivide5;
WdogConfig.workMode.enableStop = true;
WdogConfig.timeoutValue = WDOG_TIMEOUT_VAL;
WDOG_Init( WDOG, &WdogConfig );

 

I step the program through WDOG_Init() -> WDOG_Unlock(): reset occurs at the first instruction of the unlocking sequence:

 

base->UNLOCK = WDOG_FIRST_WORD_OF_UNLOCK;

 

The ALLOWUPDATE bit in the STCTRLH register is set (by the SystemInit() function), the WDOG bit in SRS0 register is set (indicating the reset cause is the WDOG timer) and the RSTCNT register increments every reset.

 

I've no idea, what can I check?

 

Many thanks

Biafra

Outcomes