Android/linux 平台下使用 i2c-tools调试IIC方法
2016-05-10 22:30
615 查看
在busybox包含i2c-tools工具,使用时只需busybox+指令只可。
i2cdetect
i2cdump
i2cget
i2cset
[cpp]
view plain
copy
print?
# i2cdetect -l
i2c-0 i2c imx-i2c I2C adapter
i2c-1 i2c imx-i2c I2C adapter
i2c-2 i2c imx-i2c I2C adapter
[cpp]
view plain
copy
print?
# i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- UU -- -- -- -- -- -- --
10: -- UU -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- 3a -- -- -- -- --
40: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
50: UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
[cpp]
view plain
copy
print?
# i2cdump -y -f 1 0x3a
No size specified (using byte-data access)
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: eb 00 7f 05 3d 00 00 00 08 06 00 00 00 00 00 00 ?.??=...??......
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
20: 01 23 45 67 89 ab cd ef fe dc ba 98 76 54 32 10 ?#Eg????????vT2?
30: f0 e1 d2 c3 00 00 00 00 00 00 00 00 00 00 00 00 ????............
40: 80 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 ?.?.............
50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
f0: 00 00 00 00 00 00 00 00 00 00 00 30 00 00 00 00 ...........0....
[cpp]
view plain
copy
print?
# i2cget -y -f 1 0x3a 0x02
0x7f
[cpp]
view plain
copy
print?
# i2cset -y -f 1 0x3a 0x02 0x05
参考
http://my.oschina.net/luoly/blog/368881
i2cdetect
i2cdump
i2cget
i2cset
i2cdetect
列举 I2C bus[cpp]
view plain
copy
print?
# i2cdetect -l
i2c-0 i2c imx-i2c I2C adapter
i2c-1 i2c imx-i2c I2C adapter
i2c-2 i2c imx-i2c I2C adapter
# i2cdetect -l i2c-0 i2c imx-i2c I2C adapter i2c-1 i2c imx-i2c I2C adapter i2c-2 i2c imx-i2c I2C adapter列举 I2C bus
i2c-1上面连接的所有设备
[cpp]
view plain
copy
print?
# i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- UU -- -- -- -- -- -- --
10: -- UU -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- 3a -- -- -- -- --
40: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
50: UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
# i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- UU -- -- -- -- -- -- -- 10: -- UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- 3a -- -- -- -- -- 40: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- -- 50: UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --发现 I2C 设备的位置显示为
UU或者表示设备地址的数值,
UU表示该设备在 driver 中被使用。
i2cdump
dump I2C 设备大批量 register 的值[cpp]
view plain
copy
print?
# i2cdump -y -f 1 0x3a
No size specified (using byte-data access)
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: eb 00 7f 05 3d 00 00 00 08 06 00 00 00 00 00 00 ?.??=...??......
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
20: 01 23 45 67 89 ab cd ef fe dc ba 98 76 54 32 10 ?#Eg????????vT2?
30: f0 e1 d2 c3 00 00 00 00 00 00 00 00 00 00 00 00 ????............
40: 80 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 ?.?.............
50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
f0: 00 00 00 00 00 00 00 00 00 00 00 30 00 00 00 00 ...........0....
# i2cdump -y -f 1 0x3a No size specified (using byte-data access) 0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef 00: eb 00 7f 05 3d 00 00 00 08 06 00 00 00 00 00 00 ?.??=...??...... 10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 20: 01 23 45 67 89 ab cd ef fe dc ba 98 76 54 32 10 ?#Eg????????vT2? 30: f0 e1 d2 c3 00 00 00 00 00 00 00 00 00 00 00 00 ????............ 40: 80 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 ?.?............. 50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ f0: 00 00 00 00 00 00 00 00 00 00 00 30 00 00 00 00 ...........0....
i2cget
读取 I2C 设备某个 register 的值[cpp]
view plain
copy
print?
# i2cget -y -f 1 0x3a 0x02
0x7f
# i2cget -y -f 1 0x3a 0x02 0x7f
i2cset
设置 I2C 设备某个 register 的值[cpp]
view plain
copy
print?
# i2cset -y -f 1 0x3a 0x02 0x05
# i2cset -y -f 1 0x3a 0x02 0x05
参考
http://my.oschina.net/luoly/blog/368881
相关文章推荐
- 【裸奔吧linux】ubuntu 个人收藏软件列表
- linux系统学习之进程
- CentOS6.5加域
- LINUX 中的一些配置文件
- Linux下让一个程序开机自动启动
- linux之脚本初体验
- Linux常用命令汇总
- Linux常用命令汇总--pwd
- Linux 忘记密码
- CentOS6.5下telnet服务
- 图解linux下top命令的使用
- linux基本命令(21)——find命令之xargs
- linux基本命令(20)——find命令之exec
- Linux中的线程局部存储(二)
- Linux下实现文档在线浏览
- linux设备模型之内核对象kobject
- Linux中的线程局部存储(一)
- linux基本命令(19)——find命令
- vmware10 虚拟机克隆 centos7 完整步骤
- 如何通过putty向服务器传输文件