How to read time from RTC connected on I2C on pin 194 & 196 of iMX7 - Linux

WE have connected external RTC to 194 & 196 pin of iMX7D
WE are using Liux
How can we read hardware clock time from this RTC ?

I am getting below logs at boot time. …

[ 1.471093] rtc-ds1307: probe of 3-0068 failed with error -5
[ 1.479442] snvs_rtc 30370000.snvs:snvs-rtc-lp: rtc core: registered 30370000.snvs:snvs- as rtc1

[ 4.088602] hctosys: unable to open rtc device (rtc0)

and if run hwclock …
root@colibri-imx7:/# hwclock
hwclock: can’t open ‘/dev/misc/rtc’: No such file or directory

please suggest.

You need to add and configure proper driver for your RTC chip.

Hi Guys,

Thanks alex.tx for the comments.

But I got this solved by below steps:

my dmesg was giving me :

[    1.471093] rtc-ds1307: probe of 3-0068 failed with error -5
[    1.479442] snvs_rtc 30370000.snvs:snvs-rtc-lp: rtc core: registered 30370000.snvs:snvs- as rtc1
[    4.088602] hctosys: unable to open rtc device (rtc0)

I referred the details on below link

from above link I tried to make rule file …
/etc/udev/rules.d/99-rtc1.rules
but this too did not work…
then at the same path … that is => /etc/udev/rules.d/
I found one more rule file => localextra.rules
in this file I changed the rule as below. commented line was previous… I changed to new one …

*# The first rtc device is symlinked to /dev/rtc
#KERNEL=="rtc0", SYMLINK+="rtc"
KERNEL=="rtc1", SYMLINK+="rtc"

and then my system started reading my RTC as hardware clock …

Regards,
Neelam

Perfect, that your issue is solved. Thanks for the feedback.