RTC on Beaglebone

Ok I have a DS3231 module working on the Beaglebone. Here is my overlay:

Code:
// Definitions for DS3231 I2C based Real Time Clock
/dts-v1/;
/plugin/;

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

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

                        ds3231: ds3231@68 {
                                compatible = "maxim,ds3231";
                                reg = <0x68>;
                                status = "okay";
                        };
                };
        };
        __overrides__ {
                ds3231 = <&ds3231>,"status";
        };
};
Save the above as /boot/dtb/ds3231.dts

Then compile from the /boot/dtb directory:
dtc -I dts -O dtb ds3231.dts -o ds3231.dtb

Use this to enable the dtb overlay:
/boot/loader.conf
Code:
fdt_overlays="ds3231.dtb,am335x-beaglebone-tscadc.dtb"
Notice that I already had the ADC enabled , So I added my RTC module

Wiring:
P9_1 =Ground
P9_3 =3.3V
P9_17=i2c1 SCL
P9_18=i2c1 SDA

root@beaglebone:~ # sysctl dev.ds3231
dev.ds3231.0.32khz_enable: 1
dev.ds3231.0.sqw_mode: interrupt
dev.ds3231.0.sqw_freq: 8192
dev.ds3231.0.bbsqw: 0
dev.ds3231.0.temp_conv: 0
dev.ds3231.0.temperature: 22.6C
dev.ds3231.0.%parent: iicbus1
dev.ds3231.0.%pnpinfo: name=ds3231@68 compat=maxim,ds3231
dev.ds3231.0.%location: addr=0xd0
dev.ds3231.0.%driver: ds3231
dev.ds3231.0.%desc: Maxim DS3231 RTC
dev.ds3231.%parent:
 
I did forget to mention you need to load the DS3231 driver. I compiled mine in statically.
I am pretty sure you could load the module dynamically as well in /boot/loader.conf
Code:
ds3231_load="YES"
 
Looks like I was wrong and the ds3231 driver cannot be dynamically loaded. Only statically compiled in the kernel.
The directory here has no make file for the module:
/usr/src/sys/modules
I assume you cannot just compile the ds3231.c file with a ko file extension. I wonder what is needed to make it dynamic kernel module.
 
Back
Top