Open yfyhboy opened 4 months ago
查出来了,是在ch34x_i2c_xfer里面判断ch34x_dev->chiptype == CHIP_CH341,就执行一次i2c设备检测,这时会先执行一次读取操作,注释掉就好了。 这个地方为什么判断芯片是341,就先读一次?如果是347就不用读?
if (ch34x_dev->chiptype == CHIP_CH341) { //retval = ch34x_i2c_check_dev(ch34x_dev, msgs[0].addr); 注释掉就好了 if (retval < 0) goto exit; }
ubuntu环境下,安装了i2c-tools,使用i2cset、i2ctransfer命令,用逻辑分析仪抓取数据,全是read,没有write
yfyh@yfyh-virtual-machine:~/ch34x_mphsi_master_linux-main/driver$ uname -a Linux yfyh-virtual-machine 6.5.0-26-generic #26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Mar 12 10:22:43 UTC 2 x86_64 x86_64 x86_64 GNU/Linux yfyh@yfyh-virtual-machine:~/ch34x_mphsi_master_linux-main/driver$ i2cset -V i2cset version 4.3
命令是: sudo i2ctransfer -f -y 0 w6@0x5f 0x10 0x04 0x00 0x00 0x00 0x00 sudo i2cset -f -y 0 0x5f 0x10 0x04 0x00 0x00 0x00 0x00 i
逻辑分析仪截图(断开I2C从机测试):