recipe to make the RTC on BBB work

Hello,

Is there a recipe that works to install the RTC (DS3231/1307)? I googled and tried a lot of things but can not make it work. I succeeded on older Debian versions but now I am lost.
I have Debian 2018-10-07. The hw works as proved by i2cdetect -y -r 2. At address 0x68. “echo ds1307 0x68 >/sys/class/i2c-adapter/i2c-2/new_device” gives: permission denied.
Looks like I need to do something with overlay files? But uEnv.txt does not need to be modified, right? ls -al /dev/rtc*: only gives two entries for rtc0.
Please help.
Many thanks in advance,
Harke

Which DS* device? we have an overlay for both devices..

So assuming DS1307 and i2c2:

https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-I2C2-RTC-DS1307.dts

uboot_overlay_addr0=/lib/firmware/BB-I2C2-RTC-DS1307.dtbo

and this swaps the Beagle RTC0 with this one, so normal linux tools
will use the DS1307 as rtc0

If it doesn't work, please run and report:

sudo /opt/scripts/tools/version.sh

So we can see what's "old" with your setup..

Regards,

Thanks Robert for your attention. I replaced the line in uEnv.txt and it indeed installs the rtc. But it also uninstalled my display (4D Systems), so I outcommented it.

This is what I see with the line as recommended active:

debian@beaglebone:~$ ls -al /dev/rtc*
lrwxrwxrwx 1 root root 4 Feb 5 16:20 /dev/rtc → rtc1
crw------- 1 root root 252, 0 Feb 5 16:20 /dev/rtc0
crw------- 1 root root 252, 1 Feb 5 16:46 /dev/rtc1
debian@beaglebone:~$ sudo nano /boot/uEnv.txt-------> line outcommented

After reboot:

debian@beaglebone:~$ ls -al /dev/rtc*
lrwxrwxrwx 1 root root 4 Nov 3 2016 /dev/rtc → rtc0
crw------- 1 root root 252, 0 Nov 3 2016 /dev/rtc0

debian@beaglebone:~$ sudo /opt/scripts/tools/version.sh
git:/opt/scripts/:[1aa73453b2c980b75e31e83dab7dd8b6696f10c7]
eeprom:[A335BNLT00C02916BBBK1556]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Image 2018-10-07]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2018.09-00002-g0b54a51eee]:[location: dd MBR]
kernel:[4.14.71-ti-r80]
nodejs:[v6.14.4]
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
uboot_overlay_options:[dtb_overlay=/lib/firmware/BB-RTC-02-00A0.dtbo]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade ]
pkg:[bb-cape-overlays]:[4.4.20181106.0-0rcnee0~stretch+20181110]
pkg:[bb-wl18xx-firmware]:[1.20180517-0rcnee0~stretch+20180517]
pkg:[kmod]:[23-2rcnee1~stretch+20171005]
pkg:[librobotcontrol]:[1.0.4-git20181108.0-0rcnee0~stretch+20181110]
pkg:[firmware-ti-connectivity]:[20170823-1rcnee1~stretch+20180328]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal i2c bluetooth netdev cloud9ide gpio pwm eqep admin spi tisdk weston-launch xenomai]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait uboot_detected_capes=BB-BONE-LCD4-01, coherent_pool=1M net.ifnames=0 quiet]
dmesg | grep pinctrl-single
[ 1.134653] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
dmesg | grep gpio-of-helper
[ 1.146518] gpio-of-helper ocp:cape-universal: ready
END
debian@beaglebone:~$

Please advise.
Best regards,
Harke

Thanks Robert for your attention. I replaced the line in uEnv.txt and it indeed installs the rtc. But it also uninstalled my display (4D Systems), so I outcommented it.
This is what I see with the line as recommended active:

debian@beaglebone:~$ ls -al /dev/rtc*
lrwxrwxrwx 1 root root 4 Feb 5 16:20 /dev/rtc -> rtc1
crw------- 1 root root 252, 0 Feb 5 16:20 /dev/rtc0
crw------- 1 root root 252, 1 Feb 5 16:46 /dev/rtc1
debian@beaglebone:~$ sudo nano /boot/uEnv.txt-------> line outcommented

After reboot:

debian@beaglebone:~$ ls -al /dev/rtc*
lrwxrwxrwx 1 root root 4 Nov 3 2016 /dev/rtc -> rtc0
crw------- 1 root root 252, 0 Nov 3 2016 /dev/rtc0

Okay, so use addr4->7:

uboot_overlay_addr0=/lib/firmware/BB-I2C2-RTC-DS1307.dtbo
->
uboot_overlay_addr4=/lib/firmware/BB-I2C2-RTC-DS1307.dtbo

as addr0->addr3 also map to cape, so if you have an lcd plugged in
they can conflict..

debian@beaglebone:~$ sudo /opt/scripts/tools/version.sh
git:/opt/scripts/:[1aa73453b2c980b75e31e83dab7dd8b6696f10c7]
eeprom:[A335BNLT00C02916BBBK1556]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Image 2018-10-07]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2018.09-00002-g0b54a51eee]:[location: dd MBR]

That's too old..

sudo /opt/scripts/tools/developers/update_bootloader.sh

kernel:[4.14.71-ti-r80]
nodejs:[v6.14.4]
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
uboot_overlay_options:[dtb_overlay=/lib/firmware/BB-RTC-02-00A0.dtbo]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]
pkg:[bb-cape-overlays]:[4.4.20181106.0-0rcnee0~stretch+20181110]

That's too old..

sudo apt update ; sudo apt install --only-upgrade bb-cape-overlays

pkg:[bb-wl18xx-firmware]:[1.20180517-0rcnee0~stretch+20180517]
pkg:[kmod]:[23-2rcnee1~stretch+20171005]
pkg:[librobotcontrol]:[1.0.4-git20181108.0-0rcnee0~stretch+20181110]
pkg:[firmware-ti-connectivity]:[20170823-1rcnee1~stretch+20180328]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal i2c bluetooth netdev cloud9ide gpio pwm eqep admin spi tisdk weston-launch xenomai]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait uboot_detected_capes=BB-BONE-LCD4-01, coherent_pool=1M net.ifnames=0 quiet]
dmesg | grep pinctrl-single
[ 1.134653] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
dmesg | grep gpio-of-helper
[ 1.146518] gpio-of-helper ocp:cape-universal: ready
END
debian@beaglebone:~$

Regards,

Robert, following all of your advise: it works. Thanks a lot! I have installed rtc’s on about 7 BBB’s the last 5 years and it always was a challenge. Mainly because the procedure changed a lot. In addition, I added an rtc service and the Beagle now shows the right time even when not connected to the internet. I still feel a newbie, though.
Thanks again, best regards,
Harke