Using the S32K146 MCU with DS for ARM v2.2.
After I initialize my WDOG, I can confirm that it is working to reset the system... but I cannot seem to successfully kick the WDOG. It just keeps resetting the system.
Here is my WDOG config:
#include "watchdog1.h"
/*! watchdog1 configuration structure */
const wdog_user_config_t watchdog1_Config0 = {
.clkSource = WDOG_LPO_CLOCK, /* WDOG clock source */
.opMode = {
false, /* Wait Mode */
false, /* Stop Mode */
false /* Debug Mode */
},
.updateEnable = true, /* Enable/Disable further updates of the WDOG configuration */
.intEnable = true, /* Timeout interrupt disabled */
.winEnable = false, /* Enable/Disable Window mode */
.windowValue = 0U, /* Window value */
.timeoutValue = 9000U, /* Timeout value */
.prescalerEnable = true /* WDOG prescaler */
};
... and I use these two wrapper functions for the NXP API to init and try to kick the WDOG:
void init_watchdog(void) {
/* Initialize the WDOG driver */
WDOG_DRV_Init(INST_WATCHDOG1, &watchdog1_Config0);
}
void refresh_watchdog(void) {
WDOG_DRV_Trigger(INST_WATCHDOG1);
}
My application is FreeRTOS based. I inserted the WDOG init call in main along with my other initializations. I have a UART print in main that shows me when the system is reset.
The issue is that regardless of where I call refresh_watchdog(), I cannot get the WDOG timer to reset.
Currently, I enabled #define configUSE_IDLE_HOOK 1 in FreeRTOS config so I can use the idle task with void vApplicationIdleHook(void) to call the wdog kick. Still no luck.
Wdog is working to reset the system, I just need to know how I can successfully kick the thing. I have multiple RTOS tasks with different priorities, running with a semaphore based ISR routine. Any ideas?
I tried refreshing the watchdog:
- In my RTOS tasks just after the while(1) call or at the end of the task. (No luck)
- Tried calling WDOG reset in the ISR function. (I shouldn't do this anyways, but no luck)
- I tried creating a new independent RTOS task that just contains the reset function and kicks the WDOG when it gets passed the semaphore. (no luck)