I2C
Each CPU supports a number of I2C bus interfaces. In most cases they are all available on the standard EACOM locations. In some cases, more I2C interfaces exist on the CPU and can be enabled in the device tree file. The table below is a mapping between the bus numbering in U-Boot / Linux and the I2C channel name (A/B/C) used on the COM Carrier board. Note that the bus numbering in U-Boot/Linux is not necessarily the same as the peripheral number on the processor.
Board | I2C-A | I2C-B | I2C-C |
---|---|---|---|
iMX6 SoloX COM | i2c-0 | i2c-1 | i2c-2 |
iMX6 Quad COM | i2c-0 | i2c-2 | i2c-1 |
iMX6 DualLite COM | i2c-0 | i2c-2 | i2c-1 |
iMX6 UltraLite COM | i2c-0 | i2c-1 | Not supported |
iMX7 Dual (u)COM | i2c-0 | i2c-1 | i2c-2 |
iMX7ULP uCOM | i2c-0 / bus5 | i2c-1 / bus7 | Not supported |
iMX8M Quad COM | i2c-0 | i2c-1 | Not supported |
iMX8M Mini uCOM | i2c-0 | i2c-1 | i2c-2 |
iMX8M Nano uCOM | i2c-0 | i2c-1 | i2c-2 |
iMX93 uCOM | i2c-0 | i2c-1 | i2c-2 |
For iMX7ULP uCOM the i2c bus numbering is not the same in U-Boot and Linux. The first name in the column corresponds to device name in Linux and the second the device name in U-Boot.
Which I2C devices that can be found varies depending on COM board, (u)COM Carrier Board and connected peripherals like displays (typically the touch controller uses I2C).
The 7-bit address of all I2C devices on the COM Carrier board can be found in the schematics for the COM Carrier board.
U-Boot
i2c
i2c - I2C sub-system
Usage:
i2c bus [muxtype:muxaddr:muxchannel] - show I2C bus info
crc32 chip address[.0, .1, .2] count - compute CRC32 checksum
i2c dev [dev] - show or set current I2C bus
i2c loop chip address[.0, .1, .2] [# of objects] - looping read of device
i2c md chip address[.0, .1, .2] [# of objects] - read from I2C device
i2c mm chip address[.0, .1, .2] - write to I2C device (auto-incrementing)
i2c mw chip address[.0, .1, .2] value [count] - write to I2C device (fill)
i2c nm chip address[.0, .1, .2] - write to I2C device (constant address)
i2c probe [address] - test for and show device(s) on the I2C bus
i2c read chip address[.0, .1, .2] length memaddress - read to memory
i2c write memaddress chip address[.0, .1, .2] length - write memory to i2c
i2c reset - re-init the I2C Controller
i2c speed [speed] - show or set I2C bus speed
To see the available busses.
i2c bus
Bus 0: mxc0
Bus 1: mxc1
Bus 2: mxc2
Bus 0 is safe to use. The other busses may not be initialized and could produce errors when probed. To list all devices on bus 0.
i2c dev 0
Setting bus to 0
i2c probe
Valid chip addresses: 08 1A 4D 55 56
The scan found the following devices.
- 0x08 – PMIC on the COM board
- 0x1a – Audio Codec on the COM Carrier Board
- 0x4d – AR1021 Touch Controller, typically on COM Display Adapter (or on COM Carrier Board, rev A)
- 0x55 – EEPROM on the COM Board
- 0x56 – EEPROM, typically on COM Display Adapter (or on COM Carrier Board, rev A)
Note that your result may be different depending on which combination of COM board, (u)COM Carrier Board and external peripherals you use.
Linux
To see which I2C busses are available list content in dev
directory.
ls /dev/i2c*
/dev/i2c-0 /dev/i2c-1 /dev/i2c-2
You can also use the i2cdetect
command.
i2cdetect -l
i2c-0 i2c 21a0000.i2c I2C adapter
i2c-1 i2c 21a4000.i2c I2C adapter
i2c-2 i2c 21a8000.i2c I2C adapter
To scan for all devices on i2c-1.
i2cdetect –y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- UU -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- UU -- --
50: -- -- -- -- -- UU 56 -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
The scan above uses UU to indicate that a device was not probed as it was marked as being in use by a driver. The address to device mapping is described in the U-Boot section above.