1     编译安装

wget https://launchpadlibrarian.net/70776071/i2c-tools_3.0.3.orig.tar.bz2

tar xf i2c-tools_3.0.3.orig.tar.bz2

cd i2c-tools_3.0.3

CC=arm-linux-gnueabihf-gcc make

make install prefix=./install

 

 

2     使用

2.1.                  Install 目录结构

tree install/

install/

├── bin

│   ├── ddcmon

│   ├── decode-dimms

│   ├── decode-edid

│   └── decode-vaio

├── include

│   └── linux

│       └── i2c-dev.h

├── sbin

│   ├── i2cdetect

│   ├── i2cdump

│   ├── i2cget

│   ├── i2cset

│   └── i2c-stub-from-dump

 

2.2.                  命令

查看I2C总线

i2cdetect -l

i2c-0  i2c             rockchip_i2c                            I2C adapter

i2c-1  i2c             rockchip_i2c                            I2C adapter

i2c-2  i2c             rockchip_i2c                            I2C adapter

i2c-3  i2c             rockchip_i2c                            I2C adapter

i2c-4  i2c             rockchip_i2c                            I2C adapter

 

 

查看i2c-3 总线上的设备地址

i2cdetect -y 3

     0  1 2  3  4  5  6 7  8  9 a  b  c d  e  f

00:          03 04 05 06 07 0809 0a 0b 0c 0d 0e 0f

10: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f

20: 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f

30: -- -- -- -- -- -- -- -- 38 39 3a 3b 3c 3d 3e 3f

40: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f

50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

60: 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f

70: 70 71 72 73 74 75 76 77

 

 

获取提示

i2cget

Usage: i2cget [-f] [-y] I2CBUS CHIP-ADDRESS[DATA-ADDRESS [MODE]]

 I2CBUS is an integer or an I2C bus name

 ADDRESS is an integer (0x03 - 0x77)

 MODE is one of:

    b(read byte data, default)

    w(read word data)

    c (write byte/read byte)

Append p forSMBus PEC

 

设置

i2cset

Usage: i2cset [-f] [-y] [-m MASK] I2CBUSCHIP-ADDRESS DATA-ADDRESS [VALUE] ... [MODE]

 I2CBUS is an integer or an I2C bus name

 ADDRESS is an integer (0x03 - 0x77)

 MODE is one of:

    c(byte, no value)

    b(byte data, default)

    w(word data)

    i(I2C block data)

    s(SMBus block data)

   Append p for SMBus PEC

 

3     关于作者

联系方式:QQ: 332188219             EMAIL:332188219@qq.com

博客:http://blog.csdn.net/sheji105

 

Logo

更多推荐