Watchdog Rest After Sleep/Wake-Up

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Watchdog Rest After Sleep/Wake-Up

2,666 Views
chaitanya_kalyani
Contributor III

Hello,

 

I am using S32K116 for our one of the project. I have implemented perodic wake-up and when it comes fully run mode from perodic wake-up watchdog reset is happening after wake-up. When it start and before enter into sleep watchdog reset is not showing but issue is when enter into sleep.

 

Before entering into sleep I am disabling the watchdog still watchdog reset is happening.

 

I am using below settings.

chaitanya_kalya_0-1622373313124.png

I am using below code to enter into sleep

 


void GoToSleep(void)
{
INT_SYS_DisableIRQGlobal();

INT_SYS_DisableIRQ(WDOG_IRQn);
WDOG_DRV_Deinit(INST_WATCHDOG1);
PINS_DRV_SetPinIntSel(PORTC,2,PORT_INT_FALLING_EDGE);
INT_SYS_EnableIRQ(PORT_IRQn);
//Deinit LPIT
LPIT_DRV_StopTimerChannels(INST_TIMER1MS, (1 << TIMER_1MS_CHANNEL));
LowPowerModeLPTMR();
INT_SYS_EnableIRQGlobal();
//Enter to VLPS
enter_VLPR();
POWER_SYS_SetMode(VLPS,POWER_MANAGER_POLICY_AGREEMENT);
VLPS_To_Run();
}

static void VLPS_To_Run(void)
{
//Start Run Mode
POWER_SYS_SetMode(RUN, POWER_MANAGER_POLICY_AGREEMENT);
RunModeLPTMR();
PINS_DRV_SetPinIntSel(PORTC, 2, PORT_DMA_INT_DISABLED);
INT_SYS_DisableIRQ(PORT_IRQn);
//LPTMR
LPTMR_DRV_Init(INST_LPTMR, &lpTmr_config0, false);
INT_SYS_EnableIRQ(LPTMR0_IRQn);
LPTMR_DRV_StartCounter(INST_LPTMR);

//Start Watchdog
WDOG_DRV_Init(INST_WATCHDOG1, &watchdog1_Config0);
INT_SYS_EnableIRQGlobal();

//Start LPIT
LPIT_DRV_StartTimerChannels(INST_TIMER1MS, (1 << TIMER_1MS_CHANNEL));
}

 

Triggering watchdog in LPTMR ISR and using POWER_SYS_GetResetSrcStatusCmd(RCM, RCM_WATCH_DOG) this to check it. 

 

In Perodic wake-up also I am triggering the watchdog still watchdog reset is happening. 

 

Tags (1)
0 Kudos
7 Replies

2,653 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @chaitanya_kalyani,

Can you please share the project.

I don't think I can find the root cause just from the description.

 

Thank you,

Daniel

0 Kudos

2,650 Views
chaitanya_kalyani
Contributor III

Hello @danielmartynek ,

 

Project sharing is not possible. 

 

In this project I am using LIN as communication and as previously you suggested LPTMR for perodic wake-up. Thus issue only when it is enter into sleep and wake-up.

 

Thank you in advance

0 Kudos

2,645 Views
danielmartynek
NXP TechSupport
NXP TechSupport

If the MCU is reset by the WDOG, the code is probably stuck somewhere in the RUN mode after the WDOG gets reinitialized.

Maybe you can left the WDOG disabled after the wake-up and measure the time between WDOG refresh events by toggling a GPIO.

Why the application enters VLPR before it goes to VLPS?

It can go from RUN to VLPS directly.

 

Regards,

Daniel

0 Kudos

2,641 Views
chaitanya_kalyani
Contributor III

Hello @danielmartynek ,

 

Thank you for quick response.

 

1. I am using VLPR and then VLPS because perrodic wake-up is not happening (for VLPR I used your previously shared code for perodic wake-up).

2. After wake-up watchdog not re-initialized then LIN is not working. 

 

I am using POWER_SYS_GetResetSrcStatusCmd(RCM, RCM_WATCH_DOG); this to check watchdog reset.

But when I checked register of watchog in ide there is no change in registers after wake-up from sleep.

I am checking below registers. for watchdog.

chaitanya_kalya_0-1622460639613.png

Before and after wake-up from sleep value on these register is same. But when I read for watchdog reset then getting watchdog reset.

 

0 Kudos

2,633 Views
danielmartynek
NXP TechSupport
NXP TechSupport

HI @chaitanya_kalyani,

I would recommend using the POWER_SYS_SetMode() function for VLPR as well.

But as I said, there is no need to go to VLPR first if the application does not need to run in VLPR.

Also, the LPTMR must run in VLPS regardless of the previous RUN/VLPR mode.

Can you simply read the RCM_SRS register at the beginning of main() and send the value out?

The MCU should run stand-alone in VLPS without the debugger.

 

Thanks,

Daniel

0 Kudos

2,631 Views
chaitanya_kalyani
Contributor III

Hello @danielmartynek ,

 

When I use POWER_SYS_SetMode() for VLPR also then also getting problem for perodic wake-up. The code that you have provided for VLPR that only working.

 

On RCM_SRS register watdog value is getting set after wake-up from sleep mode. Before enter into sleep it is 64 and after wake-up from sleep it is becoming 32 that is watchdog bit is getting set. It is not getting set in sleep mode it is getting se only after wake-up.

 

I have one more question if watchdog reset is happened then if we do reset that will impact on anything. Is it good of we do software reset if watchdog reset is happened ?

 

0 Kudos

2,606 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @chaitanya_kalyani,

The code that I provided for VLPR does a few things that are needed for VLPS as well.

The enter_VLPR() function switches the system clock to SIRC, allows VLP* operation etc.

Maybe you haven't enabled SIRC in VLPS in the PE configuration.

 

The RCM_SRS gets set during the system reset to indicate the source of the reset.

If the WDOG bit is set, the MCU has been reset by the WDOG after the wakeup and after the WDOG was enabled.

As I said, the program must be stuck somewhere, the WDOG is not being fed and it resets the MCU.

Please leave the WDOG disabled after the wakeup and find out where it is stuck.

 

The WDOG resets the MCU, there is no need for an additional reset.

 

Regards,

Daniel

0 Kudos