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.
Version.sh output follows the dts listing
/*
* Copyright (C) 2019 Tomas Arturo Herrera Castro <taherrera@uc.cl>
*
* Based on BB-I2C2-RTC-DS1338.dts:
*
* Copyright (C) 2018 Tim Small <tim@seoss.co.uk>
*
* 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.
*
* http://www.sltech.cl
*
* compiled using: dtc -O dtb -o BB-I2C2-RTC-DS3231.dtbo -b 0 -@ BB-I2C2-RTC-DS3231.dts
*
* tested on element14 BeagleBone Industrial
*
*/
/dts-v1/;
/plugin/;
/{
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 {
target-path="/";
__overlay__ {
chosen {
overlays {
BB-I2C2-RTC-DS3231 = __TIMESTAMP__;
};
};
};
};
fragment@1 {
target-path="/";
__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>;
};
};
};
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!
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.
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.