Hi everyone,
I'm using MCUXpresso 10.2.1, with a custom board based on K66 device.
I've enabled the watchdog interrupt that writes a value to an external battery backed up memory, but it doesn't seem to be executed.
This is the wdog init code I've used:
WDOG_GetDefaultConfig( &WdogConfig );
WdogConfig.clockSource = kWDOG_AlternateClockSource;
WdogConfig.prescaler = kWDOG_ClockPrescalerDivide5;
WdogConfig.workMode.enableStop = true;
WdogConfig.enableInterrupt = true;
WdogConfig.timeoutValue = WDOG_TIMEOUT_VAL( CLOCK_GetFreq( kCLOCK_BusClk ), WdogConfig.prescaler );
WDOG_Init( WDOG, &WdogConfig );
NVIC_SetPriority( WDOG_EWM_IRQn, WDOG_INTPRIO );
EnableIRQ( WDOG_EWM_IRQn );
This is the interrupt function:
void WDOG_EWM_IRQHandler( void )
{
*(( unsigned long *)0x90000000 ) = 0x1234ABCD;
}
If I stop servicing the watchdog, the CPU resets, but the interrupt is not serviced.
The interrupt priority is higher than every other one.
Do I need other code for the interrupt to be executed?
Many thanks
Biafra
Solved! Go to Solution.
Sorry for my last reply!
I have modify the wdog example in SDK_2.4.1_FRDM-K66F, so that we can see if the value in RAM was modified by
WDOG_EWM_IRQHandler.(...\SDK_2.4.1_FRDM-K66F\boards\frdmk66f\driver_examples\wdog)
I have attached the test video and wdog.c file.
Best Regards,
Robin
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi biafra,
Breakpoint in WDOG_EWM_IRQHandler may not let you know whether the watchdog interrupt happens or not.
Please refer the answer in: Watchdog Interrupt not reached, Cortex M4, mqx KSDK
Best Regards,
Robin
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi novice,
Many thanks for your answer.
I've not set a breakpoint in the interrupt routine: I've said that interrupt is not serviced because I don't see the 0x1234ABCD value at the 0x90000000 address.
The 0x90000000 address is located in no_init area, so after reset it should be unchanged. In the same area there is a RAM disk that is fully operational after reset.
Is the code above correct for the interrupt to be executed?
Many thanks
Biafra
Sorry for my last reply!
I have modify the wdog example in SDK_2.4.1_FRDM-K66F, so that we can see if the value in RAM was modified by
WDOG_EWM_IRQHandler.(...\SDK_2.4.1_FRDM-K66F\boards\frdmk66f\driver_examples\wdog)
I have attached the test video and wdog.c file.
Best Regards,
Robin
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi novice,
I've found the reason for not writing the value: the cache was enabled; after it has been disabled, I can see the correct value after the reset.
Many thanks
Biafra