knightstreet
Posts: 9
Joined: Fri May 13, 2016 7:32 am

rtc on i2c0 dmesg dev_err meaning

Wed Sep 12, 2018 8:25 am

Hi,

I have a dmesg output I need to understand, the message is:

Code: Select all

rtc-abx80x 1-0069: Unable to read partnumber
Does this mean it's searching for the rtc (address 0x69) on i2c1 line?

If so how do I get my rtc device on i2c0 to be detected? I have enabled the i2c0 line using config.txt:

Code: Select all

dtparam=i2c0=on
dtoverlay=i2c-rtc,abx80x
The device appears when I use i2cdetect -y 0 :

Code: Select all

# modprobe i2c-dev
# i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- 18 -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- 45 -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- 64 -- -- -- -- 69 -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                      
I am not using start_x so you can ignore the camera and touchscreen i2c addresses.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1915
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: rtc on i2c0 dmesg dev_err meaning

Wed Sep 12, 2018 8:38 am

It isn't currently possible (in any clean way) to parameterise the i2c-rtc overlay with an indication of which bus to use, so you'll have to roll your own:

Code: Select all

// Definitions for several I2C based Real Time Clocks
/dts-v1/;
/plugin/;

/ {
	compatible = "brcm,bcm2708";

	[email protected] {
		target = <&i2c_vc>;
		__dormant__ {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			abx80x: [email protected] {
				compatible = "abracon,abx80x";
				reg = <0x69>;
				abracon,tc-diode = "standard";
				abracon,tc-resistor = <0>;
				status = "okay";
			};
		};
	};

	[email protected] {
		target = <&i2c_vc>;
		__dormant__ {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			ds1307: [email protected] {
				compatible = "maxim,ds1307";
				reg = <0x68>;
				status = "okay";
			};
		};
	};

	[email protected] {
		target = <&i2c_vc>;
		__dormant__ {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			ds1339: [email protected] {
				compatible = "dallas,ds1339";
				trickle-resistor-ohms = <0>;
				reg = <0x68>;
				status = "okay";
			};
		};
	};

	[email protected] {
		target = <&i2c_vc>;
		__dormant__ {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			ds3231: [email protected] {
				compatible = "maxim,ds3231";
				reg = <0x68>;
				status = "okay";
			};
		};
	};

	[email protected] {
		target = <&i2c_vc>;
		__dormant__ {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			mcp7940x: [email protected] {
				compatible = "microchip,mcp7940x";
				reg = <0x6f>;
				status = "okay";
			};
		};
	};

	[email protected] {
		target = <&i2c_vc>;
		__dormant__ {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			mcp7941x: [email protected] {
				compatible = "microchip,mcp7941x";
				reg = <0x6f>;
				status = "okay";
			};
		};
	};

	[email protected] {
		target = <&i2c_vc>;
		__dormant__ {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			pcf2127: [email protected] {
				compatible = "nxp,pcf2127";
				reg = <0x51>;
				status = "okay";
			};
		};
	};

	[email protected] {
		target = <&i2c_vc>;
		__dormant__ {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			pcf8523: [email protected] {
				compatible = "nxp,pcf8523";
				reg = <0x68>;
				status = "okay";
			};
		};
	};

	[email protected] {
		target = <&i2c_vc>;
		__dormant__ {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			pcf8563: [email protected] {
				compatible = "nxp,pcf8563";
				reg = <0x51>;
				status = "okay";
			};
		};
	};

	[email protected] {
		target = <&i2c_vc>;
		__dormant__ {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			m41t62: [email protected] {
				compatible = "st,m41t62";
				reg = <0x68>;
				status = "okay";
			};
		};
	};

	__overrides__ {
		abx80x = <0>,"+0";
		ds1307 = <0>,"+1";
		ds1339 = <0>,"+2";
		ds3231 = <0>,"+3";
		mcp7940x = <0>,"+4";
		mcp7941x = <0>,"+5";
		pcf2127 = <0>,"+6";
		pcf8523 = <0>,"+7";
		pcf8563 = <0>,"+8";
		m41t62 = <0>,"+9";

		addr = <&abx80x>, "reg:0",
		       <&ds1307>, "reg:0",
		       <&ds1339>, "reg:0",
		       <&ds3231>, "reg:0",
		       <&mcp7940x>, "reg:0",
		       <&mcp7941x>, "reg:0",
		       <&pcf2127>, "reg:0",
		       <&pcf8523>, "reg:0",
		       <&pcf8563>, "reg:0",
		       <&m41t62>, "reg:0";
		trickle-diode-type = <&abx80x>,"abracon,tc-diode";
		trickle-resistor-ohms = <&ds1339>,"trickle-resistor-ohms:0",
					<&abx80x>,"abracon,tc-resistor";
		wakeup-source = <&ds1339>,"wakeup-source?",
				<&ds3231>,"wakeup-source?",
				<&mcp7940x>,"wakeup-source?",
				<&mcp7941x>,"wakeup-source?",
				<&m41t62>,"wakeup-source?";
	};
};
Call it i2c-rtc-vc-overlay.dts and compile it with:

Code: Select all

$ dtc [email protected] -I dts -O dtb -o i2c-rtc-vc.dtbo i2c-rtc-vc-overlay.dts
Don't worry about any warnings you might see.

Copy the resulting .dtbo into /boot/overlays and change the config.txt line to say:

Code: Select all

dtoverlay=i2c-rtc-vc,abx80x
Now reboot and you should be good to go.

knightstreet
Posts: 9
Joined: Fri May 13, 2016 7:32 am

Re: rtc on i2c0 dmesg dev_err meaning

Wed Sep 12, 2018 8:41 am

Awesome, thanks.

Return to “Device Tree”