DESK-MX8M-L/Peripherals/I2C

From DAVE Developer's Wiki
Jump to: navigation, search
History
Issue Date Notes
2025/08/06 DESK-MX8M-L-4.x.x release


Peripheral I2C[edit | edit source]

Device tree configuration[edit | edit source]

Here below an example of device tree modifications to standard DAVE's kit for the ORCA SOM:

From imx8mp-mito8mplus-cb1001.dts:

...
...
/* groove connector */
&i2c6 {
	clock-frequency = <100000>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_i2c6>;
	status = "okay";
};

and from the imx8mp-mito8mplus.dtsi:

...
...
&iomuxc {
...
...

	pinctrl_i2c6: i2c6grp {
		fsl,pins = <
			MX8MP_IOMUXC_UART4_RXD__I2C6_SCL		0x400001c3
			MX8MP_IOMUXC_UART4_TXD__I2C6_SDA		0x400001c3
		>;
	};

...
...


Accessing the peripheral[edit | edit source]

N.B. I2C mapping respect to /dev/i2c-x is the following one:

I2C1 <-> /dev/i2c-0
I2C2 <-> /dev/i2c-1
I2C3 <-> /dev/i2c-2
...
I2C6 <-> /dev/i2c-5
...

Linux messages at boot time[edit | edit source]

...
...
[    0.306201] i2c_dev: i2c /dev entries driver
[    0.491912] i2c i2c-0: IMX I2C adapter registered
[    0.493021] i2c 1-003c: Fixing up cyclic dependency with 32e40000.csi
[    0.507341] i2c i2c-1: IMX I2C adapter registered
[    0.508457] i2c 2-003c: Fixing up cyclic dependency with 32e50000.csi
[    0.526712] i2c i2c-2: IMX I2C adapter registered
[    0.527579] i2c 5-004c: Fixing up cyclic dependency with 32c00000.bus:ldb@32ec005c
[    0.582173] i2c i2c-5: IMX I2C adapter registered
...
...

Usage with i2ctools[edit | edit source]

  • using the i2c-5 I2C bus on the GROOVE connector
root@desk-mx8mp:~# i2cdetect -y 5
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- 48 -- -- -- UU -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@desk-mx8mp:~#
  • after connecting an external RTC to the Groove connector, the 0x68 (DS1307 RTC) and 0x57 (AT24C32 EEPROM) devices are detected
root@desk-mx8mp:~# i2cdetect -y 5
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- 48 -- -- -- UU -- -- --
50: -- -- -- -- -- -- -- 57 -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@desk-mx8mp:~#
  • read - as an example - the 0x00 (Seconds register)
root@desk-mx8mp:~# i2cget -y 5 0x68 0x00
0x37
root@desk-mx8mp:~#

Additional information[edit | edit source]

A good I2C bus tutorial can be found in this video from Bootlin.

For general information, please refer to the I2C tools wiki page