Tiny Core Linux

Tiny Core Base => Raspberry Pi => Topic started by: syang on June 16, 2017, 08:08:18 AM

Title: RTC DS1307 driver issue
Post by: syang on June 16, 2017, 08:08:18 AM
Setup


Symptom


Possible Fix
    Since so far I couldn't find an existed extension including hwmon drivers(I might miss something?), I've made/tested and submitted a new extension "hwmon-4.9.22-piCore-v7.tcz".



Title: Re: RTC DS1307 driver issue
Post by: Paul_123 on June 16, 2017, 04:37:07 PM
hwmon is a new requirement for some of the rtc modules in the 4.9 kernels.  I'm sure Bela will fix it.

For the record, there is an overlay to load the drivers.

Code: [Select]
Name:   i2c-rtc
Info:   Adds support for a number of I2C Real Time Clock devices
Load:   dtoverlay=i2c-rtc,<param>=<val>
Params: abx80x                  Select one of the ABx80x family:
                                  AB0801, AB0803, AB0804, AB0805,
                                  AB1801, AB1803, AB1804, AB1805

        ds1307                  Select the DS1307 device

        ds1339                  Select the DS1339 device

        ds3231                  Select the DS3231 device

        mcp7940x                Select the MCP7940x device

        mcp7941x                Select the MCP7941x device

        pcf2127                 Select the PCF2127 device

        pcf8523                 Select the PCF8523 device

        pcf8563                 Select the PCF8563 device

        trickle-diode-type      Diode type for trickle charge - "standard" or
                                "schottky" (ABx80x only)

        trickle-resistor-ohms   Resistor value for trickle charge (DS1339,
                                ABx80x)

        wakeup-source           Specify that the RTC can be used as a wakeup
                                source
Title: Re: RTC DS1307 driver issue
Post by: syang on June 17, 2017, 04:15:56 AM
hwmon is a new requirement for some of the rtc modules in the 4.9 kernels.  I'm sure Bela will fix it.

For the record, there is an overlay to load the drivers.

Code: [Select]
Name:   i2c-rtc
Info:   Adds support for a number of I2C Real Time Clock devices
Load:   dtoverlay=i2c-rtc,<param>=<val>
Params: abx80x                  Select one of the ABx80x family:
                                  AB0801, AB0803, AB0804, AB0805,
                                  AB1801, AB1803, AB1804, AB1805

        ds1307                  Select the DS1307 device

        ds1339                  Select the DS1339 device

        ds3231                  Select the DS3231 device

        mcp7940x                Select the MCP7940x device

        mcp7941x                Select the MCP7941x device

        pcf2127                 Select the PCF2127 device

        pcf8523                 Select the PCF8523 device

        pcf8563                 Select the PCF8563 device

        trickle-diode-type      Diode type for trickle charge - "standard" or
                                "schottky" (ABx80x only)

        trickle-resistor-ohms   Resistor value for trickle charge (DS1339,
                                ABx80x)

        wakeup-source           Specify that the RTC can be used as a wakeup
                                source

Thanks Paul, yes same RTC works on piCore 6 without hwmon installed, although I can use the ext for myself now but still would like to see it can be fixed in official repo.


Sent from my iPhone using Tapatalk
Title: Re: RTC DS1307 driver issue
Post by: bmarkus on June 17, 2017, 04:48:10 AM
Thanks for noting, will fix it.
Title: Re: RTC DS1307 driver issue
Post by: bmarkus on June 18, 2017, 10:25:49 AM
hwmon.ko added to base in piCore-9.0.2, please update.
Title: Re: RTC DS1307 driver issue
Post by: syang on June 18, 2017, 09:37:57 PM
That's quick ;D, thanks bmarkus!
Title: Re: RTC DS1307 driver issue
Post by: kmhill on September 01, 2017, 11:48:01 PM
Hi folks;

Just had some partial success with the DS1307. I bought the DS1307 breakout board from Adafruit, wired it to the RasPi-2B board that I have, as that has easy Internet access.

After manually configuring things, I entered at the terminal the command 'sudo hwclock -w' to set the time in the DS1307. Next, I used the editor to insert into the end of /opt/bootlocal.sh the following lines. Then keep the edit, I entered, "filetool.sh -b". After booting the RasPi 2B with no Internet, the command 'date' produces the correct time... good.

    modprobe rtc-ds1307
    echo ds1307 0x68 | sudo tee /sys/class/i2c-adapter/i2c-1/new_device
    hwclock -s

The issue is that after moving the micro-SD card to my RasPi-zero, the 'date' command produces the incorrect time. So...

o I double checked that the rtc-4.9.220piCore-v7.tcz is set for on-boot
o Next, in a terminal I entered, "sudo modprobe rtc-ds1307" and received the following error:

