首页 > 其他分享 >i2c erproom 读取 ——i2cdetect i2cdump i2cget i2cset 使用方法

i2c erproom 读取 ——i2cdetect i2cdump i2cget i2cset 使用方法

时间:2024-09-24 10:23:34浏览次数:1  
标签:00 -- erproom i2cget 30 i2cdump i2cdetect ff i2c

i2cdetect i2cdump i2cget i2cset 使用方法

 

1. 打印使用说明 i2cdetect –help

	rk3568_r:/ # i2cdetect --help

usage: i2cdetect [-ary] BUS [FIRST LAST]
usage: i2cdetect -F BUS
usage: i2cdetect -l

Detect i2c devices.

-a	All addresses (0x00-0x7f rather than 0x03-0x77)
-F	Show functionality
-l	List all buses
-r	Probe with SMBus Read Byte
-y	Answer "yes" to confirmation prompts (for script use)

2. 列出所有的i2c设备节点 i2cdetect -l

rk3568_r:/ # i2cdetect -l
i2c-1	i2c       	rk3x-i2c                        	I2C Adapter
i2c-6	i2c       	DP-AUX                          	I2C Adapter
i2c-4	i2c       	rk3x-i2c                        	I2C Adapter
i2c-0	i2c       	rk3x-i2c                        	I2C Adapter
i2c-7	i2c       	DesignWare HDMI                 	I2C Adapter
i2c-5	i2c       	rk3x-i2c                        	I2C Adapter

 



3、查看i2c设备挂载的设备  i2cdetect -y 设备号

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

4. 打印i2cdump 使用说明

rk3568_r:/ # i2cdump --help
usage: i2cdump [-fy] BUS CHIP

Dump i2c registers.

-f	Force access to busy devices
-y	Answer "yes" to confirmation prompts (for script use)

5. 查看指定设备地址的所有寄存器值

rk3568_r:/ # i2cdump -f -y 0 0x20
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: 00 00 00 00 00 00 00 00 00 00 01 01 00 81 00 00    ..........??.?..
10: 00 00 03 00 00 00 00 06 c8 00 00 00 00 00 00 00    ..?....??.......
20: 00 00 00 ff ff 00 00 70 00 66 00 00 00 00 00 0f    ...??..p.f.....?
30: 04 00 00 00 a5 00 00 00 20 ff ff 00 00 e0 0f 09    ?...?... ??..???
40: 69 4c 04 58 2d 0c a5 00 00 00 00 17 00 00 17 00    iL?X-??....?..?.
50: 8c 00 01 00 01 b0 44 10 00 60 00 00 00 00 00 00    ?.?.??D?.`......
60: 00 00 00 00 00 00 00 00 00 00 00 00 01 00 2f 00    ............?./.
70: 00 00 00 00 ff ff f8 5f 00 01 ff fd 00 00 00 00    ....???_.???....
80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
90: 60 80 2d 7f dd df ad 80 2d 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 0f 0f 0f 0f 04 a4 ff ff 00 64 20 20 64 1a 20    .????????.d  d?
c0: 64 00 00 64 1a 20 64 ff ff ff ff ff 0c 0c 0c 0c    d..d? d?????????
d0: 0c 0c 6c 6c 30 6c 6c 6c 30 30 30 30 30 30 09 31    ??ll0lll000000?1
e0: 00 00 00 55 a2 c8 c5 40 00 ff 22 03 0a 80 94 0e    ...U???@.?"?????
f0: c2 ac a0 40 18 10 00 86 00 fc 00 ff 00 ff 60 00    ???@??.?.?.?.?`.

6. i2cget 使用方法

rk3568_r:/ # i2cget --help
usage: i2cget [-fy] BUS CHIP ADDR

Read an i2c register.

-f	Force access to busy devices
-y	Answer "yes" to confirmation prompts (for script use)

7. 获取设备指定寄存器地址的值

rk3568_r:/ # i2cget -fy 0 0x20 0x12
0x03

8. i2cset 使用方法

130|rk3568_r:/ # i2cset --help
usage: i2cset [-fy] BUS CHIP ADDR VALUE... MODE

Write an i2c register. MODE is b for byte, w for 16-bit word, i for I2C block.

-f	Force access to busy devices
-y	Answer "yes" to confirmation prompts (for script use)

9. 设置设备指定寄存器地址的值

rk3568_r:/ # i2cset -fy 0 0x20 0x12 0x04 b

标签:00,--,erproom,i2cget,30,i2cdump,i2cdetect,ff,i2c
From: https://www.cnblogs.com/blj28/p/18428562

相关文章