# DS3231 RTC on BananaPi



## Phishfry (Nov 12, 2016)

I have the DS3231 module running on an BananaPi. Here is how:

Add this to/src/sys/arm/conf/ALLWINNER

```
device      ds3231
```
This adds it to the kernel.

Then add the device to the device tree source  /src/sys/boot/fdt/dts/arm/bananapi.dts
Insert this at the bottom:

```
&i2c0 {
    rtc {
        compatible = "maxim,ds3231";
        reg = <0xd0>;
    };
};
```

Then run crochet and make an image to test:
`./crochet.sh -b BananaPi`

Then move to your /crochet/work directory and use dd to write image.
For example:
`dd if=FreeBSD-armv6-11.0-ALLWINNER-305354_308093M.img of=/dev/da0 bs=10240 conv=sync`


----------



## Phishfry (Nov 12, 2016)

dmesg output

```
iic0: <I2C generic I/O> on iicbus0
ds32310: <Maxim DS3231 RTC> at addr 0xd0 on iicbus1
iic1: <I2C generic I/O> on iicbus1
```


```
root@bananapi:~ # 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: 27.5C
dev.ds3231.0.%parent: iicbus1
dev.ds3231.0.%pnpinfo: name=rtc compat=maxim,ds3231
dev.ds3231.0.%location: addr=0xd0
dev.ds3231.0.%driver: ds3231
dev.ds3231.0.%desc: Maxim DS3231 RTC
dev.ds3231.%parent:
```


----------

