Pcf8563 - RTC on daughter board

Hello Jetson community,

I’ve recently migrated from the Hardkernel Odroid-C2, and was wondering if anyone has experience using a real-time clock that’s connected to a daughter board rather than soldering the coin cell holder to J45.

What I’m using
1 x Jetson Nano Developer Kit
1 x CR2032 coin-cell battery
1 x pcf8563 (datasheet available here)

Current configuration
In my current configuration, I have the 40-pin gpio of the nano connected to a custom pcb via a ribbon cable. Accessible on that board is the pcf8563.

The pcf8563 is connected to i2c-1 and is detectable using i2cdetect at address 0x51

root@jetson-nano-qspi-sd:~# i2cdetect -r -y 1
0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- 27 -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- 38 -- -- -- 3c -- -- --
40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- --
50: -- 51 -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

I’m currently using a custom image created using meta-tegra and the Yocto Project, but also have the provided Ubuntu image from NVIDIA as well. I have access to hwclock, modprobe, timedatectl, and all the general command and packages needed for the clock. So for sake of conversation, let’s just say I’m using the ubuntu image.

Thoughts and what I’ve done so far
Since the specific rtc is covered in mainline I feel like it shouldn’t be too out of the ordinary to set up.

I went ahead and checked for the clock. Good it works.

I went and tested hwclock -r and datetimectl to attempt setting the clock. Overall it’s going well.

Mainly I’ve just not seen any specific guides for this chip and wanted to know if other developers or the team had a guide or process to enabling this. As I intend to migrate off of the developer kit and simply use the nano module, I’d like to avoid using J45 (the custom pcb has to be industrial-rated, etc.)

Hoping there’s not too much work needed. I’m simply looking to be able to set the datetime, have it persist through reboots, and play nice with the nano so I can configure the clock in my custom image.

Thanks!

Is this a experience share without question?

Sorry for the format. There is in fact a question:

Does any developer have experience or is their documentation on using an external RTC-module connected to the i2c-bus? Rather than solder the battery holder onto the nano devkit, I’d like to use an RTC circuit that utilizes the pcf8563. The ultimate goal is to use the nano module and not the development kit, so this is a big requirement.

@bsmerbeck
We don’t have any document for this. But I think you can try to implement a kernel driver for it.

Shane,

Thanks for the heads up. There’s kernel support for the RTC in the mainline, and within the kernel version in which I’m working. I went ahead and enabled the driver using menuconfig. After doing this, I noticed a folder appear in /sys/bus/i2c/drivers as `/sys/bus/i2c/drivers/rtc-pcf8563.

Checking the i2c interface, the area didn’t show the kernel had taken control of the device (noted as “UU” on i2cdetect). Rather, it was still the normal address responding (0x51).

I took the .dtb and viewed it as a .dts, and there wasn’t anything for the pcf8563. Rather, I saw this:

rtc {
            compatible = "nvidia,tegra-rtc";
            reg = <0x0 0x7000e000 0x0 0x100>;
            interrupts = <0x0 0x2 0x4>;
            status = "okay";
            nvidia,pmc-wakeup = <0x37 0x1 0x10 0x4>;
    };

Looking up the pcf8563, I found a text document showing how it might be added to the device tree:

* Philips PCF8563/Epson RTC8564 Real Time Clock
Philips PCF8563/Epson RTC8564 Real Time Clock

Required properties:
- compatible: Should contain "nxp,pcf8563",
    "epson,rtc8564" or
    "microcrystal,rv8564"
    - reg: I2C address for chip.

Optional property:
    - #clock-cells: Should be 0.
    - clock-output-names:
          overwrite the default clock name "pcf8563-clkout"

Example:
pcf8563: pcf8563@51 {
    compatible = "nxp,pcf8563";
    reg = <0x51>;
    #clock-cells = <0>;
};
device {
    ...
    clocks = <&pcf8563>;
    ...
};

I’m not too well versed in kernel configuration, but what might be my next steps to enabling this within the image? I noticed the nano’s driver is currently enabled but am not sure how to replace/add the pcf8563 driver.

Thanks

You need to add the pcf8563 to the device and check the kernel message to check if it been loading/probe.

Thank you,

I’ve now gone to look at other posts on the forum, and I’ve seen that a Shottky diode is required on D64 for proper functionality of the RTC when using the J45 coin cell battery holder. For ease, I’ll be getting a diode and a battery holder and moving forward with this method as I was not able to get the I2C RTC module recognized by the system in my custom image.