I2C debugging tool

1. I2C debugging tool

The i2c-tools tool is an open source I2C debugging tool, which has the function of obtaining the list of devices mounted on the I2C bus and the device addresses, and reading and writing the specified registers of the specified device.

ubuntu installation:

apt-get install libi2c-dev i2c-tools

Source code download address:

https://mirrors.edge.kernel.org/pub/software/utils/i2c-tools/

Port i2c-tools to embedded devices:

1 解压
  tar -xvf i2c-tools-3.1.1.tar.bz2
2 解压后修改Makefile
  CC =arm-linux-gnueabihf-gcc
  LDFLAGS += -static
3 make
  成功后会在tools目录下生成
  i2cdetect i2cdump i2cget i2cset等工具
4 将tools目录下文件拷贝到嵌入式设备的/usr/bin/目录下

Instructions:

1. 查看设备拥有I2C总线列表
   i2cdetect -l

You can see that there are 9 groups of IIC in the system.

2. 检测i2c总线上挂载的设备
   检测I2C总线7上挂载的设备

   i2cdetect-r -y 7

 

You can see 0x4C and 0x50 have mounted the device. The location of the I2C device is displayed as UUor represents the value of the device address, UUindicating that the device is used in the driver.

3. 检测i2c总线上挂载的设备
   检测I2C总线7的0x50地址上挂在的设备的所有寄存器的值 

   i2cdump -f -y 7 0x50

 

4. 使用i2cset设置单个寄存器值
   设置 挂载在I2C总线70x50地址上的设备的0x00寄存器的值为0xff 
   
   i2cset -f -y 7 0x50 0x00 0xff

5. i2cget读取单个寄存器值
   获取 挂载在I2C总线70x50地址上的设备的0x00寄存器的值
   
   i2cget -f -y 7 0x50 0x00

 
   千万注意,这里只可以用于示意来阐述如何设置寄存器的值,但是在TX2实际使用时,第7路,0x50实际上是EEPROM固定格式的定义,万万不可修改,否则后患无穷!!!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin blog.csdn.net/hgz_gs/article/details/89853510