在使用pn7160的时候,i2c通信正常,但是上层一直读取nfc不成功。一直在接收中断
之中有几个容易犯错的点:
从其他同版本上面机器上面移植过来的程序不一定没问题,只能说驱动出现问题概率比较低
中断一直显示
03-12 16:48:06.856 1248 1453 I libnfc_nci: [INFO:nfc_ncif.cc(815)] NFC received ntf gid:1
03-12 16:48:06.857 1248 1453 E libnfc_nci: [ERROR:nci_hrcv.cc(336)] unknown opcode:0x23
03-12 16:48:06.857 326 1455 D NxpTml : PN54X - Read requested.....
03-12 16:48:06.858 326 1455 D NxpTml : PN54X - Invoking I2C Read.....
01-18 08:00:48.215 1455 1455 W pn544_dev_read: reading 3 bytes.
01-18 08:00:48.215 1455 1455 W pn544_dev_read: block in reading.
03-12 16:48:07.138 485 516 W libprocessgroup: Failed to open /dev/stune/background/cgroup.procs: No such file or directory
01-18 08:00:48.709 0 0 W : [ C0] pn544 irq enter ----
01-18 08:00:48.709 1455 1455 W pn544_dev_read: Wakeup form irq.
01-18 08:00:48.709 1455 1455 W pn544_dev_read: start i2c transfer.
03-12 16:48:07.353 326 1455 E NxpTml : _>>>>> Empty packet recieved !!
03-12 16:48:07.353 326 1455 D NxpTml : PN54X - I2C Read successful.....len = 3
03-12 16:48:07.353 326 1455 D NxpTml : PN54X - Posting read message.....
03-12 16:48:07.353 326 1455 D NxpNciR : len = 3 <= 612300
03-12 16:48:07.353 326 1458 D NxpHal : read successful status = 0x0
03-12 16:48:07.355 326 1455 D NxpTml : PN54X - Read requested.....
03-12 16:48:07.355 326 1455 D NxpTml : PN54X - Invoking I2C Read.....
01-18 08:00:48.710 1455 1455 W IFD->PC :
01-18 08:00:48.710 1455 1455 W : 61
01-18 08:00:48.710 1455 1455 W : 23
01-18 08:00:48.710 1455 1455 W : 00
01-18 08:00:48.712 1455 1455 W pn544_dev_read: reading 3 bytes.
03-12 16:48:07.355 1248 1453 I libnfc_nci: [INFO:nfc_ncif.cc(815)] NFC received ntf gid:1
01-18 08:00:48.712 1455 1455 W pn544_dev_read: block in reading.
03-12 16:48:07.357 1248 1453 E libnfc_nci: [ERROR:nci_hrcv.cc(336)] unknown opcode:0x23
根据上面一直接收的中断log,正常来说没做过nfc的是不知道怎样去解决的。
解决思路
1、百度
2、模块提供商的支持群
3、nxp的官网论坛
4、看看之前有没有人做过,对比一下相关文件
最后是在nxp的论坛上面发现解决思路
(nfc读取不正常原因是,软件需要设置对应电压的参数)
OM27160| Development Kits for PN7160 Plug’n Play NFC Controller | NXP Semiconductors
搜pn7160找到
然后打开查阅对应地方
最后修改vendor/nxp/pn8xt/hw/pn7160/libnfc-nxp.conf文件
NXP_EXT_TVDD_CFG_1={20, 02, 0F, 01, A0, 0E, 0B, 31, 01, 01, 31, 00, 00, 00, 10, 00, 00, 0C}
重新编译,问题解决。
2、还有一种情况出现类型场景是,产线烧录的有问题,可能nfc固件不能烧入到内核里面,重新烧录一次