2020/11/3

記 一下 i2c tool 的動作, i2cget , i2cset

其實單獨執行。不加 argument 的時候,都會有 help.

# i2cdetect 
BusyBox v1.31.1 (2020-02-18 12:01:00 CST) multi-call binary.

Usage: i2cdetect -l | -F I2CBUS | [-ya] [-q|-r] I2CBUS [FIRST LAST]

Detect I2C chips

	-l	List installed buses
	-F BUS#	List functionalities on this bus
	-y	Disable interactive mode
	-a	Force scanning of non-regular addresses
	-q	Use smbus quick write commands for probing (default)
	-r	Use smbus read byte commands for probing
	FIRST and LAST limit probing range


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


# i2cdump 
BusyBox v1.31.1 (2020-02-18 12:01:00 CST) multi-call binary.

Usage: i2cdump [-fy] [-r FIRST-LAST] BUS ADDR [MODE]

Examine I2C registers

	I2CBUS	I2C bus number
	ADDRESS	0x03-0x77
MODE is:
	b	Byte (default)
	w	Word
	W	Word on even register addresses
	i	I2C block
	s	SMBus block
	c	Consecutive byte
	Append p for SMBus PEC

	-f	Force access
	-y	Disable interactive mode
	-r	Limit the number of registers being accessed


# i2cdump -fy 2 0x12
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
00: c9 06 48 01 60 50 0b 23 00 00 60 00 e1 e1 f0 00    ??H?`P?#..`.???.
10: 18 1e fc fc fc fc 07 03 03 d0 1f 60 20 00 10 00    ???????????` .?.
20: 00 0f 33 05 10 29 22 f6 bd 00 73 3e 79 e1 1d 03    .?3??)"??.s>y???
30: 92 39 3a e6 00 10 f1 1d 00 00 00 00 00 00 00 00    ?9:?.???........
40: 00 00 00 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 00 00 00 00 00    ................


# i2cget
BusyBox v1.31.1 (2020-02-18 12:01:00 CST) multi-call binary.

Usage: i2cget [-fy] BUS CHIP-ADDRESS [DATA-ADDRESS [MODE]]

Read from I2C/SMBus chip registers

	I2CBUS	I2C bus number
	ADDRESS	0x03-0x77
MODE is:
	b	Read byte data (default)
	w	Read word data
	c	Write byte/read byte
	Append p for SMBus PEC

	-f	Force access
	-y	Disable interactive mode


# i2cget -fy 2 0x12 0
0xc9
# i2cget -fy 2 0x12 1
0x06


# i2cset
BusyBox v1.31.1 (2020-02-18 12:01:00 CST) multi-call binary.

Usage: i2cset [-fy] [-m MASK] BUS CHIP-ADDRESS DATA-ADDRESS [VALUE] ... [MODE]

Set I2C registers

	I2CBUS	I2C bus number
	ADDRESS	0x03-0x77
MODE is:
	c	Byte, no value
	b	Byte data (default)
	w	Word data
	i	I2C block data
	s	SMBus block data
	Append p for SMBus PEC

	-f	Force access
	-y	Disable interactive mode
	-r	Read back and compare the result
	-m MASK	Mask specifying which bits to write
# i2cset -fy 2 0x12 0 0xc8
# i2cget -fy 2 0x12 0
0xc8

沒有留言:

張貼留言