RTC Module DS3231 Not detecting in Rock3A V1.31

Dear Team,

I have connected the DS3231 RTC module to my Rock3A V1.31. The pin configuration is
Pin 3 - VCC
Pin 4 - GND
Pin 27 - SDA
Pin 28 - SCL

But my DS3231 RTC module is not detecting in my rock3a device,
i have tired with following commands
(venv) root@rock-3a:/home/rock/theiox_api# i2cdetect -y 2
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – -- – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- – -- – -- – -- – -- – -- – -- – --
30: – -- – -- – -- – -- – -- – -- – -- – --
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – -- – -- – -- – -- – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --
(venv) root@rock-3a:/home/rock/theiox_api# i2cdetect -y 6
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – -- – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- – -- – -- – -- – -- – -- – -- – --
30: 30 – -- – -- – -- – -- – -- – -- – -- –
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – -- – -- – -- – -- – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --
(venv) root@rock-3a:/home/rock/theiox_api# i2cdetect -y 5
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – -- – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- – -- – -- – -- – -- – -- – -- – --
30: – -- – -- – -- – -- – -- – -- – -- – --
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – 51 – -- – -- – -- – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --
(venv) root@rock-3a:/home/rock/theiox_api# i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – -- – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- UU – -- –
20: UU – -- – -- – -- – -- – -- – -- – -- –
30: – -- – -- – -- – -- – -- – -- – -- – --
40: – -- – -- – -- – -- – -- – -- – -- – --
50: 50 51 52 53 54 55 56 57 – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --
(venv) root@rock-3a:/home/rock/theiox_api# i2cdetect -y 1
Error: Could not open file /dev/i2c-1' or /dev/i2c/1’: No such file or directory
(venv) root@rock-3a:/home/rock/theiox_api# i2cdetect -y 2
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – -- – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- – -- – -- – -- – -- – -- – -- – --
30: – -- – -- – -- – -- – -- – -- – -- – --
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – -- – -- – -- – -- – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --
(venv) root@rock-3a:/home/rock/theiox_api# i2cdetect -y 3
Error: Could not open file /dev/i2c-3' or /dev/i2c/3’: No such file or directory

Hi @Karthik_R_P

PIN 27 —> I2C1-SDA
PIN 28 —> I2C1-SCL

If you are using the system published on our website:https://github.com/radxa-build/rock-3a/releases/download/b25/rock-3a_debian_bullseye_xfce_b25.img.xz

The I2C-1 device is not turned on by default, you need to turn it on through overlays in rsetup, please refer to the following documentation:
https://docs.radxa.com/en/rock3/rock3a/os-config/rsetup#overlays

1 Like

Dear @Mitchell ,

We are using the official build rock-3a-ubuntu-focal-server-arm64-20221101-0219-gpt.img.xz
I hope same as debian, i2c is not enabled here too.

Could you please confirm it, and help us to enable the I2C.

Kernal Version ;- 4.19.193-67-rockchip-g450948183988

Let us know for any additional information required. Thanks.

Hi @VigneshG247

Please send me links to the image your use.

Hi @Mitchell

Link :- https://github.com/radxa-build/rock-3a/releases/tag/20221101-0101
Build :- rock-3a-ubuntu-focal-server-arm64-20221101-0219-gpt.img.xz

I know this is from an older build, but do share your thoughts on it.

It doesn’t make sense to me:

deoptim@rock-3a:~$ zcat /proc/config.gz | grep CONFIG_RTC_DRV_DS1307
# CONFIG_RTC_DRV_DS1307 is not set
deoptim@rock-3a:~$

If you have CONFIG_RTC_DRV_DS1307=m or y, than need to create an user overlay to turn-on i2c1 also need to use 32K or SQW pin from DS3231 to one more gpio on SBC as interrupt (tick 32khz) and wakeup-source.

deoptim@rock-3a:~$ sudo i2cdetect 1
[sudo] password for deoptim:
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-1.
I will probe address range 0x08-0x77.
Continue? [Y/n] y
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- 57 -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
deoptim@rock-3a:~$
rtc-ds1307.yaml
# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/rtc/rtc-ds1307.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Dallas DS1307 and compatible RTC

maintainers:
  - Alexandre Belloni <alexandre.belloni@bootlin.com>

