Problem with SPI RTC DS3234 on RaspberryPi 2

John Whitmore arigead at gmail.com
Sat Apr 11 09:25:56 EDT 2015


I've had a problem for weeks with a development board I have used in the past
on the Original RaspberryPi. The expansion board has two spi devices
connected, a CAN Bus controller (MCP2515) and a Real Time Clock chip
DS3234. On the old RPi everything works great with two devices in:

    /sys/bus/spi/devices

    pi at can-rtc:~$ cat /sys/bus/spi/devices/spi0.0/modalias 
    spi:mcp2515
    pi at can-rtc:~$ cat /sys/bus/spi/devices/spi0.1/modalias 
    spi:ds3234

This output is exactly the same on the RPi-2 but the RPi-2 finds the RTC time
invalid:

    sudo hwclock -r
    hwclock: The Hardware Clock registers contain values that are either invalid (e.g. 50th day of month) or beyond.

The CAN Bus Controller does work on both versions of the RPi, it's just the
RTC that has a problem.

If connect up the Ethernet interface to get the correct time, from the
network, I can write it to the device with "hwclock -w". Then remove the
expansion board and power it up on the original RPi and it's got the correct
time which is sets as the system time. 

If I now remove it from the original RPi and connect to RPi-2 it can't read a
valid time. but it all seems the same.

    cat /sys/bus/spi/devices/spi0.1/rtc/rtc0/name 
    ds3234

In both cases I've compiled the ds3234 and mcp2515 drivers into the kernel. In
the original RPi the board file is edited to add the two devices but in the
RPi-2 a hardware overlay file is added. Like I say everything appears to be
exactly the same in both cases. Just the result is totally different.

Can anybody explain why there should be a difference? The GPIO headers in both
versions of the RPi are the same for the first set of pins. 

Original RPi kenel - 3.15.5
RPi-2 kernel       - 3.18.8






More information about the Kernelnewbies mailing list