S32k311 Software watchdog issue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32k311 Software watchdog issue

974 Views
AKV
Contributor II

I am trying to implement Software watchdog timer in S32K311 MCU , with SWT 0 instance i am facing issue with it

Requirement: Need to implement watchdog with timeout value of 1 second source clock will be SIRC (32Khz), so count become 32000, It has to be window watchdog with 50% window, it means after count is below 16000 then only has to be refreshed counter is down counter

PsuedoCode :

Init :
       SWT_0.CR.R = 0xFF000188; 
       SWT_0.TO.R = 32000;  // !second timeout for watchdog 
       SWT_0.WN.R = 16000; // count below refresh has to be done
       SWT_0.CR.B.WEN = 1;  // Enable WDT 
         s_time_since_last_refresh_ms = 0;

Refresh: Called in scheduler every 1ms (time is correct)
    

if (s_time_since_last_refresh_ms > 700 ) //kept 700 instead of 500ms to ensure no issue can be caused by time jitter

{

SWT_0.SR.R = 0xA602;

SWT_0.SR.R = 0xB480;

s_time_since_last_refresh_ms = 0;

}


Timing of scheduler is correct, tested with Toggling PIN, issue is after 700ms the refresh is called the system reset,

but when I switch same configuration from Window to normal mode it works fine as expected no reset run forever checked by toggling pin.

 

Even I checked reset cause it is SWT only in reset register.

 

Even I checked what is count value inside refresh API when 700ms has passed, count was correct below 16000 ,

but to get count value I need to disable and watchdog else I can't read the count, so I am not sure what I am doint wrong

Can someone help me to find the cause of issue and I can't use example code provided by SDK. But i checked the example code they are also using in same way did i miss to configure some other peripherals for correct working on SWT.

0 Kudos
Reply
9 Replies

967 Views
AKV
Contributor II

AKV_0-1754250520948.png

This is after reset MC_RGM registers value 

0 Kudos
Reply

947 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@AKV

The following is my test process, the bare metal code is as follows, and RTD is 6.0.0.

And it works as expected.

 

 

    IP_SWT_0->CR &= ~SWT_CR_WEN_MASK;
    IP_SWT_0->CR |= SWT_CR_WND_MASK;
    IP_SWT_0->WN = 16000;
    IP_SWT_0->TO = 32000;
    IP_SWT_0->SR = 0xA602;
    IP_SWT_0->SR = 0xB480;
    IP_SWT_0->CR |= SWT_CR_WEN_MASK;

 

void PitNotification(void)//1ms
{
    if(s_time_since_last_refresh_ms>700)
    {
		IP_SWT_0->SR = 0xA602;
		IP_SWT_0->SR = 0xB480;
		/* Toggle the gpio pin to blink the LED when the Pit notification is called */
		Siul2_Dio_Ip_TogglePins(LED_PORT, (1UL << LED_PIN));
		s_time_since_last_refresh_ms = 0;
    }
    else
    {
    	s_time_since_last_refresh_ms++;
    }
}

 

0 Kudos
Reply

934 Views
AKV
Contributor II

I tested your code in my workspace, not working same behavior as previous, is there any pre-configuration needed for it.

0 Kudos
Reply

917 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@AKV

No additional steps are required.
This project has been tested on the S32K311EVB hardware. If you still have questions, I can record a video for you.

0 Kudos
Reply

907 Views
AKV
Contributor II

thanks for update, if possible, can you please share you whole workspace I will test on my setup also as I also have same hardware.

0 Kudos
Reply

901 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@AKV

The hardware is base on S32K31XEVB,the IDE is S32 DS V3.6.2 + RTD 6.0.0.

The blue LED will toggle at cycle of 700ms.

0 Kudos
Reply

800 Views
AKV
Contributor II

Hi @Senlent  

your given workspace is working as expected, i took binary from it compilation some issue i am facing, but in my application workspace that is created in S32DS ide same steps are not working, is there any possibility that some Pre configuration is need for SWT0 to run properly.

0 Kudos
Reply

742 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@AKV

I don't see such a limitation.
We've wasted a lot of time on this issue, and I've provided you with a working example. If you still have questions, please provide me with your complete project and I'll help you investigate the possible cause.

0 Kudos
Reply

897 Views
AKV
Contributor II

Ok @Senlent  , noted I will try and update you on same, thanks for update again 

0 Kudos
Reply