VAR-SOM-MX6 I2C: Difference between revisions

From Variscite Wiki
(Add category Debian)
 
(19 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{PageHeader|VAR-SOM-MX6 - I2C}} {{DocImage|category1=VAR-SOM-MX6|category2=Yocto}} __toc__
{{PageHeader|VAR-SOM-MX6 - I2C}} {{DocImage|category1=Yocto|category2=Debian}} [[category:VAR-SOM-MX6]] __toc__




The I2C devices are handled with special drivers. for example rtc will use /dev/rtc driver. Sometime when you add a new device low level debugging via I2C is required.


= I2C buses =
= Available I2C buses =
List I2C available devices:
List I2C available devices:
<pre>
<pre>
Line 18: Line 17:
</pre>
</pre>


= I2C device per bus =
= I2C devices per bus =
Scan bus 0:
Scan bus 0:
<pre>
<pre>
Line 58: Line 57:
70: -- -- -- -- -- -- -- --                         
70: -- -- -- -- -- -- -- --                         
</pre>
</pre>
When the device is marked with "UU" it means that a driver is using it.<br>
When the device is marked with numbers it means that no driver is using it.<br>


= I2C dump eeprom content =
= Reading / Writing from an I2C device=
Dump the eeprom content:
Variscite includes I2CTools as a part of the default file system build, examples of optional commands: <br>
<pre>
i2cdump - dump the content of an I2C device <br>
root@var-som-mx6:~# i2cdump -y -r 0-0xf 1 0x56 b
i2cset - write a single character to an I2C device<br>
    0  1  2  3  4  5  6  7  8  9 a b  c  d  e  f    0123456789abcdef
i2cget - read a single character to an I2C device.<br>
00: 57 41 52 49 56 53 4d 2d 4d 58 36 2d 43 30 31 00    WARIVSM-MX6-C01.
<br>
</pre>
In addition follow 'C' code example as describe in the linux kernel documentation : https://www.kernel.org/doc/Documentation/i2c/dev-interface
{{note|Note:<br/>Don't write to this device you will erase the DDR calibration parameters!!!|info}}
 
If required you can use  i2cset and i2cget to write/read data from a device.
= Variscite's system integrated I2C devices =
= Avoid writing to any Variscite device. =
{{note|Note: Do not write to Variscite's on-SOM EEPROM or you will damage the SOM!|info}}
<br/>When the device is marked with "UU" it says a driver is using it.
 
<br/>Driver with numbers are available.
Variscite devices:
<br/>Variscite devices:
I2C-0 0x3C - Camera
<br/>I2C-0 0x3C CAMERA
<br/>
I2C-1 0x08 - PMIC (not present on SOM-SOLO/DUAL)
<br/>I2C-1 0x37 HDMI
I2C-1 0x37 - HDMI
<br/>I2C-1 0x49 HDMI
I2C-1 0x49 - HDMI
<br/>I2C-1 0x59 HDMI
I2C-1 0x59 - HDMI
<br/>I2C-1 0x50
I2C-1 0x50
<br/>I2C-1 0x56 EEPROM
I2C-1 0x52 - EEPROM on DART-MX6 - Do not alter!
<br/>I2C-1 0x57 EEPROM
I2C-1 0x53 - EEPROM on DART-MX6 - Do not alter!
<br/>
I2C-1 0x56 - EEPROM on VAR-SOM-MX6 / SOM-SOLO/DUAL - Do not alter!
<br/>I2C-2 0x38 LVDS
I2C-1 0x57 - EEPROM on VAR-SOM-MX6 / SOM-SOLO/DUAL - Do not alter!
<br/>I2C-2 0x68 RTC
I2C-2 0x38 - Capacitive touch panel
I2C-2 0x68 - VAR-DVK-MX6 DS1307 RTC

Latest revision as of 18:54, 28 April 2023

VAR-SOM-MX6 - I2C


Available I2C buses

List I2C available devices:

root@var-som-mx6:~# ls -l /dev/i2c-*
crw------- 1 root root 89, 0 Dec  6 10:31 /dev/i2c-0
crw------- 1 root root 89, 1 Dec  6 10:31 /dev/i2c-1
crw------- 1 root root 89, 2 Dec  6 10:31 /dev/i2c-2

System class:

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

I2C devices per bus

Scan bus 0:

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

Scan bus 1:

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

Scan bus 2:

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

When the device is marked with "UU" it means that a driver is using it.
When the device is marked with numbers it means that no driver is using it.

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 follow 'C' code example as describe in the linux kernel documentation : https://www.kernel.org/doc/Documentation/i2c/dev-interface

Variscite's system integrated I2C devices

Note: Do not write to Variscite's on-SOM EEPROM or you will damage the SOM!

Variscite devices:

I2C-0 0x3C - Camera

I2C-1 0x08 - PMIC (not present on SOM-SOLO/DUAL)
I2C-1 0x37 - HDMI
I2C-1 0x49 - HDMI
I2C-1 0x59 - HDMI
I2C-1 0x50
I2C-1 0x52 - EEPROM on DART-MX6 - Do not alter!
I2C-1 0x53 - EEPROM on DART-MX6 - Do not alter!
I2C-1 0x56 - EEPROM on VAR-SOM-MX6 / SOM-SOLO/DUAL - Do not alter!
I2C-1 0x57 - EEPROM on VAR-SOM-MX6 / SOM-SOLO/DUAL - Do not alter!

I2C-2 0x38 - Capacitive touch panel
I2C-2 0x68 - VAR-DVK-MX6 DS1307 RTC