S32K328 RTC FAIL AFTER WAKEUP

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

S32K328 RTC FAIL AFTER WAKEUP

109 Views
Wade0905
Contributor I

Hello NXP Team,

I have previously developed RTC functionality on the S32K314, and after sleep wake-up it can continue counting time normally.

Now I am porting the project to the S32K328. However, while porting the RTC function, I encountered an issue:

After wake-up, the date (year/month/day) is reset to the default value 1970/1/1. In addition, the time (hours/minutes/seconds) does not preserve the originally configured value, but instead reflects only the elapsed time counted from the RTC start point.

For example, I initialize the RTC to 2026/05/08 05:06:07. After 1 minute of operation, when the MCU wakes up and I read back the RTC time, the date has reverted to 1970/01/01, and the time shows 00:01:00 instead of the expected 05:07:07.

This issue did not occur on the S32K314. What could be the possible causes of this problem?

Thank you.

 

RTC INIT.jpgRtc_Ip_u32ChState.jpg

0 Kudos
Reply
3 Replies

77 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hello @Wade0905,

Have you checked RTC clock source? Confirm if SIRC and "Enabled in Standby" options are selected:

Julin_AragnM_1-1779316332707.png

Julin_AragnM_0-1779316326784.png

Also, keep in mind that RTC counter value will not be reset after wake-up, but it will reset by calling RTC initialization code in main.c. I can see you initialize RTC only after wake-up event. You can try reading reset reason to see if any other type of reset is being issued, and thus, clearing RTC value by mistake.

There is a community post you can refer to: S32K312: RTC- Preserving RTC counter value from getting resets once after every wakeup.

Please compare it to your configuration.

Best regards,
Julián

0 Kudos
Reply

45 Views
Wade0905
Contributor I

Hi Julián,

Thanks for your reponse.

Regarding clock source, I select SXOSC which same as our project in S32K314. Please see below picture for you ref.

SXOSC_1.jpgSXOSC_2.jpg

Regarding init, I only do rtc_app_init() when WAKEUP_REASON != MCU_WAKEUP_REASON which same as our project in S32K314. Please see below picture for you ref.

rtc_app_init.jpg

 

I believe the counter continues counting during sleep mode, but the date and time are reset.
You can refer to my test results below.

At the first power-on, after rtc_app_init() is completed, the system starts counting from 2026/05/08, 5 hours, 6 minutes, and 7 seconds.

This is transmitted via CAN message 0x521.

  • BYTE 0: Year
  • BYTE 1: Month
  • BYTE 2: Day
  • BYTE 3: Hour
  • BYTE 4: Minute
  • BYTE 5: Second
  • BYTE 7: RESET REASON

 power on.jpg

After waking up from sleep for five minutes, the counter (CNT) continues counting. However, the year, month, day, hour, minute, and second all start counting from 1970/01/01 00:00:00, instead of continuing from the time set during initialization.

wakeup.jpg

For 0x263, BYTE 2 to BYTE 5 represent the time extracted using Rtc_Ip_ConvertTimeDateToSeconds().

Rtc_Ip_ConvertTimeDateToSeconds.jpg

Please check the differences between the S32K328 and S32K314.

Why does the RTC on the S32K328 not retain the previously configured date and time, even though the same settings work correctly on the S32K314?

0 Kudos
Reply

11 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi 

Are you able to share your project, or the .mex configuration file, so I can inspect the code on my side? 

The only reasons I can think of for the RTC not keeping the value are:

  1. Reset reason is other than Wake-Up and value is not kept since reset is non-functional. 
  2. Even if reset reason is functional, it may not be wakeup, meaning the RTC is being re-initialized.

You've mentioned that byte 7 shares reset reason, however I cannot see in the images which reset reason is being sent over CAN. MCU_WAKEUP_REASON is declared as 28 inside the Power_Ip_Specific.h, I imagine CAN must send a 28? 

If you are using MCAL, make sure the option "GPT Standby Wakeup Support" is enabled: S32K324 RTC value not preserved after sleep.

One thing I can suggest is to do a register dump (through the "Watch Registers" view). This may help you spot any differences between projects. Simply export both S32K328 & S32K314 register values as files, and you can compare them through any program, for example WinMerge.

Best regards,
Julián

 

0 Kudos
Reply