Jump to content

RTC DS3231 How to install? - Tinker Board (Stretch 4.14)


Chili N

Recommended Posts

Hi guys,

 

sorry, on with my second issue with the Asus Tinker Board and installing a DS3231 Real Time Clock module.

 

I've tried following any instructions on the internet for Tinker Board use and a couple for the Raspberry Pi, from recompiling the kernel through to trying to edit boot files. I just cannot get this thing working so I've now got myself a fresh install of Armbian Stretch 4.14 and ready to go again.

 

Can anybody provide a step-by-step installation for the Tinker Board and this module (I've been told the DS1307 is the same kernel module but for the life of me I cannot find any modules/.ko's available in Armbian)?

 

Many thanks for any help or advice.

Link to comment
Share on other sites

Those modules are disabled in configuration:
https://github.com/armbian/build/blob/master/config/kernel/linux-rockchip-next.config#L4073

You need to make your own kernel: https://docs.armbian.com/Developer-Guide_Build-Preparation/ and push your changes (basically only your new updated kernel config file linux-rockchip-next.config) to our build script that you don't lose your changes on next kernel upgrade.

New kernel packages you made is installable with: dpkg -i newkernel_and_dtb_package_as_well.dtb + reboot (then go to armbian-config and freeze kernel that its not overwritten with our stock if you forget to send us changes)

 

It shouldn't be to hard.

Link to comment
Share on other sites

Quick update: it seems the DS3231 works with the DS1307 (not the DS1302) kernel module and the kernel doesn't need recompiling for this (Stretch 4.14). I fitted the module to pins 1,3,5,7,9, mode-probed for the DS1307, and followed the instructions for a Pi3 and removing the fake-hwclock.

 

There are a number of posts in different communities about leaving the fake-hwclock there and reconfiguring it so the Tinker will pick up NTP time normally and fall back on the RTC when there's no network connection. I didn't do this because I had already removed fake-hwclock according to other instructions and didn't have time to start over. However, I've got a cron job that just resyncs the RTC with NTP once a month.

 

DS3231 seems hugely more accurate than DS1307 and the three modules I've got running so far have kept much better time. I've a single DS1307 running on a Pi3 and it's gained around 211 seconds over the last week. Of the Tinker's RTC's I've just checked one which has lost around 3 seconds.

Link to comment
Share on other sites

On 6/10/2018 at 5:14 PM, Chili N said:

DS3231 seems hugely more accurate than DS1307 and the three modules I've got running so far have kept much better time. I've a single DS1307 running on a Pi3 and it's gained around 211 seconds over the last week.

DS1307 has an external crystal, and when you buy those cheap chinese modules.. It's likely that they put the most crappy crystal they can find on the module.. :ph34r:

Cause DS3231 'rpi like' modules are cheap anyway, I see no reason to use a DS13xx anymore.. There's even a temp-sensor inside the DS3231, in case you need it. In case those bits are still inside the RTC driver, you should be able to talk to it with the DS1307 driver.. In case they changed it to the DS3231 you might build an image with the DS3231 driver (as a module) and in case this works send a PR to Armbian. :) 

Link to comment
Share on other sites

2 hours ago, Tido said:

have you been here: https://forum.armbian.com/topic/5346-rtc-ds1307-i2c-for-tinkerboard/

all I did was using the search box in the right hand top and searched for: DS3231

 

Yes Tido, I had been to that page but kept getting the "hwclock: Cannot access the Hardware Clock via any known method" message. I still can't see what was wrong but I'd tried it on a fresh install with cut and paste from the pages eventually too but couldn't stop this error. I ended up using DS1307 instructions from a Pi page.

 

3 hours ago, chwe said:

Cause DS3231 'rpi like' modules are cheap anyway, I see no reason to use a DS13xx anymore.

 

