Skip to content

Commit 7933aee

Browse files
committed
add i2c readme file
1 parent 494fc47 commit 7933aee

File tree

4 files changed

+409
-117
lines changed

4 files changed

+409
-117
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ Codes test on the kernel version below
3131

3232
[HELLO](./debug/hello/README.md)
3333

34+
[I2C](./debug/i2c/README.md)
35+
3436
[REGULATOR (ACT8846 PMU)](./debug/regulator/README.md)
3537

3638
[PLATFORM_DRIVER_TEST](./debug/platform_driver_test/README.md)

debug/i2c/README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# I2C
2+
3+
## UBOOT 下 I2C
4+
5+
在UBOOT下测试硬件是否正常
6+
7+
确认UBOOT中对I2C支持,一般会有相应命令
8+
9+
uboot # i2c
10+
i2c - I2C sub-system
11+
12+
Usage:
13+
i2c crc32 chip address[.0, .1, .2] count - compute CRC32 checksum
14+
i2c dev [dev] - show or set current I2C bus
15+
i2c loop chip address[.0, .1, .2] [# of objects] - looping read of device
16+
i2c md chip address[.0, .1, .2] [# of objects] - read from I2C device
17+
i2c mm chip address[.0, .1, .2] - write to I2C device (auto-incrementing)
18+
i2c mw chip address[.0, .1, .2] value [count] - write to I2C device (fill)
19+
i2c nm chip address[.0, .1, .2] - write to I2C device (constant address)
20+
i2c probe [address] - test for and show device(s) on the I2C bus
21+
i2c read chip address[.0, .1, .2] length memaddress - read to memory
22+
i2c write memaddress chip address[.0, .1, .2] length - write memory to i2c
23+
i2c reset - re-init the I2C Controller
24+
i2c speed [speed] - show or set I2C bus speed
25+
26+
查看当前使用的I2C BUS
27+
28+
uboot # i2c dev
29+
Current bus is 0
30+
31+
查询该总线下接的所有I2C设备
32+
33+
uboot # i2c probe
34+
Valid chip addresses: 14 40 41 51 55 5A
35+
36+
如果是下面这样的输出,则说明该总线有异常,极大可能是有I2C设备拉低了总线
37+
38+
uboot # i2c probe
39+
Valid chip addresses:I2C Send Start Bit Timeout
40+
I2C Send Start Bit Timeout
41+
42+
切换I2C BUS
43+
44+
uboot # i2c dev 1
45+
Setting bus to 1

debug/spi/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,17 @@ read and write test
1616

1717
cat /dev/ttysWK0
1818
echo 1 > /dev/ttysWK0
19+
20+
测试脚本
21+
22+
i=1
23+
while true
24+
do
25+
if [ $i -eq 10 ]
26+
then
27+
(( i=1 ))
28+
fi
29+
echo $i > /dev/ttysWK0
30+
sleep 1
31+
(( i+=1 ))
32+
done

0 commit comments

Comments
 (0)