modprobe: module rtc-ds1307 not found in modules.dep

Not sure what's up or different between the boards. I suspect that I missed something minor. Your input will be appreciated.
Title: Re: RTC DS1307 driver issue
Post by: Rich on September 02, 2017, 12:07:28 AM
Hi kmhill
First you said:
Quote
    modprobe rtc-ds-1307
    echo ds1307 0x68 | sudo tee /sys/class/i2c-adapter/i2c-1/new_device
    hwclock -s
Then you say you get an error from:
Quote
o Next, in a terminal I entered, "sudo modprobe rtc-ds1307" and received the following error:

modprobe: module rtc-ds1307 not found in modules.dep

The second quote seems to have one less  dash  in the module name.
Title: Re: RTC DS1307 driver issue
Post by: kmhill on September 02, 2017, 04:09:19 AM
Thanks for catching the transcription error I made from /opt/bootlocal.sh. ... I went back and looked. The following are the lines that I inserted at the end. Now I'm not sure at the moment how to go back and edit or delete the prior note.

    modprobe rtc-ds1307
    echo ds1307 0x68 | sudo tee /sys/class/i2c-adapter/i2c-1/new_device
    hwclock -s

In any case, the RasPi-2B boots with the correct time from the RTC. The RasPi-zero doesn't.


Title: Re: RTC DS1307 driver issue
Post by: Rich on September 02, 2017, 09:41:35 AM
Hi kmhill
Quote
Now I'm not sure at the moment how to go back and edit or delete the prior note.
The extra  dash  has been removed from your post. After about 30 minutes posts become locked so you cannot make any
more changes.
Title: Re: RTC DS1307 driver issue
Post by: kmhill on September 02, 2017, 11:24:13 AM
Okay, think I have a clue. I do have a USB hub, but given that I don't yet have a USB2-ethernet adapter or have wifi setup for the RasPi-zero, out of convenience, I thought it might be easier to set things up using another machine. In looking at the repo, I see there are two rtc-4.9.22-piCore TCZ files... One for the arm6 and another for the arm7.

Apologies to everyone, I suspect this topic may have been discussed before. Now, I'm off to the store... :-)
Title: Re: RTC DS1307 driver issue
Post by: kmhill on September 02, 2017, 12:53:11 PM
Also, thanks Rich for editing the prior note
Title: Re: RTC DS1307 driver issue
Post by: kmhill on September 02, 2017, 09:44:51 PM
Change of plans... I manually moved .tcz files. The RTC almost works with the RasPi zero. The odd thing is that following boot, the "hwclock" shows the RTC time but the date command doesn't.  Here are the latest steps I took:

(1) downloaded the rtc-4.9.22-piCore.tcz* files from the following URL and put them into a compressed tar file using my desktop Linux machine
http://distro.ibiblio.org/tinycorelinux/9.x/armv6/tcz/

(2) I used a USB Flash drive to move the compressed tar file to the RasPi-zero, where I unpacked the file to the "optional" folder. Then I inserted into the onboot.lst file, the line " rtc-4.9.22-piCore.tcz", then did the backup.

(3) I noticed that the bootlocal.sh file already has the "hwclock -s" command to set the system time from the RTC, but it doesn't take. But then when I type in the same command as "sudo hwclock -s" the system takes the time.

Perhaps a short delay would help the RasPi-zero along? I'm not sure how to do that...
Title: Re: RTC DS1307 driver issue
Post by: bmarkus on September 03, 2017, 01:21:57 AM
Did you remove nortc from command line?
Title: Re: RTC DS1307 driver issue
Post by: kmhill on September 04, 2017, 01:55:45 AM
Hi Bela;

Before your note I had not removed nortc from cmdline.txt.

In looking about the TinyCore page I saw two reports, one said that the keyword nortc directs a system to set the time and date from an Internet time server. Without the keyword nortc the system should load time from an RTC. I also saw a report of a system that wouldn't boot without the code. So, I'm wondering maybe the nortc code is a carry-over from the x86 distro that doesn't make sense for the RasPi-zero?

In any case, my RasPi-zero appears to want the nortc code. Without the nortc code the system locks up on the raspberry page. I tried this twice. I noticed that in booting the RasPi-zero only one raspberry appears on the screen.
Title: Re: RTC DS1307 driver issue
Post by: kmhill on September 04, 2017, 03:00:40 AM
Okay, I just tried having a sleep delay in and the RasPi-zero appears to be booting with the correct time. The edited code is as follows.

    modprobe rtc-ds1307
    echo ds1307 0x68 | sudo tee /sys/class/i2c-adapter/i2c-1/new_device
    sleep 1s
    hwclock -s

I'm not fully happy with it... resetting the RTC is a somewhat of a pain.