Jump to content

Recommended Posts

Posted

Hello  !

 

I see in config file of kernel 4.14 support for RTC ds1307.

 

But in system i not see RTC. I just see RK808 RTC.

 

I need your help  for use DS1307 in my tinkerboard because rk808 is not fonctional ( no battery)

Posted

The ds1307 should work on stock kernels from at least 2.6 without problem.

 

I use the ds3231's which uses the same ds1307 driver that you need to use. Its working fine for me in 4.4 and 4.13 kernels on the tinker. I use the 3231 purely because we can buy them for < £1.50 each mounted with temp sensor and battery and it works on stock kernels.

 

When you load the rtc-ds1307 module does /dev/rtc1 appear? (/dev/rtc0 is the rk808 normally)

 

Are you using the miniarm device tree, custom or in kernel?

 

Have you modified your udev rules to point at KERNEL=="rtc1" instead of KERNEL=="rtc0"? (default and hwclock rules)

 

Have you set HCTOSYS_DEVICE=rtc1 in /etc/default/hwclock?

 

 

 

Posted

hello.

 

I use Next version for tinkerboard (kernel 4.13.3)

 

When i plug RTC (it's DS3231) in my tinkerboard, i no see RTC1 in /dev/ just RTC0.

 

with the command : i2cdetect -y 1 i see 68.

 

I need to activate something to see RTC1?

 

No have /etc/default/hwclock

 

 

edit :

 

With command :

echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new-device

and ls /dev/rtc*

 

i see RTC1.

with command :

hwclock --rtc /dev/rtc1

i see time on RTC DS3231.

 

But I do not understand how to ask the Tinkerboard to use it

Posted

Can you post the output of the following:

 

dmesg

 

lsmod | while read i ; do echo "#### Module: $i ####" ; echo $i | cut -d" " -f1 ; modinfo `echo $i | cut -d" " -f1` ; done

 

i2cdetect -l
i2cdetect -y -a 1

 

Posted

My RTC is atached to GPIO 3 and 5

 

result of lsmod :

 

Module                            Size  Used by

snd_soc_hdmi_codec    16384  0

mali_kbase                 339968  0

dw_hdmi_i2s_audio      16384  0

uas                                20480  0

Posted

@botfap the armbianmonitor output will have everything but the I2C-specific info, for future reference.  It's pretty handy.  

 

@dragonlost I had this open on my phone and didn't see your edit to the post, sorry about that.  Thank you for the additional info.

Posted
15 minutes ago, dragonlost said:

My RTC is atached to GPIO 3 and 5

 

result of lsmod :

 

Module                            Size  Used by

snd_soc_hdmi_codec    16384  0

mali_kbase                 339968  0

dw_hdmi_i2s_audio      16384  0

uas                                20480  0

 

Extra sanity check, did you connect the RTC Ground to pin4 on the tinker?

 

Also you dont have the rtc-ds1307 kernel module loaded. If you reboot clean and "modprobe rtc-ds1307" does /dev/rtc1 appear without the "echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new-device"?

 

If yes to both then the next steps for setup are easy.

Posted

@TonyMac32 thanks!

 

Steps to use the ds3231 as system clock:

 

1) Add "echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new-device" to /etc/rc.local (if needed and above "exit 0")

2) In /lib/udev/hwclock-set comment out the following:

if [ -e /run/systemd/system ] ; then
    exit 0
fi

if [ -e /run/udev/hwclock-set ]; then
    exit 0
fi

then change the HCTOSYS_DEVICE=rtc0 to be HCTOSYS_DEVICE=rtc1

3)In /lib/udev/rules.d/50-udev-default.rules change the SUBSYSTEM=="rtc" line to:

SUBSYSTEM=="rtc", KERNEL=="rtc1", SYMLINK+="rtc", OPTIONS+="link_priority=-100"

4) In your hwclock udev rule make sure you have (/lib/udev/rules.d/85-hwclock.rules):

KERNEL=="rtc1", RUN+="/lib/udev/hwclock-set $root/$name"

 

Posted
13 minutes ago, dragonlost said:

After modprobe rtc-ds1307 i not see rtc1.

In my list of modprobe posibilty no have rtc-ds1307 just "rtc-cpcap"

Ahh, did you compile as kernel built in instead of module?

 

Also is the RTC ground pin connected to GPIO pin 4 on the tinker?

Posted

No have compile kernel just install Armbian Next image .

 

I use this module : 

image.png.62af1bb088a6199efcc47857260824de.png

 

I plug this modul in 5 first GPIO ( 3.3v, SDA,SCL, None, GND) -> 1,3,5,7 and 9

Posted

Yes thats the correct pins sorry, I had a different board in my mind when I was thinking about it.

 

OK so if you ONLY do the command: "echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new-device"   from a clean boot then you can read the RTC? Is that correct? You can read it without loading a kernel driver module?

Posted
5 minutes ago, botfap said:

Yes thats the correct pins sorry, I had a different board in my mind when I was thinking about it.

 

