Is there a guide for MCAL WDG module

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a guide for MCAL WDG module

436 Views
talha_uyar
Contributor III

Hi,

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,

Labels (1)
0 Kudos
4 Replies

356 Views
hungnguyenphi
NXP Employee
NXP Employee

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.

pastedImage_2.png

Best regards,

Hung

0 Kudos

91 Views
venkatesh_kulka
Contributor I

Hello hungnguyenphi,

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,

Venkatesh Kulkarni

0 Kudos

356 Views
talha_uyar
Contributor III

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. 

0 Kudos

356 Views
hungnguyenphi
NXP Employee
NXP Employee

From what I know the Wdg_Init() will enable the WDOG on its own.

Best regards,

Hung.

0 Kudos