RTC not saving time during power cycle on i.MX6

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

RTC not saving time during power cycle on i.MX6

Jump to solution
2,743 Views
marlonsmith
Contributor IV

Hi everyone,

I'm using an i.MX6S on custom hardware and Yocto fido with kernel 3.14.28_1.0.0.   If I set the date like this: "date 040314301984" and then run "hwclock --systohc" everything looks good.  If I type hwclock after that I get the correct time: Tue Apr  3 14:30:05 1984  0.000000 seconds

However, when I unplug my board and plug it back in, the clock does not keep the correct time.

If I run the poweroff command first, the correct time is kept, but this does not work for our product as the user will not be shutting it down but simply unplugging it.

Does anyone know how to fix this?

Thanks

Marlon

Labels (2)
0 Kudos
1 Solution
1,812 Views
marlonsmith
Contributor IV

For anyone else using Yocto fido, beware that the script hwclock.sh included with busybox gets called several times during startup, and one of those times is called with the argument "stop".  This causes the hardware rtc to get overwritten by the system clock before the system clock gets set by the hardware clock, causing the incorrect time to be set.

View solution in original post

0 Kudos
3 Replies
1,813 Views
marlonsmith
Contributor IV

For anyone else using Yocto fido, beware that the script hwclock.sh included with busybox gets called several times during startup, and one of those times is called with the argument "stop".  This causes the hardware rtc to get overwritten by the system clock before the system clock gets set by the hardware clock, causing the incorrect time to be set.

0 Kudos
1,812 Views
CarlosCasillas
NXP Employee
NXP Employee

Hello Marlon,

Thanks for sharing your solution with the Community!

Best regards!

/Carlos

0 Kudos
1,812 Views
marlonsmith
Contributor IV

I've determined that the RTC is actually working correctly.  It shows the correct time during boot, but further in the boot sequence an incorrect time is shown and the rtc seems to get reset.  Now to figure out what's resetting it...

0 Kudos