S32k WDG Refresh by GPT_ISR through callback

cancel
Showing results for 
Search instead for 
Did you mean: 

S32k WDG Refresh by GPT_ISR through callback

107 Views
Sayed_Sukkar
Contributor I

Hello there, 
I am Using S32K144 and I am trying to configure WDG component through tresos EB v23 , MCAL v1.0.4.

I have implemented the WDG fine and linked the a GPT channel for the WDG, but I am having trouble Refreshing the WDG using WDG_SetTriggerCondition() function, it doesn't operate at all, 

in AUTOSAR, req [SWS_Wdg_00166] it says I should not refresh in tasks but in the GPT ISR, so I tried doing that, using SRTC_0_CH_0  which did not work, then  I tried FTM_0_CH_6, which also failed. 

I enabled peripheral clocks, ISR, module used check boxes in tresos, I enabled the MACROS for IRQ handlers in C_startup, and called my ISR in the handler, but my code never goes into the desired ISR. ( checked with debugger ) 

so can any one help ?

Tags (5)
0 Kudos
3 Replies

84 Views
Sayed_Sukkar
Contributor I

Hi  @namnguyenviet

Thanks for your reply, So just to make things clear all I have to do is to link GPT with WDG through call back notification, then I can call Set_triggerCondtion()  freely in tasks with Timeout Paramater in milliseconds ? and it will refresh WDG timer Instantly ? or it will have to wait for the ISR to be served ?

Now for the ISR, what I have already done before submitting the ticket : 

I enabled IRQ_handlers in Cstartup :

#define CSTS32K_coUSE_RTC_IRQHandler

#define CSTS32K_u8RTC_PRIORITY 7u 

should I make priority 0 or 1 ?

and then called the ISR in the IRQ handler 

S32K_udtIT_HDL_PREFIX CSTS32K_vidRTC_IRQHandler(void)
{
Os_Isr_Gpt_SRTC_0_Ch_0_ISR();
}

I have not yet checked for flags, I will be doing that then I will return with a response but so far that should do the trick right and both timers where given prehpiral clocks, enabled and ISR enabled from tresos ? so nothing more to implement, right ?

 

0 Kudos

58 Views
namnguyenviet
NXP Employee
NXP Employee

Hello @Sayed_Sukkar,

Thanks for your reply, So just to make things clear all I have to do is to link GPT with WDG through call back notification, then I can call Set_triggerCondtion()  freely in tasks with Timeout Paramater in milliseconds ? and it will refresh WDG timer Instantly ? or it will have to wait for the ISR to be served ? 

It's supposed to work like that, and you don't need to wait for any of ISR (the GPT ISR, which linked to WDG, will be processed by WDG driver). Make sure that you've installed the GPT ISR correctly.

I have not yet checked for flags, I will be doing that then I will return with a response but so far that should do the trick right and both timers where given prehpiral clocks, enabled and ISR enabled from tresos ? so nothing more to implement, right ?

Your ISR configuration seems to be under an OS setting, so I couldn't say whether it's right or wrong. It's indeed that they're all for configurations (Peripheral clock sources for timers, EB tresos configuration for GPT channels), but it doesn't mean that you've configured everything correctly, and you shall check the peripheral registers: SCG and PCC for clock sources registers, RTC and FTM for timer registers during the runtime.

Best Regards,

Nam

0 Kudos

95 Views
namnguyenviet
NXP Employee
NXP Employee

Hello @Sayed_Sukkar,

The [SWS_Wdg_00166] requirement is for the WDG driver itself, i.e. the WDG driver shall implement the Watchdog refresh through a GPT ISR - which is already implemented by configuring and linking the GPT channel for the WDG. It's not the requirement for Wdg_SetTriggerCondition() calling, and you can freely call the Wdg_SetTriggerCondition() inside a task. It's also fine if you want to call Wdg_SetTriggerCondition() inside an interrupt handler.

About your problem, you shall need to check whether the interrupt flags for either RTC or FTM was raised, along with checking the interrupt enable flags were set or not. If they were set, then please check whether the interrupt handler were installed correctly. Please note that you need to define the ISR name and set the NVIC ID for these interrupt following with the guidance in GPT Integration Manual,  ISR to configure within OS – dependencies part:

namnguyenviet_0-1632452921192.pngnamnguyenviet_1-1632452952075.png

Best Regards,

Nam

0 Kudos