OK so if you ONLY do the command: "echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new-device"   from a clean boot then you can read the RTC? Is that correct? You can read it without loading a kernel driver module?

yes from clean boot and i load the command  : "echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new-device", i see rtc1 in device and i can read it with hwclock --rtc /dev/rtc1

Posted
1 hour ago, botfap said:

4) In your hwclock udev rule make sure you have:


KERNEL=="rtc1", RUN+="/lib/udev/hwclock-set $root/$name"

I can not find the file in which to check this line

Posted

Thats good, it means the driver is compiled into the kernel.

 

Do the following:

 

1) Add "echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new-device" to /etc/rc.local, above the "exit 0" line at the bottom

 

2) In /lib/udev/hwclock-set comment out the lines below then change the HCTOSYS_DEVICE=rtc0 line to be HCTOSYS_DEVICE=rtc1

if [ -e /run/systemd/system ]; then 
	exit 0
fi 
if [ -e /run/udev/hwclock-set ]; then
exit 0
fi

 

3) In /lib/udev/rules.d/50-udev-default.rules change the SUBSYSTEM=="rtc" line to:

SUBSYSTEM=="rtc", KERNEL=="rtc1", SYMLINK+="rtc", OPTIONS+="link_priority=-100"

 

4) In your hwclock udev rule make sure you have (/lib/udev/rules.d/85-hwclock.rules):

KERNEL=="rtc1", RUN+="/lib/udev/hwclock-set $root/$name"

Posted
1 hour ago, botfap said:

2) In /lib/udev/hwclock-set comment out the following:


if [ -e /run/systemd/system ] ; then
    exit 0
fi

if [ -e /run/udev/hwclock-set ]; then
    exit 0
fi

I do not understand why it is necessary to comment his lines?

Posted
1 minute ago, dragonlost said:

I can not find the file in which to check this line

If it doesnt exist create a new udev rule at: /lib/udev/rules.d/85-hwclock.rules

Posted
7 minutes ago, dragonlost said:

I do not understand why it is necessary to comment his lines?

Becuase /run/systemd/system will always exist and that if statement terminates the script if it finds /run/systemd/system

 

You can leave the second one in if you want, /run/udev/hwclock-set doesnt and wont exist, its just not relevant.

Posted
53 minutes ago, botfap said:

Thats good, it means the driver is compiled into the kernel.

 

Do the following:

 

1) Add "echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new-device" to /etc/rc.local, above the "exit 0" line at the bottom

 

2) In /lib/udev/hwclock-set comment out the lines below then change the HCTOSYS_DEVICE=rtc0 line to be HCTOSYS_DEVICE=rtc1


if [ -e /run/systemd/system ]; then 
	exit 0
fi 
if [ -e /run/udev/hwclock-set ]; then
exit 0
fi

 

3) In /lib/udev/rules.d/50-udev-default.rules change the SUBSYSTEM=="rtc" line to:


SUBSYSTEM=="rtc", KERNEL=="rtc1", SYMLINK+="rtc", OPTIONS+="link_priority=-100"

 

4) In your hwclock udev rule make sure you have:

KERNEL=="rtc1", RUN+="/lib/udev/hwclock-set $root/$name"

 

 

I made the changes you gave me but it does not work.

The rtc1 is detected but does not update the system clock at startup.
On the other hand, the rtc0 does not do it either.

The rtc1 is on time. The rtc0 is in 2013. The system clock is staying at the time it was before extinction.

to test I disconnected the networks and I left off for 20min. Then I rode without networks.

Posted

what happens if you manually run:

/sbin/hwclock --rtc=/dev/rtc1 --systz
/sbin/hwclock --rtc=/dev/rtc1 --hctosys

 

Posted
5 minutes ago, botfap said:

what happens if you manually run:


/sbin/hwclock --rtc=/dev/rtc1 --systz
/sbin/hwclock --rtc=/dev/rtc1 --hctosys

 

for systz nothing append

for hctosys the tim system is update at the good time

Posted

--systz sets the time zone and only needs to be called once per boot, it wont show you any time changes

--hctosys sets the system time from the rtc

--systohc sets the rtc clock with the system time (after ntp sync for example)

 

What happens if you run just:

 

/lib/udev/hwclock-set /dev/rtc1

 

Posted
17 minutes ago, botfap said:

--systz sets the time zone and only needs to be called once per boot, it wont show you any time changes

--hctosys sets the actual time from the rtc

--systohc sets the rtc clock with the system time (after ntp sync for example)

 

What happens if you run just:

 


/lib/udev/hwclock-set

 

hwclock: Cannot access the Hardware Clock via any known method

Posted
2 minutes ago, dragonlost said:

hwclock: Cannot access the Hardware Clock via any known method

What about with the device specified?

 

/lib/udev/hwclock-set /dev/rtc1

Posted
16 minutes ago, botfap said:

What about with the device specified?

 

/lib/udev/hwclock-set /dev/rtc1

No error and set system at the good time

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines