RTC not saving time during power cycle on i.MX6

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

RTC not saving time during power cycle on i.MX6

跳至解决方案
3,235 次查看
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

标签 (2)
0 项奖励
回复
1 解答
2,304 次查看
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 项奖励
回复
3 回复数
2,305 次查看
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 项奖励
回复
2,304 次查看
CarlosCasillas
NXP Employee
NXP Employee

Hello Marlon,

Thanks for sharing your solution with the Community!

Best regards!

/Carlos

0 项奖励
回复
2,304 次查看
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 项奖励
回复