Jump to content

A20/BananaPi + SPI + DS3234 RTC on kernel 4.10


Recommended Posts

Finally got a SPI connected DS3234 RTC for my BananaPi working! :D

Main problem was that a patch is needed to get SPI master mode working reliably on A20: https://patchwork.kernel.org/patch/9567833/

 

@Igor/staff: it would make Armbian even better than it already is if you could apply this patch on all A20 boards B)

 

Setup:

BananaPi (bought back in 2015 so not exactly sure which "flavour" it is, specs are equal to BPI-M1)

DS3234 RTC (SparkFun DeadOn RTC Breakout DS3234)

Mainline kernel (4.10 currently)

Armbian build/devopment (of course ;))

Note: wiring and base of DTS according to Science Gizmo - Raspberry PI and your SPI Real Time Clock (RTC)

 

1. Wiring:

|| Banana Pi Pin || Banana Pi Name || DS3234 Module ||
||           25          ||           Ground      ||           GND           ||
||           17          ||        3v3 Power    ||           VCC           ||
||           23          ||           SCLK          ||           CLK           ||
||           21          ||           MISO          ||           MISO         ||
||           19          ||           MOSI          ||           MOSI         ||
||           24          ||           CS0             ||           SS             ||

 

2. Apply patch to make SPI master mode on A20 work correctly:

Download patch and put into userpatches/kernel/sunxi-next/: https://patchwork.kernel.org/patch/9567833/

 

3. Enable DS3232/DS3234 DTS overlay:

Download patch and put in userpatches/kernel/sunxi-next/: sun7i-a20-spi0-ds3232.patch

Don't forget to enable the DTS overlay in armbianEnv.txt:

overlays=sun7i-a20-spi0-ds3232

 

4. Enable "configure kernel" and make sure those are either compiled as module (<M>) or directly included in kernel (<*>) :
Device Drivers > SPI support > Allwinner A10 SoCs SPI controller

Device Drivers > Real Time Clock > Dallas/Maxim DS3232/DS3234

 

Compile kernel, install on BPI, reboot, make sure the modules are loaded and check it out:

root@bananapi:/# hwclock -r -f /dev/rtc1 --debug
hwclock from util-linux 2.29.1
Using the /dev interface to the clock.
Last drift adjustment done at 1489319708 seconds after 1969
Last calibration done at 1489319708 seconds after 1969
Hardware clock is on UTC time
Assuming hardware clock is kept in UTC time.
Waiting for clock tick...
...got clock tick
Time read from Hardware Clock: 2017/03/12 14:30:27
Hw clock time : 2017/03/12 14:30:27 = 1489329027 seconds since 1969
Time since last adjustment is 9319 seconds
Calculated Hardware Clock drift is 0.311040 seconds
2017-03-12 15:30:26.993872+0100

The following error showing up in kernel log does not seem to affect using the RTC:

Mar 12 15:37:02 localhost kernel: [ 9098.366586] rtc rtc1: __rtc_set_alarm: err=-22

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines