1.前言

这周准备移植nvp6324到hi3519a板子上,可是在加载驱动时候i2c通讯不成功,移植报错hibvt-i2c 4562000.i2c: wait idle abort!, RIS: 0x611问题。之前一直怀疑i2c时序不对,用示波器也没有量出来问题,中间还折腾用gpio模拟i2c,均失败。可是用海思自带工具i2c_read 可以读取寄存器的值,并且是正确的。

2.问题

海思打印如下:

/home # insmod jaguar1.ko 
[DRV] I2C Client Init 
addr =30
Device ID Error... ff, Chip Count:[0]
hibvt-i2c 4562000.i2c: wait idle abort!, RIS: 0x611
hibvt-i2c 4562000.i2c: wait idle abort!, RIS: 0x611
hibvt-i2c 4562000.i2c: wait idle abort!, RIS: 0x611
hibvt-i2c 4562000.i2c: wait idle abort!, RIS: 0x611
Device ID Error... ff, Chip Count:[1]
hibvt-i2c 4562000.i2c: wait idle abort!, RIS: 0x611
hibvt-i2c 4562000.i2c: wait idle abort!, RIS: 0x611
hibvt-i2c 4562000.i2c: wait idle abort!, RIS: 0x611
hibvt-i2c 4562000.i2c: wait idle abort!, RIS: 0x611
Device ID Error... ff, Chip Count:[2]
hibvt-i2c 4562000.i2c: wait idle abort!, RIS: 0x611
hibvt-i2c 4562000.i2c: wait idle abort!, RIS: 0x611
hibvt-i2c 4562000.i2c: wait idle abort!, RIS: 0x611
hibvt-i2c 4562000.i2c: wait idle abort!, RIS: 0x611
Device ID Error... ff, Chip Count:[3]
Chip Count = 0
Address [0xff][0xff][0xff][0xff]
Chip Id [0xff][0xff][0xff][0xff]
Rev Id [0xff][0xff][0xff][0xff]
hibvt-i2c 4562000.i2c: wait i

3.解决方案

     主要提供几个思考方向:

  • 设备地址是否正确(8bit地址和7bit地址区分);
  • 内核驱动是否加载;
  • 复位管脚是否复位后使能;

我的设备就是把复位当作高电平有效,实际是低电平。这样初始化时候芯片复位管脚一直为低,nvp6324处于复位状态,所以通讯不成功。同时也要注意海思GPIO电压是1.8V,而NVP6324的IO管脚是3.3V,上拉电压也不能错。

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