hello:
Here is my code.
I enabled the interrupt in the initialization, the watchdog does not refresh the value within 2 seconds will reset, why not enter the watchdog interrupt it? thank you all!
Hi,
How do you know it doesn't enter the ISR?
The reset is delayed only by 128 bus clock cycles after the vector is fetched.
Instead of incrementing the VA variable, toggle a GPIO pin.
There is SDK watchdog_interrupt example code, so you can refer to that.
Regards,
Daniel
hi,Daniel
I set a breakpoint inside the ISR, the program did not enter the breakpoint directly reset. I debug you said the SDK example, I also set a breakpoint in that example ISR, the program is not into the breakpoint reset directly.
The reset is delayed only by 128 bus clock cycles after the vector is fetched.How to understand this?
Regards,
Cai
Hi,
In SDK watchdog_interrupt example code, you should pay attention to see a parameter intEnable ( If true, an interrupt request is generated before reset ). So if you want enter the watchdog ISR you need mask WDOG_DRV_Trigger(INST_WATCHDOG1) .
In addition,
Regards,
Frank
Hi,Frank
intEnable this parameter in my initialization is set to true.
WDOG_DRV_Trigger The function of this interface is to refresh the WDOG counter.If you do not want to enter the interrupt or reset, before the counter reaches the set value refresh.
You tell me want to enter the watchdog ISR I need to mask WDOG_DRV_Trigger (INST_WATCHDOG1). Can you give me an example?
Regards,
Cai
Hi, Cai,
You can refer to the wdog_interrupt_s32k144 example code provided by S32 Design Studio for ARM v2.0.
I think this demo has a bit of problem but does not affect your reference.
Hi,Zhao
I know you say this example, the same example can not enter the WDOG ISR, wdg_pal_interrupt_s32k144 can not enter the same.
wdog_interrupt_s32k144 This official example, you can debug into WDOG ISR?
Regards,
Cai
Hi,
I modified the WDOG_ISR of the SDK example to simply toggle the RED LED.
/* WatchDog IRQ handler */
void WDOG_ISR(void)
{
WDOG->CS |= (1 << 14); // Clear WDOG FLG
PTD->PTOR |= 0x8000; // Toggle RED LED, PortD15
PTD->PTOR |= 0x8000;
PTD->PTOR |= 0x8000;
PTD->PTOR |= 0x8000;
PTD->PTOR |= 0x8000;
PTD->PTOR |= 0x8000;
}
I can see it enters the interrupt on the PortD15 pin.
If I place a breakpoint as shown below, I can’t see it stops at the breakpoint, because the reset comes too fast (in 128 bus clock cycles).
Nevertheless, checking the PortD15 pin, I can see it really stops at the breakpoint.
Regards,
Daniel
Hello Daniel,
I only add the following statements in WDOG_ISR,
WDOG->CS |= (1UL << 14);
s_uiWatchDogTest = 0xAA5555AA; // this variable will not be initialized by bss or data, and it was set to 0 before waiting watchdog timeout.
The s_uiWatchDogTest value will be 0xAA5555AA with J-Link inserted(not debugging), but it's value will be 0 without J-Link inserted.
I think WDOG_ISR routine was not executed without J-Link inserted.
What should i do if WDOG_ISR routine also was executed without J-Link inserted?
Regards,
Liu
Hello Daniel,
I too am having some trouble getting the delayed watch dog reset ISR to hit reliably. Based on your comments above, it sounds like even hitting a break point is not going to be reliable. Also, it appears that if you happened to be in a critical region with interrupts disabled when the watch dog counter times out then the interrupt doesn't occur at all, just the reset.
So I guess my real question is what can one actually do inside this ISR reliably, if I can't even hit a SW break point to allow me to check registers, etc when it occurs.
Either way, thanks for the information. It seems this interrupt might be less useful than I had hoped, and based on you comments I should probably stop wasting time on it.
Regards,
Stephen
Hello Stephan,
You can extend the delay using RCM_WDOG interrupt.
Example S32K144 WDOG RCM interrupt
But anyway, the reset is forced, it can't be stopped.
As the RM states: "When an interrupt for a reset source is enabled, software has time to perform a graceful shutdown."
It depends on your application.
Regards,
Daniel