I am trying to implement a Watchdog for S32K118 through MCAL's WDG module. I understand how to build and use the watchdog timers through WDOG, as the Reference Manual provides an in depth explanation for it. However, I cannot understand how to use the MCAL's WDG module. Is there a guide or an example explaining how to use WDG module.
I have set up the GPT timer and its notification is indeed Wdg_Cbk_GptNotification0, I have also called Wdg_Init() function. The WDOG register values are not changed by this and when I try to call Wdg_SetMode(); it returns E_NOT_OK. What am I doing wrong?
Thanks in advance,
Hello Muhammet Uyar ,
From my point of view, your issue may come from your configuration. Could you please share your configuration(GPT, Wdg, Mcu ). Normally I just need to call Wdg_init then the wdg register 's value will be change.
I would like to explain the concept of Wdg driver.
The Wdg driver will setup the:
- "Wdg Timeout Period" (user will set it in the Wdg 's configuraiton) Eg: WTP = 1s
- "Wdg Window Period" (user will set it in the Wdg 's configuraiton) Eg: WWP = 0.05s
- The duration for timer refresh watchdog = WWP + (WTP - WWP) / 2 = 0.05 +(1+0.05)/2= 0.525s
- The Wdg timeout will be set to "Wdg Initial Timeout" when the Wdg_init is called (user will set it in the Wdg 's configuraiton) Eg: WIT=2.5s.
With the above configuration the timer will refresh watchdog 4 times(2.5/0.525=4) before the watchdog reset MCU.
To make the timer continue refresh the watchdog, application will need to call "Wdg_SetTriggerCondition(TIME_OUT)" to extend the refresh time.
I have a followup question for your explanation above, Wdg_SetTriggerCondition(TIME_OUT) How do we calculate the value for "TIME_OUT".
Thanks and Regards,
I know the WDOG is disabled during start-up, so do I need to re-enable the WDOG before calling Wdg_Init() function or does the Wdg module takes care of enabling the WDOG on its own.