Where I am at the moment there are hundreds of DS1307 modules of different shapes and sizes, not a single one over $4. I've had to message companies in Quito for my next trip into the city about DS3231's ..... cheapest so far is $18 each. Mounts up when you could do with 25 of them :( The import process is a little crazy here. You can buy a $2 module from China, pay 40c tax on it but the processing/handling charge for each is $3.50. I just had a $110 charge from DHL for processing two $15 arduino shields.

Link to comment
Share on other sites

2 minutes ago, Chili N said:

I ended up using DS1307 instructions from a Pi page.

If you've time you could write a small tutorial for the section here (in case times allows it. :)):

https://forum.armbian.com/forum/26-research-guides-tutorials/

 

4 minutes ago, Chili N said:

I just had a $110 charge from DHL for processing two $15 arduino shields.

Happens here when they decide to send it with UPS.. So whenever possible I choose the slowest shipping due to this comes normally by regular post service and their import handling fees are 'ok'.. :P (UPS is also painful to get the package.. they normally say that you weren't there until you give them a mobile number so that the driver can phone you to save time.. might be differ in other countries). 

 

 

Link to comment
Share on other sites

25 minutes ago, Chili N said:

Yes Tido, I had been to that page but kept getting the "hwclock: Cannot access the Hardware Clock via any known method" message.

Still I am bit puzzled that you open a new thread while having a problem with the same hardware RTC DS3231

 

on the other tread he got it working with 4.4

Quote

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.

This below was the 1 of March release, try it without doing updates

Stretch

https://dl.armbian.com/tinkerboard/archive/Armbian_5.41_Tinkerboard_Debian_stretch_default_4.4.119.7z 

Ubuntu

https://dl.armbian.com/tinkerboard/archive/Armbian_5.41_Tinkerboard_Ubuntu_xenial_default_4.4.119_desktop.7z

 

And I would suggest do merge this thread with the other

 

Link to comment
Share on other sites

1 hour ago, Chili N said:

 

Yes Tido, I had been to that page but kept getting the "hwclock: Cannot access the Hardware Clock via any known method" message. I still can't see what was wrong but I'd tried it on a fresh install with cut and paste from the pages eventually too but couldn't stop this error. I ended up using DS1307 instructions from a Pi page.

I only got a DS3231 working on a NanoPi Core2 via I2C, but it shouldnt with armbian much be the same if you got I2C enabled via armbian-config and if you did detect your clock with i2cdetect on the i2c-bus (on mine its the i2c-bus number 0).

Here some cli-snipptes from my electronic notice-sheet :)
 

i2c DS3231N Clock:
apt install i2c-tools
armbian-config: activate I2C-0
i2cdetect -y 0
(modprobe) rtc-ds1307  ==> /etc/modules

root@nanopi-core2(192.168.6.21):~# more /etc/modules
g_serial
rtc-ds1307

in /etc/rc.local:
echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device
hwclock -s

Once correct you can write the system date and time to the RTC module using :
sudo hwclock -w

You should be able to read the date and time back from the RTC using :
sudo date; hwclock -r

compare hwclock
sudo hwclock -c

NeoCore2 Mini Shield:
Number#	Name	        Number#	Name
1	SYS_3.3V	    	2	VDD_5V
3	I2C0_SDA / GPIOA12	4	VDD_5V
5	I2C0_SCL / GPIOA11	6	GND

https://www.raspberrypi-spy.co.uk/2015/05/adding-a-ds3231-real-time-clock-to-the-raspberry-pi/
https://manpages.debian.org/stretch/manpages-de/hwclock.8.de.html
https://www.youtube.com/watch?v=ND2shVqV9s4

echo "Updating time via ntp from ptbtime3.pt.de"
ntpdate -q ptbtime3.ptb.de
echo "writing actual time to hwclock..."
hwclock -w
echo "reading actual time from hwclock..."
date; hwclock -r

 

Link to comment
Share on other sites

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

Important Information

Terms of Use - Privacy Policy - Guidelines