RTC reset after Beaglebone boot

Hello,
I have intefaced RTC DS1307 with Beaglbone. However, after the beaglebone boots up, its time is reset and RTC takes this reset time. Use of NTP would not be feasible since Beaglebone would be used in a remote location with no internet connection. What would be the solution to this issue ?

Ritisha

There’s a reasonably easy hack:
https://learn.adafruit.com/adding-a-real-time-clock-to-beaglebone-black/set-rtc-time

A proper solution would probably involve a kernel change to replace the default RTC device (which is currently the chip’s nearly useless internal one at /dev/rtc0). I’d love to figure out how that works, as I need to do the same thing.

As of this week, we have an easy solution. (using u-boot overlays of
course), the trick is the rtc "aliases", so that the ds1307 gets rtc0

Seee either :

https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-I2C1-MCP7940X-00A0.dts

or:

https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-I2C2-PCF8523-00A0.dts

Regards,

and here's it working: (eth is disconnected)

debian@beaglebone:~$ dmesg | grep rtc
[ 1.594096] omap_rtc 44e3e000.rtc: already running
[ 1.594335] omap_rtc 44e3e000.rtc: rtc core: registered 44e3e000.rtc as rtc1
[ 1.776976] rtc-ds1307 1-0068: registered as rtc0
[ 1.795900] rtc-ds1307 1-0068: setting system clock to 2017-09-14
17:01:12 UTC (1505408472)

Regards,

You could also set time on the second rtc during setup after updating the time via nap date then just run a script at boot, and occasionally (once a day?) Using a system timer.

With the new fix Robert implemented. .
Probably more hassle than it’s worth , but it’s not that difficult, and it works.

Very interesting. Which version of the kernel implements this?

Right now v4.9.x+ only, still need to look into backporting the change
that enabled the rtc alisas to work..

Regards,

debian@test-bbb-4:/opt/source/bb.org-overlays$ make
src/arm/BB-I2C2-PCF8523-00A0.dtbo
  DTC src/arm/BB-I2C2-PCF8523-00A0.dtbo
debian@test-bbb-4:/opt/source/bb.org-overlays$ /usr/bin/dtc --version
Version: DTC 1.4.4

I'm guessing your dtc is too old...

Regards,