Enable i2c and install a RTC

How can we enable i2c and add a RTC module ?

Tagged:

Comments

  • I edited config.txt and saw i2c was enabled but it seems I can't instert the rtc_ds1307 module and it seems that /etc/modules isn't parsed like it should. And there is no modprobe either so how do we load kernel modules ?

  • @kalkov can you guys add the hwmon kernel module to your next build ? It's needed RTC-ds1307

  • insmod /boot/modules/rtc-ds1307.ko

  • edited June 2019
    I am trying to activate the RTC on my Raspberry Pi 3 B+. (DS1307 connected on the I2C port)
    I am getting an error when I check the new_device.
    The error is "/system/bin/sh : cat: new_device: I/O error"

    What is the correct procedure to make the RTC work ?
  • edited June 2019
    The /boot/config.txt contains the following entries related to I2C -

    dtparam=i2c1=on
    dtparam=i2c_arm=on
    dtoverlay=i2c-rtc,ds1307


    When i run the i2cdetect -y 1 command, I am able to see the memory location 68. But it is not turning to UU after running the echo command.
  • I've a similar problem with ds1307. If i do the insmod command the lines in the i2c tools turn UU but after that i type hwclock -r e.g. it says /dev/misc/rtc: no such file or directory. Any ideas? the config.txt is also edited. I tried the rtc-ds1307 < 0x68 /sys/class... command too.

  • My ds1307 works fine using just this line:
    dtoverlay=i2c-rtc,ds1307

    I did update all files in boot partition with files from latest raspbian; all except for uboot, kernel, of course.

  • Is there a way to add these commands at boot?
    Its working after doing insmod and making a symlink to rtc0, but it resets after boot.

  • You can put them in a sript and put that in /data/init.d/ so it gets executed at boot. Check the scripts already in there for the correct header and file permissions.

  • @SanderK said:
    You can put them in a sript and put that in /data/init.d/ so it gets executed at boot. Check the scripts already in there for the correct header and file permissions.

    Tried it. Didn't work.
    If i run it manually it work, but not automatically on boot.

  • edited February 2020

    Did you put the following header in the script and did you set the file permissions to 700?

    hash!/system/bin/sh

    hashhashhash BEGIN INIT INFO
    hash Exec: boot
    hash Type: permanent
    hashhashhash END INIT INFO

    (replace hash with a hash-symbol, I can't get it to show in markdown)

  • @SanderK said:
    Did you put the following header in the script and did you set the file permissions to 700?

    hash!/system/bin/sh

    hashhashhash BEGIN INIT INFO
    hash Exec: boot
    hash Type: permanent
    hashhashhash END INIT INFO

    (replace hash with a hash-symbol, I can't get it to show in markdown)

    Thanks, That worked!
    You're a life saver :)

  • When I set the clock system in Raspberry Pi through the operating system it does not update the RTC ds3231 os ver1.0
    i use bath file on init_d to update the clock system on boot .

  • my rtc work i can read the time with order hwclock -r or write new time to rtc my in linux level .
    my problem is when i set the clock time from the android user level not from the linux level.
    for example if i set the flag time sync from network it not change the clock time on the rtc device and when i turn off the RSP and turn on i lost the time clock .

  • When raspberry pi3 goes up it reads the time from the RTC
    But when I set the system clock it does not update the RTC

Sign In or Register to comment.