嵌入式Linux下 i2c-tool工具的使用方法

本文介绍了在嵌入式Linux系统中如何使用i2c-tool进行设备检测。通过i2cdetect命令可以查看i2c总线上的有效设备列表,如i2cdetect -l显示总线列表,i2cdetect -y 0或1检查对应总线的设备。如果发现UU表示设备被占用,需要卸载相应驱动。

查看i2c命令集,输入i2c并按两次tab键。

root@imx6ul7d:~# i2c
i2cdetect              i2cget                 i2ctransfer
i2cdetect.i2c-tools    i2cget.i2c-tools       i2ctransfer.i2c-tools
i2cdump                i2cset
i2cdump.i2c-tools      i2cset.i2c-tools
root@imx6ul7d:~#

i2cdetect -l 命令查看有效的i2c列表

root@imx6ul7d:~# i2cdetect -l
i2c-1   i2c             21a4000.i2c                             I2C adapter
i2c-0   i2c             21a0000.i2c                             I2C adapter
root@imx6ul7d:~#

i2cdetect -y 0查看i2c-0下的设备,同理用i2cdetect -y 1可查i2c-1下的设备。以此类推。

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

*UU表示设备地址为0x0e和0x1e的从设备已经被驱动占用,卸载对应的驱动,UU就会变成数据了。

更多参考:
https://www.cnblogs.com/raina/p/12068485.html
https://linuxhint.com/i2c-linux-utilities/

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值