WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: RTC DS1307 driver issue  (Read 805 times)

Offline syang

  • WikiUser
  • *
  • Posts: 4
RTC DS1307 driver issue
« on: June 16, 2017, 04:08:18 AM »
Setup
  • RPI 2 B+ and RPI3
  • piFace SHIM RTC (MCP7941x, DS1307 compatible)
  • piCore v9.0.1
  • Installed rtc-4.9.22-piCore-v7.tcz


Symptom
  • When trying load driver rtc-ds1307 by "sudo modprobe  rtc-ds1307", got "unknown symbol" error
  • dmesg showed the symbol name is "hwmon_device_register_with_group" implemented in hwmon.ko which is not included in piCore v9.0.1's default kernel drivers
  • In fact grep shows there are 3 drivers depending hwmon:
    Binary file input/touchscreen/ads7846.ko matches
    Binary file rtc/rtc-ds1307.ko matches
    Binary file rtc/rtc-rv3029c2.ko matches


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".




Offline Paul_123

  • Sr. Member
  • ****
  • Posts: 397
Re: RTC DS1307 driver issue
« Reply #1 on: June 16, 2017, 12: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

Offline syang

  • WikiUser
  • *
  • Posts: 4
Re: RTC DS1307 driver issue
« Reply #2 on: June 17, 2017, 12: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: newbielink:javascript:void(0); [nonactive]
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

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 6912
    • My Community Forum
Re: RTC DS1307 driver issue
« Reply #3 on: June 17, 2017, 12:48:10 AM »
Thanks for noting, will fix it.
Béla
Ham Radio callsign: HA5DI

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

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 6912
    • My Community Forum
Re: RTC DS1307 driver issue
« Reply #4 on: June 18, 2017, 06:25:49 AM »
hwmon.ko added to base in piCore-9.0.2, please update.
Béla
Ham Radio callsign: HA5DI

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

Offline syang

  • WikiUser
  • *
  • Posts: 4
Re: RTC DS1307 driver issue
« Reply #5 on: June 18, 2017, 05:37:57 PM »
That's quick ;D, thanks bmarkus!

Offline kmhill

  • WikiUser
  • *
  • Posts: 35
Re: RTC DS1307 driver issue
« Reply #6 on: September 01, 2017, 07: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.
« Last Edit: September 02, 2017, 05:36:31 AM by Rich »

Online Rich

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 5472
Re: RTC DS1307 driver issue
« Reply #7 on: September 01, 2017, 08:07:28 PM »
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.

Offline kmhill

  • WikiUser
  • *
  • Posts: 35
Re: RTC DS1307 driver issue
« Reply #8 on: September 02, 2017, 12: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.



Online Rich

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 5472
Re: RTC DS1307 driver issue
« Reply #9 on: September 02, 2017, 05: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.

Offline kmhill

  • WikiUser
  • *
  • Posts: 35
Re: RTC DS1307 driver issue
« Reply #10 on: September 02, 2017, 07: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... :-)

Offline kmhill

  • WikiUser
  • *
  • Posts: 35
Re: RTC DS1307 driver issue
« Reply #11 on: September 02, 2017, 08:53:11 AM »
Also, thanks Rich for editing the prior note

Offline kmhill

  • WikiUser
  • *
  • Posts: 35
Re: RTC DS1307 driver issue
« Reply #12 on: September 02, 2017, 05: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...

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 6912
    • My Community Forum
Re: RTC DS1307 driver issue
« Reply #13 on: September 02, 2017, 09:21:57 PM »
Did you remove nortc from command line?
Béla
Ham Radio callsign: HA5DI

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

Offline kmhill

  • WikiUser
  • *
  • Posts: 35
Re: RTC DS1307 driver issue
« Reply #14 on: September 03, 2017, 09:55:45 PM »
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.