WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: DS3231N rtc on PiCore 8 beta 5 not working  (Read 2733 times)

Offline joeysr20det

  • Newbie
  • *
  • Posts: 9
DS3231N rtc on PiCore 8 beta 5 not working
« on: September 20, 2016, 12:20:08 PM »
I've setup my DS3231N RTC module on prior versions of PiCore without issue, but I don't seem to be able to get it to work on PiCore 8 beta 5. I've followed the instructions from another post but I don't seem to be able to get it working:

http://forum.tinycorelinux.net/index.php/topic,17608.msg105734.html

I've run tce and installed the rtc-4.4.20-piCore+.tcz package to obtain the RTC kernel modules.

When I run sudo hwclock I get:

Code: [Select]
tc@box:~$ sudo hwclock
hwclock: can't open '/dev/misc/rtc': No such file or directory

When I run sudo i2cdetect -y 1 I get:

Code: [Select]
tc@box:~$ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
tc@box:~$

So I know the module is there on the i2c bus and responding. I've issued a few commands to get the temperature and haven't had any issues. Finally I've followed the bit from the previous post mentioned above:

Code: [Select]
tc@box:~$ sudo modprobe i2c-bcm2708
tc@box:~$ echo ds1307 0x68 | sudo tee /sys/class/i2c-adapter/i2c-1/new_device
ds1307 0x68
tc@box:~$ sudo hwclock
hwclock: can't open '/dev/misc/rtc': No such file or directory
tc@box:~$

I've made sure the i2c-bcm2708 module is loaded (it's being loaded already anyway) and issued the line to set my RTC device in new_device, but I still have errors when I run sudo hwclock. I've verified that I do not have a /dev/misc/rtc. Just for grins, I've done a fresh reboot and then:

Code: [Select]
sudo modprobe -r i2c-bcm2708
sudo modprobe i2c-bcm2708
echo ds1307 0x68 | sudo tee /sys/class/i2c-adapter/i2c-1/new_device

just to make sure the module is unloaded and freshly re-loaded before registering my device but this hasn't seemed to help. Also, I've tried the device register line as:

Code: [Select]
echo ds3231 0x68 | sudo tee /sys/class/i2c-adapter/i2c-1/new_device

just to see if the device id made a difference. Again, in the previous post the user was using a DS3231N and had success registering as a DS1307. Either way this hasn't worked for me.

I don't remember having to load any other modules in the past to get this to work. I know over on Raspbian, you have to load the rtc-ds1307 module to get the RTC working over there, but I don't see any other RTC related modules in the TC PiCore repo.

Any suggestions? Any help would be greatly appreciated. This is the very last step to my project and I've been stuck on it for over a week.

On another note, PiCore 8 beta 5 have been very stable and I've had no issues with the 100 or packages I've pulled down (other than this RTC).

Thanks in advance. Sorry for such a large post; just want to make sure I cover all the details.
Tiny core rocks!

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1079
Re: DS3231N rtc on PiCore 8 beta 5 not working
« Reply #1 on: September 20, 2016, 01:56:39 PM »
piCore 8.0 Beta 5 is based on a 4.4.19 kernel, so that 4.4.20 module pack is doing nothing, please update to the official 8.0 release, as that is the release that is 4.4.20 kernel.

The number reported via i2cdetect is a hardware response on the buss, it does not mean a driver is loaded for the specific device.    Once you attach a driver to it, it should report as UU or something similar.

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: DS3231N rtc on PiCore 8 beta 5 not working
« Reply #2 on: September 20, 2016, 03:03:09 PM »
In many cases you must enable Device Tree Overlay in config.txt For details read /mnt/mmcblk0p1/overlays/README

In your case read i2c-rtc section.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline joeysr20det

  • Newbie
  • *
  • Posts: 9
Re: DS3231N rtc on PiCore 8 beta 5 not working
« Reply #3 on: September 20, 2016, 07:12:16 PM »
Paul,

Ah... Yeah i missed that... Amateur hour. Sorry about that. I didn't realize PiCore 8 had been officially released. The downloads page for stable releases is still pointing to release 7:

http://tinycorelinux.net/ports.html

I'll pull down 8 and post back my results. Thanks so much for the quick reply!

Bmarkus,

I was thinking that may be the case. I added to my config.txt:

Code: [Select]
dtoverlay=i2c-rtc,ds3231
but as Paul pointed out, the kernel module wasn't doing anything for me anyway :) The overlay didn't make any change.

I'll post back what I find to get this module working.

BTW guys, does the Tiny Core project have a way to make donations? I didn't see anything anywhere. Don't have much to give, but I'd like to toss some this way. I'm a big fan of TC :)
Tiny core rocks!

Offline joeysr20det

  • Newbie
  • *
  • Posts: 9
Re: DS3231N rtc on PiCore 8 beta 5 not working
« Reply #4 on: September 20, 2016, 08:43:32 PM »
Awesome. I updated to the official PiCore 8 release, installed the rtc-4.4.20-piCore+.tcz package and then:

Code: [Select]
tc@box:~$ sudo modprobe i2c-bcm2708
tc@box:~$ echo ds3231 0x68 | sudo tee /sys/class/i2c-adapter/i2c-1/new_device

And finally!

Code: [Select]
tc@box:~$ sudo hwclock
Sat Jan 1 23:47:50 2000  0.000000 seconds

So at this point everything is working, so I needed to first update the system time on the Pi Zero and then set the time initially on my RTC so I ran:

Code: [Select]
sudo getTime.sh
sudo hwclock -w

Now my system clock was set and on RTC is also set. All that was needed to do to make my Pi synchronize the system clock on boot was to edit /opt/bootlocal.sh and add the lines:

Code: [Select]
modprobe i2c-bcm2708
echo ds3231 0x68 | tee /sys/class/i2c-adapter/i2c-1/new_device
hwclock -s

Finally, I made a backup of my changes so they would survive a reboot:

Code: [Select]
sudo filetool.sh -b

Now every time my Pi boots, it syncs it's system clock from the RTC. Just wanted to share the step by step for anyone that needs it.

Thanks again Paul and Bmarkus for your time and pointers; very much appreciated. Don't forget to post that donate link if you have one :)
« Last Edit: September 20, 2016, 08:45:18 PM by joeysr20det »
Tiny core rocks!

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10962
Re: DS3231N rtc on PiCore 8 beta 5 not working
« Reply #5 on: September 21, 2016, 01:09:31 AM »
BTW guys, does the Tiny Core project have a way to make donations? I didn't see anything anywhere. Don't have much to give, but I'd like to toss some this way. I'm a big fan of TC :)

I'm afraid we don't have one at the moment, due to legal reasons. Of course if you get a hardcopy of the book from your local bookstore, part of that goes to pay for the server and domains.
The only barriers that can stop you are the ones you create yourself.

Offline joeysr20det

  • Newbie
  • *
  • Posts: 9
Re: DS3231N rtc on PiCore 8 beta 5 not working
« Reply #6 on: September 21, 2016, 08:11:46 AM »
That's a shame; legalities are such a pain.

I'll go grab a copy of that now. Probably help fill in a couple of those knowledge gaps I have :)

Thanks again everyone.
Tiny core rocks!