it seems ntpd.service make my rtc setting wrong?

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

it seems ntpd.service make my rtc setting wrong?

跳至解决方案
1,601 次查看
gonewithwind-peter
Senior Contributor I

Hi all,

I am playing maaxboard-mini(i.MX8MM ,yocto sumo, kernel 4.14) with my rtc chip M41T93,

after I set rtc with command: date --set="20210924 20:56:30";hwclock --systohc --utc --rtc=/dev/rtc0 and  read it with "hwchock -r" , the date is right. I make sure the rtc works in this kernel

but after reboot, the date and rtc date that reading with hwclock -r both are wrong(it not shows my compilation time, it shows Aug, 26 XXXX)

and I try to use /sbin/hwclock --hctosys  to get date, the date are same wrong.

 

after I remove ntpd.service at /etc/systemd/system/multi-user.target.wants/ntpd.service to disable it

 

after rebooting and reseting the rtc, and use /sbin/hwclock --hctosys  in bootup script, the rtc works well( the date and rtc sync)

 

it seems ntpd.service make my rtc setting wrong? why?     ( I tried yocto zeus, no this issue)

at the first, I think my rtc not work,Maybe the kernel has issue,but I use a scope to check the timing, I find it seems OK. now I think the issue is from ntpd.service

 

any help?

thanks.

 

please see the log:

cat /var/log/syslog | grep rtc
Aug 26 14:27:51 fortress kernel: [ 1.713541] imx-drm display-subsystem: bound imx-lcdif-crtc.0 (ops lcdif_crtc_ops)
Aug 26 14:27:51 fortress kernel: [ 4.721802] hctosys: unable to open rtc device (rtc0)
Aug 26 14:27:51 fortress kernel: [ 9.033299] rtc-m41t93 spi0.0: rtc core: registered rtc-m41t93 as rtc0

 

 

--

at the first, the log shows :hctosys: unable to open rtc device (rtc0) ,

but finally  rtc-m41t93 spi0.0: rtc core: registered rtc-m41t93 as rtc0

the issue is from there?

 

my yocto sumo and zeus (kernel 4,14 and 5.4) kernel config are same: sync NTP and startup read from rtc

0 项奖励
回复
1 解答
1,530 次查看
AldoG
NXP TechSupport
NXP TechSupport

Hello,

If it still useful for you, it seems that the hwclock and the system clock may not been syncing correctly after reboot, you may try adding the clock synchronization to the startup script, i.e.

hwclock -s

Best regards,
Aldo.

在原帖中查看解决方案

2 回复数
1,531 次查看
AldoG
NXP TechSupport
NXP TechSupport

Hello,

If it still useful for you, it seems that the hwclock and the system clock may not been syncing correctly after reboot, you may try adding the clock synchronization to the startup script, i.e.

hwclock -s

Best regards,
Aldo.

1,517 次查看
gonewithwind-peter
Senior Contributor I

Hi @AldoG 

it's useful.

I did the same with :/sbin/hwclock --hctosys   it's well

Thank you very much.

I received your answer as an solution

0 项奖励
回复