imx8qxp i2c 扫描问题

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imx8qxp i2c 扫描问题

838 Views
c-luo
Contributor III

您好,NXP:

 最近我使用imx8qxp的板子,android11系统,用的是imx8qxp官方的源码。

发现源码中的i2c0和cm4是复用的,并且用的是gpio模拟的i2c进行数据通信。源码中:

&cm40_i2c {
#address-cells = <1>;
#size-cells = <0>;
clock-frequency = <400000>;
pinctrl-names = "default", "gpio";
pinctrl-0 = <&pinctrl_cm40_i2c>;
pinctrl-1 = <&pinctrl_cm40_i2c_gpio>;
scl-gpios = <&lsio_gpio1 10 GPIO_ACTIVE_HIGH>;
sda-gpios = <&lsio_gpio1 9 GPIO_ACTIVE_HIGH>;
status = "okay";
}

 

使用gpio1-10和gpio1-9模拟的i2c的数据和时钟线。我的i2c驱动加载正常,log中会有一些警告,并不会导致我的驱动加载失败。

但是我在不知到为什么驱动log中会出现错误的提示,尽管这并不影响我的使用。

[ 3.288868] gpio-42 (scl): enforced open drain please flag it properly in DT/ACPI DSDT/board file
[ 3.298184] imx-lpi2c 37230000.i2c: cluo ->using scl,sda for recovery
[ 3.304655] imx-lpi2c 37230000.i2c: can't get the TX DMA channel, error -19!
[ 3.311746] imx-lpi2c 37230000.i2c: error -ENODEV: dma setup error -19, use pio
[ 3.319455] i2c i2c-16: LPI2C adapter registered
[ 3.324910] imx-lpi2c 5a810000.i2c: can't get the TX DMA channel, error -19!
[ 3.331994] imx-lpi2c 5a810000.i2c: error -ENODEV: dma setup error -19, use pio
[ 3.340170] i2c i2c-1: LPI2C adapter registered
[ 3.345849] imx-lpi2c 5a820000.i2c: can't get the TX DMA channel, error -19!
[ 3.352989] imx-lpi2c 5a820000.i2c: error -ENODEV: dma setup error -19, use pio
[ 3.489700] i2c i2c-2: LPI2C adapter registered

 

我的i2c-1(不是gpio模拟)和i2c-2总线(不是gpio模拟的)扫描正常。但是我的i2c-16是使用gpio模拟的i2c总线,在扫描的时候会出现卡顿一下的情况:

mek_8q:/ # i2cdetect -y 16
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
[ 83.344813] AidlLazyServiceRegistrar: Process has 0 (of 1 available) client(s) in use after notification android.apex.IApexService has clients: 0
[ 83.359267] AidlLazyServiceRegistrar: Trying to shut down the service. No clients in use for any service in process.
[ 83.371976] AidlLazyServiceRegistrar: Unregistered all clients and exiting
[ 83.383746] printk: Binder:313_2: 221 output lines suppressed due to ratelimiting
[ 83.393267] init: Service 'apexd' (pid 313) exited with status 0 oneshot service took 60.764000 seconds in background
[ 83.405248] init: Sending signal 9 to service 'apexd' (pid 313) process group...
[ 83.413305] libprocessgroup: Successfully killed process cgroup uid 0 pid 313 in 0ms
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

 

可以清楚的看到当我扫描i2c-16的时候,我会马上显示00 ~ 0F的地址,但是我的10~1F的地址中间会卡顿大概2s,此时如果有log打印则会显示在i2c总线地址的中间。并且我的i2c-16的0x1a的地址上挂载了一个wm8960的音频芯片,我并没有扫描到对应的外设。我试着去i2cdump对应的寄存器。但是他提示我链接超时:

mek_8q:/ # i2cdump -f -y 16 0x1a
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
i2cdump: i2c_read_byte: Connection timed out

我尝试去修改i2c的速率,但是这并没有任何改善。

我用示波器去测量,发现我的数据线会马上被拉底2s左右(i2c扫描卡顿)然后才会有一段正常的数据出现

我现在不知道该如何去解决这个bug。请你们帮助我!

十分感谢你们,并期待你们的回复!

 

 

0 Kudos
0 Replies