VAR-SOM-MX7 I2C: Difference between revisions

From Variscite Wiki
(Created page with "{{PageHeader|VAR-SOM-MX7 - I2C}} {{DocImage|category1=VAR-SOM-MX7|category2=Yocto}} __toc__ = Available I2C buses = List I2C available devices: <pre> root@imx7-var-som:~# ls ...")
 
(Add category Debian)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{PageHeader|VAR-SOM-MX7 - I2C}} {{DocImage|category1=VAR-SOM-MX7|category2=Yocto}} __toc__
{{PageHeader|VAR-SOM-MX7 - I2C}} {{DocImage|category1=Yocto|category2=Debian}} [[category:VAR-SOM-MX7]] __toc__


= Available I2C buses =
= Available I2C buses =
Line 66: Line 66:


= Variscite's system integrated I2C devices =
= Variscite's system integrated I2C devices =
{{note|Note: Don't manipulate Variscite's on-SOM EEPROM, or you will damage the SOM!|info}}
When the device is marked with "UU" it says a driver is using it.<br>
When the device is marked with "UU" it says a driver is using it.<br>
Driver with numbers are available.<br>
Driver with numbers are available.<br>
Line 71: Line 72:
<pre>
<pre>
I2C-0 0x08 - PMIC
I2C-0 0x08 - PMIC
I2C-0 0x50 - EEPROM on SOM
I2C-0 0x50 - EEPROM on SOM - Do not alter!
I2C-0 0x51 - EEPROM on SOM
I2C-0 0x51 - EEPROM on SOM - Do not alter!
 
I2C-1 0x1A - Audio codec
I2C-1 0x1A - Audio codec
I2C-1 0x3C - OV5640 camera
I2C-1 0x3C - OV5640 camera
I2C-1 0x68 - RTC On carrier
I2C-1 0x68 - RTC on carrier
 
I2C-3 0x38 - Focaltech touch
I2C-3 0x38 - Focaltech touch
I2C-3 0x54 - EEPROM on carrier
I2C-3 0x54 - EEPROM on carrier

Latest revision as of 18:55, 28 April 2023

VAR-SOM-MX7 - I2C

Available I2C buses

List I2C available devices:

root@imx7-var-som:~# ls  /dev/i2c-*
/dev/i2c-0  /dev/i2c-1  /dev/i2c-3

System class:

root@imx7-var-som:~# ls /sys/class/i2c-dev/
i2c-0  i2c-1  i2c-3

I2C devices per bus

Scan bus 0:

root@imx7-var-som:~# i2cdetect -y -r 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- UU -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: 50 51 -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --

Scan bus 1:

root@imx7-var-som:~# i2cdetect -y -r 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --

Scan bus 3:

root@imx7-var-som:~# i2cdetect -y -r 3
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- 54 55 -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --

Reading / Writing from an I2C device

Variscite includes I2CTools as a part of the default file system build, examples of optional commands:
i2cdump - dump the content of an I2C device
i2cset - write a single character to an I2C device
i2cget - read a single character to an I2C device.

In addition, following is the Linux kernel documentation, with a C code example, on accessing i2c devices from userspace: https://www.kernel.org/doc/Documentation/i2c/dev-interface

Variscite's system integrated I2C devices

Note: Don't manipulate Variscite's on-SOM EEPROM, or you will damage the SOM!

When the device is marked with "UU" it says a driver is using it.
Driver with numbers are available.
Variscite devices:

I2C-0 0x08 - PMIC
I2C-0 0x50 - EEPROM on SOM - Do not alter!
I2C-0 0x51 - EEPROM on SOM - Do not alter!

I2C-1 0x1A - Audio codec
I2C-1 0x3C - OV5640 camera
I2C-1 0x68 - RTC on carrier

I2C-3 0x38 - Focaltech touch
I2C-3 0x54 - EEPROM on carrier
I2C-3 0x55 - EEPROM on carrier
I2C-3 0x68 - PCIe clock generator