I2C on Linux

To enumerate I2C controllers detected by Linux (or configured by DeviceTree)

i2cdetect -l

Output:

i2c-0   i2c             rk3x-i2c                                I2C adapter
i2c-2   i2c             rk3x-i2c                                I2C adapter
i2c-6   i2c             rk3x-i2c                                I2C adapter
i2c-7   i2c             rk3x-i2c                                I2C adapter
i2c-9   i2c             fde50000.dp                             I2C adapter
i2c-10  i2c             ddc                                     I2C adapter

Scanning devices on I2C bus

# i2cdetect -y <bus_number>
i2cdetect -y 6

Output:

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

Writing value to particular I2C device

icset -y 1 0x22 0xff

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *