Adding a peripheral real time clock with ncs 1.8.0 SDK over I2C

I'm trying to interface with the ds1339 real time clock to set and read the time for timestamping tasks in ncs 1.8.0.  I've found a few tutorials that boil down to:

1. add the dts child node under the i2c controller node: in my overlay file I changed to this:
&i2c1 {
    compatible = "nordic,nrf-twim";
    status = "okay";
    sda-pin = < 22 >;
    scl-pin = < 23 >;
    clock-frequency = <I2C_BITRATE_STANDARD>;  
    ds1339@68 {
        compatible = "maxim,ds1339";
        reg = <0x68>;
        label = "ds1339";
    };
};
My question here is: are the sda and scl pins in this overlay being defined on the 52dk I'm using?  So I then just need to connect my rtc pins to these pins?
2. create a binding
For this I went to ..\ncs\v1.8.0\zephyr\dts\bindings\rtc and added a .yaml file called maxim,ds1339 with contents:
description: Maxim DS1339 I2C RTC
compatible: "maxim,ds1339"
include: i2c-device.yaml
Is anything else needed here?

3. create a driver
This part was the most confusing.  I went to ..\ncs\v1.8.0\zephyr\drivers\counter which had a number of RTC drivers such as counter_mcux_rtc and counter_mcux_lpc_rtc which both seemed like they may work.  But I wasn't sure if this needed to be made specifically for my ds1339. 
Do I need to write a specific driver for my device?  How do I go about completing this section and what is needed to build and interface with the ds1339?
To my prj.config I added 
CONFIG_I2C=y
CONFIG_I2C_1=y
Is there anything else that I need to add to configure the drivers and I2C for the device?

Thanks
Parents Reply Children
No Data
Related