properties:
  compatible:
    oneOf:
      - enum:
          - dallas,ds1307
          - dallas,ds1308
          - dallas,ds1337
          - dallas,ds1338
          - dallas,ds1339
          - dallas,ds1388
          - dallas,ds1340
          - dallas,ds1341
          - maxim,ds3231
          - st,m41t0
          - st,m41t00
          - st,m41t11
          - microchip,mcp7940x
          - microchip,mcp7941x
          - pericom,pt7c4338
          - epson,rx8025
          - isil,isl12057
          - epson,rx8130

      - items:
          - enum:
              - st,m41t00
          - const: dallas,ds1338

  reg:
    maxItems: 1

  interrupts:
    minItems: 1
    maxItems: 2

  interrupt-names:
    maxItems: 2

  "#clock-cells":
    const: 1

  clock-output-names:
    description: From common clock binding to override the default output clock name.

  wakeup-source:
    description: Enables wake up of host system on alarm.

  vcc-supply: true

allOf:
  - $ref: rtc.yaml
  - if:
      properties:
        compatible:
          contains:
            enum:
              - dallas,ds1339
              - dallas,ds1340
              - dallas,ds1388
    then:
      properties:
        trickle-resistor-ohms:
          description: Selected resistor for trickle charger. Should be specified if trickle
            charger should be enabled.
          enum: [ 250, 2000, 4000 ]

        trickle-diode-disable:
          description: Do not use internal trickle charger diode. Should be given if internal
            trickle charger diode should be disabled (superseded by aux-voltage-chargeable)
          deprecated: true

unevaluatedProperties: false

required:
  - compatible
  - reg

examples:
  - |
    i2c {
      #address-cells = <1>;
      #size-cells = <0>;

      rtc@68 {
        compatible = "dallas,ds1337";
        reg = <0x68>;
        interrupt-parent = <&gpio4>;
        interrupts = <20 0>;
        trickle-resistor-ohms = <250>;
      };
    };

Hi @VigneshG247

Unzip the rk3568-i2c1.zip file and you will get the rk3568-i2c1.dtbo file。 rk3568-i2c1.zip (577 Bytes)

Then copy the dtbo file to the /boot/dtbs/4.19.193-58-rockchip-gbac1feba87f0/rockchip/overlay/ directory on the board.

After that, add /dtbs/4.19.193-58-rockchip-gbac1feba87f0/rockchip/overlay/rk3568-i2c1.dtbo to the end of the fdtoverlays line in the /boot/extlinux/extlinux.conf file, and reboot. .

Hi @Mitchell,

Thanks for the file. As you instructed I have downloaded and added the dtbo file on the location, Please refer to the snaps below. But still I am unable to use the DS3231 module. I’ve connected it on PIN 28 and 27, and used below commands to check it, But not working, Can you please help me with this.

image

Am I missing anything in the overlay configuration ??

$ ls /dev/i2c-*
/dev/i2c-0 /dev/i2c-3 /dev/i2c-5 /dev/i2c-6

$ sudo i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – -- – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- UU – -- –
20: UU – -- – -- – -- – -- – -- – -- – -- –
30: – -- – -- – -- – -- – -- – -- – -- – --
40: – -- – -- – -- – -- – -- – -- – -- – --
50: 50 51 52 53 54 55 56 57 – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --

sudo i2cdetect -y 3
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – -- – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- – -- – -- – -- – -- – -- – -- – --
30: – -- – -- – -- – -- – -- – -- – -- – --
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – -- – -- – -- – -- – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --

$ sudo i2cdetect -y 5
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – -- – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- – -- – -- – -- – -- – -- – -- – --
30: – -- – -- – -- – -- – -- – -- – -- – --
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – UU – -- – -- – -- – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --

$ sudo i2cdetect -y 6
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – -- – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- – -- – -- – -- – -- – -- – -- – --
30: 30 – -- – -- – -- – -- – -- – -- – -- –
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – -- – -- – -- – -- – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --

Please support on this, Thanks.

@VigneshG247 I think the system boots the 4.19.193-67 kernel, but the 4.19.193-58 kernel, but you didn’t add the I2C1 DTBO to the 4.19.193-67 kernel.

Hi @Mitchell,

Thanks a lot for your support, device can able to detect the module.

Also, I was wondering what was that rk3568-i2c1.zip file? and why it was not in-build with the OS ? Can you please explain this ?

It is an overlay of I2C1, you can refer to the:https://github.com/radxa-pkg/radxa-overlays/blob/main/arch/arm64/boot/dts/rockchip/overlays/rk3568-i2c1.dts

It may not have been integrated in older operating systems, our newer systems have integrated i2c1 related overrides.