OpenSprinkler Forums Hardware Questions OpenSprinkler Beagle (OSBo) Getting date to update from RTC on OSBo.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #41409


    My OSBo is not connected to the interent. I had troubles getting the date and time to be set correctly. I assumed this would automatically work but I was wrong. You have to do some extra configuration yourself to get this working.
    After some searching I found the existing wiki article here ( Unfortunately it wasn’t straight forward and I had some issues. There are a few posts from others having problems also, so I would like to share my learnings in getting a working solution.

    Issue 1:
    The command:
    sudo echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device
    returns error:
    -bash: /sys/class/i2c-adapter/i2c-1/new_device: Permission denied

    This command needs to be executed as the root user.

    Switch to the root user first.
    sudo su
    Then run the command.
    sudo echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device

    Note: this command can only be run successfully once per system session.
    If you try to execute the command again, you will get the error:
    echo: write error: Invalid argument
    This is ok, it just acknowledges that it has already been run successfully.

    Issue 2:
    You have added the commands to rc.local but it isn’t working.

    The rc.local script terminates because the ntpdate command fails and the rc.local script has the -e flag on the first line.

    This is probably best explained in this link:

    Put the commands in a separate script and call that script from rc.local.

    I created script:
    and set the permissions:
    chmod 775


    #below based on instructions from here:
    echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device
    ntpdate -b -s -u
    if [ $? -ne 0 ];then
            echo Setting system time from OSBo RTC
            hwclock --rtc /dev/rtc1 -s
            hwclock --rtc /dev/rtc0 -w
            echo Updating Internet time on OSBo RTC
            hwclock --rtc /dev/rtc1 -w
    #end Set_Up_BBB
    exit 0

    and then in rc.local:

    #!/bin/sh -e
    # rc.local
    # This script is executed at the end of each multiuser runlevel.
    # Make sure that the script will "exit 0" on success or any other
    # value on error.
    # In order to enable or disable this script just change the execution
    # bits.
    # By default this script does nothing.
    #update the system time from Internet or RTC
    /home/ubuntu/ > /tmp/rc_local__update_date.log 2>&1
    exit 0

    You can check to see that the system date got updated correctly:

    ubuntu@arm:~$ cat /tmp/rc_local__update_date.log
    Error resolving Name or service not known (-2)
    Setting system time from OSBo RTC

    Hopefully Ray will update the Wiki accordingly and until then this post helps instead.



    Thanks for posting the solution. Will update the Wiki asap. Unfortunately we’ve stopped selling OSBo, due to the rather small demand. We do still sell bare OSBo PCBs for anyone interested.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

OpenSprinkler Forums Hardware Questions OpenSprinkler Beagle (OSBo) Getting date to update from RTC on OSBo.