Use DS3231 RTC with BBB


I’m connecting a DS3231 RTC from AdaFruit but am following the instructions for the 1307:

Should I follow these connections except connect the Vcc to the BBB P9-3 VDD_3V3B instead of P9-5 VCC_5V ?


Which adafruit module?


Adafruit DS3231 Precision RTC Breakout


Adafruit DS3231 Precision RTC Breakout

The datasheet for the DS3231 explains that this part is an “Extremely Accurate I²C-Integrated RTC/TCXO/Crystal”…



Okay, that one is safe to be plugged into v3.3

Then setup a U-Boot overlay like:

But with the correct port, and device name…

Then you’ll get it bootup as rtc0 and everything date/ntp/etc will just work, without any other special scripts…


I’m using the Adafruit RTC module that uses the DS3231 as well and had it working with a Beaglebone Black Wireless around a year ago, but it’s been on the shelf until yesterday. I had expected to bring it out, hook it up, and get back to using it, but it’s not being seen on I2C2 at address 0x68 using i2cdetect. And the code that worked isn’t working now. Something has changed, but I’ve not changed the code and double-checked my connections. Power is P9_4, ground is P9-2, SDA is P9_20 and SCL is P9_19. I’ve double-checked these connections with an ohmmeter back to the actual chip pins. The dts I am using is listed below. When I look through this, it seems this RTC should become rtc0 once the overlay loads. Am I reading this correctly? I’ve ordered a second module in case this one has bitten the dust while in storage. The battery reads 3V and change so I think that’s good. output follows the dts listing

 * Copyright (C) 2019 Tomas Arturo Herrera Castro <>
 * Based on BB-I2C2-RTC-DS1338.dts:
 * Copyright (C) 2018 Tim Small <>
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 * This was code was writen by Chilean Software and Hardware developer
 * company Southern Lake Technologies for a custom-made datalogger.
 * compiled using: dtc -O dtb -o BB-I2C2-RTC-DS3231.dtbo -b 0 -@ BB-I2C2-RTC-DS3231.dts
 * tested on element14 BeagleBone Industrial


        compatible = "ti,beaglebone", "ti,beaglebone-black", "ti,beaglebone-green";

        /* identification */
        part-number = "BB-DS3231";
        version = "00A0";

        #address-cells = <1>;
        #size-cells = <0>;   

         * Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
        fragment@0 {
                __overlay__ {

                        chosen {
                                overlays {
                                       BB-I2C2-RTC-DS3231 = __TIMESTAMP__;

        fragment@1 {
                __overlay__ {
                        aliases {
                                rtc0 = &extrtc;
                                /* The OMAP RTC implementation in the BBB is
                                 * buggy, so that it cannot be used as a
                                 * battery-backed RTS, so that it loses its
                                 * contents when power is removed from the
                                 * Beaglebone...
                                 * We move the omap built-in RTC to rtc1, so
                                 * that userspace defaults to using the DS1338.
                                 * The omap RTC must remain enabled because it
                                 * is also used during the reboot process on the
                                 * BBB.
                                rtc1 = "/ocp/rtc@44e3e000";

        fragment@2 {
                target = <&i2c2>;
                __overlay__ {
                        status = "okay";
                        #address-cells = <1>;
                        #size-cells = <0>;

                        extrtc: ds3231@68 {
                                compatible = "maxim,ds3231";
                                reg = <0x68>;

Output of version.h

dogtag:[ Debian Buster IoT Image 2020-04-06]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2019.04-00002-g07d5700e21]:[location: dd MBR]
UBOOT: Booted Device-Tree:[am335x-boneblack-uboot-univ.dts]
UBOOT: Loaded Overlay:[AM335X-PRU-RPROC-4-19-TI-00A0]
UBOOT: Loaded Overlay:[BB-ADC-00A0]
UBOOT: Loaded Overlay:[BB-BBBW-WL1835-00A0]
UBOOT: Loaded Overlay:[BB-BONE-eMMC1-01-00A0]
UBOOT: Loaded Overlay:[BB-HDMI-TDA998x-00A0]
UBOOT: Loaded Overlay:[BB-I2C2-RTC-DS3231]
UBOOT: Loaded Overlay:[BB-W1-P9.12-00A2]
/boot/uEnv.txt Settings:
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal bluetooth netdev i2c gpio pwm eqep remoteproc admin spi iio docker tisdk weston-launch xenomai cloud9ide]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet]
dmesg | grep remote
[   11.181690] remoteproc remoteproc0: is available
[   11.201529] remoteproc remoteproc1: is available
[   65.032537] remoteproc remoteproc2: wkup_m3 is available
[   65.606501] remoteproc remoteproc2: powering up wkup_m3
[   65.606536] remoteproc remoteproc2: Booting fw image am335x-pm-firmware.elf, size 217168
[   65.606831] remoteproc remoteproc2: remote processor wkup_m3 is now up
dmesg | grep pru
[   11.181690] remoteproc remoteproc0: is available
[   11.181874] pru-rproc PRU rproc node pru@4a334000 probed successfully
[   11.201529] remoteproc remoteproc1: is available
[   11.201717] pru-rproc PRU rproc node pru@4a338000 probed successfully
dmesg | grep pinctrl-single
[    0.930296] pinctrl-single 44e10800.pinmux: 142 pins, size 568
dmesg | grep gpio-of-helper
[    0.943564] gpio-of-helper ocp:cape-universal: ready
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

yeah it should, what does:

dmesg | grep rtc


dmesg | grep ds3


dmesg | grep rtc output

debian@beaglebone:/var/lib/cloud9$ dmesg |grep rtc
[    1.347129] rtc-ds1307 2-0068: SET TIME!
[    1.349698] rtc-ds1307 2-0068: registered as rtc0
[    1.353020] omap_rtc 44e3e000.rtc: registered as rtc1
[    1.642717] [drm] Cannot find any crtc or sizes
[    1.672588] rtc-ds1307 2-0068: setting system clock to 2000-01-01 00:56:42 UTC (946688202)
[    2.664185] [drm] Cannot find any crtc or sizes
[   58.182319] PM: bootloader does not support rtc-only!

dmesg | grep ds3 did not output anything

It’s working correctly, set as rtc0…

I forget the command, but systemd-timesync should properly set the Time eventually if you just let it idle…

edit: maybe:

sudo hwclock -w


Got it. Thank you!

I was trying to work with it as an I2C device using C and not finding the device. I could swear the code used to work, so I don’t know what’s wrong. Could it be that the overlay takes over the RTC, so it doesn’t show up as an I2C device anymore? That would be just fine with me - better really.

This is normal, by using the overlay, the kernel has full control over the device, so in i2c-tools it should show up as “UU”…


I’m used to seeing UU and have that at address 0x50. But the clock is at 0x68 and there’s nothing there. I even ran the tools on all three buses just to be sure I wasn’t mistaking the bus it’s connected to.