To Enable RTC in torizon linux 7.3.0, device-tree toradex_6.6-2.2.x-imx

Hi All,
We are updating our platform from torizon linux 5.7.2 to torizon linux 7.3.0.(colibri-imx8x)
As a part of it have integrated the changes related to our platform into the compatible device-tree toradex_6.6-2.2.x-imx.
But after booting to the linux we got the below error.

dmesg | grep rtc
[    3.073552] rtc-ds1307: probe of 2-006f failed with error -110

[   13.360146] imx-drm display-subsystem: bound imx-dpu-crtc.0 (ops dpu_crtc_ops)

[   13.364821] imx-drm display-subsystem: bound imx-dpu-crtc.1 (ops dpu_crtc_ops)

Please let us know any changes required in the device-tree.

In oder to enable RTC below changes has been made to the device tree file:imx8x-colibri-eval-v3.dtsi.

Note:Same changes were working previously with torizon linux 5.7.2

// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/*
 * Copyright 2019 Toradex
 */

#include <dt-bindings/input/linux-event-codes.h>

/ {
	aliases {
		rtc0 = &rtc_i2c;
		rtc1 = &rtc;
	};

	/* fixed crystal dedicated to mcp25xx */
	clk16m: clock-16mhz {
		compatible = "fixed-clock";
		#clock-cells = <0>;
		clock-frequency = <16000000>;
	};
};

/* Colibri Analogue Inputs */
&adc0 {
	status = "okay";
};

/* Colibri PWM_A */
&adma_pwm {
	status = "okay";
};

&colibri_gpio_keys {
	status = "okay";
};

&extcon_usbc_det {
	status = "okay";
};


//&i2c1 {
	//status = "okay";

	/* M41T0M6 real time clock on carrier board */
	//rtc_i2c: rtc@68 {
	//	compatible = "st,m41t0";
	//	reg = <0x68>;
	//};
//};

&i2c2 {
	status = "okay";

	/* M41T0M6 real time clock on carrier board */
	// rtc_i2c: rtc@68 {
	// 	compatible = "st,m41t0";
	//	reg = <0x68>;
	// };

	rtc_i2c: rtc@6F {
		compatible = "microchip,mcp7940x";
		reg = <0x6F>;
	};

	// rtc_i2c: rtc@68 {
	//    compatible = "dallas,ds1307","dallas,ds1340";
	//    reg = <0x68>;
	// };
};

&iomuxc {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_ext_io0>, <&pinctrl_hog0>, <&pinctrl_hog1>,
			<&pinctrl_lpspi2_cs2>;
};

/* Colibri SPI */
&lpspi2 {
	status = "okay";

	mcp2515: can@0 {
		compatible = "microchip,mcp2515";
		reg = <0>;
		interrupt-parent = <&lsio_gpio3>;
		interrupts = <13 IRQ_TYPE_EDGE_FALLING>;
		pinctrl-0 = <&pinctrl_can_int>;
		pinctrl-names = "default";
		clocks = <&clk16m>;
		spi-max-frequency = <10000000>;
	};
};

/* Colibri UART_B */
&lpuart0 {
	status = "okay";
};

/* Colibri UART_C */
&lpuart2 {
	status = "okay";
};

/* Colibri PWM_B */
&lsio_pwm0 {
	status = "okay";
};

/* Colibri PWM_C */
&lsio_pwm1 {
	status = "okay";
};

/* Colibri PWM_D */
&lsio_pwm2 {
	status = "okay";
};

/* Colibri UART_A */
&lpuart3 {
	status = "okay";
};

/* Colibri FastEthernet */
&fec1 {
	status = "okay";
};

/* USB PHY for usbotg3 */
&usb3_phy {
	status = "okay";
};

&usbotg1 {
	status = "okay";
};

&usbotg3 {
	status = "okay";
};

&usbotg3_cdns3 {
	status = "okay";
};

/* USB PHY for usbotg1 */
&usbphy1 {
	status = "okay";
};

/* Colibri SD/MMC Card */
&usdhc2 {
	status = "okay";
};

Hi, I’m the Toradex AI Assistant.

I might make mistakes or occasionally get you wrong. Our support team will step in if needed.


RTC Probe Failure Resolution for Colibri iMX8X on Torizon 7.3.0

The error -110 indicates a communication timeout with the RTC device(1). For your Microchip MCP7940X RTC on the Colibri iMX8X, there are several potential solutions to resolve this issue when upgrading from Torizon 5.7.2 to 7.3.0.

1. Device Tree Configuration

The device tree configuration for external RTCs on Colibri iMX8X can be implemented using Device Tree Overlays(2). For the MCP7940X RTC, you should verify the compatible string and I2C address are correct(2).

2. TorizonCore Builder Integration

To apply your device tree changes to Torizon 7.3.0, you’ll need to use TorizonCore Builder(2). The compilation process involves using the Device Tree Compiler (dtc) tool(3):

$ make DTC_FLAGS="-@" freescale/<custom-device-tree>.dtb

(3)

For Torizon OS deployment, use TorizonCore Builder to generate the image(3):

$ torizoncore-builder build

(3)

3. Troubleshooting Steps

Based on the community discussions, here are key troubleshooting steps(1):

  1. Verify I2C Communication: Check if the I2C bus is properly configured and the device is responding at the specified address (0x6F)
  2. Power and Pull-up Resistors: Ensure the RTC is powered correctly and required pull-up resistors on I2C lines are in place(1)
  3. Driver Compatibility: Verify that the kernel version supports the MCP7940X RTC driver(1)

4. Device Tree Structure

The device tree follows a hierarchical structure with SoC, SoM, and board levels(4). Your customization should be applied at the board level, taking into consideration the custom carrier board design(4).

5. Deployment Process

For production deployment, update both the kernel and device tree in the final production image(3). You can deploy the custom image using TorizonCore Builder(3):

$ torizoncore-builder union custom-branch
$ torizoncore-builder deploy custom-branch --output-directory <custom-image>.CUSTOM

(3)

The upgrade from Torizon 5.7.2 to 7.3.0 may require adjustments to your device tree configuration due to kernel changes. Using Device Tree Overlays and TorizonCore Builder will help ensure proper integration of your RTC configuration.

Best regards, Toradex AI Assistant.


Did you like my answer? :+1: :-1:

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

Hello @Deepak1 ,

First I urge you to follow what the bot has answered, as it contains relevant information that could solve your issue.

Aside from that, I recommend that you check the I2C pin configuration, making sure that the I2C controller you are using includes a valid pincontrol entry that assigns the correct SCL/SDA pins.

Also, confirm that the I2C address is valid and confirm if is 0x6F or 0x68

Here is a link with more info on how to do so: How to use I²C on Torizon OS | Toradex Developer Center