LIBNFC无法通过I2C连接到PN532,而超时错误

发布于 2025-02-09 20:16:12 字数 2828 浏览 1 评论 0 原文

我想使用PN532 NFC读取器读取NFC标签,该标签通过I2C连接到Raspberry Pi零。 PI通过 raspi-config 启用了i2c。

尝试使用 nfc-list nfc-pull 访问设备时,我会收到一个超时错误:

$ nfc-list
debug   libnfc.general  log_level is set to 3
debug   libnfc.general  allow_autoscan is set to true
debug   libnfc.general  allow_intrusive_scan is set to false
debug   libnfc.general  1 device(s) defined by user
debug   libnfc.general    #0 name: "PN532 over I2C", connstring: "pn532_i2c:/dev/i2c-1"
nfc-list uses libnfc 1.8.0
debug   libnfc.general  0 device(s) found using acr122_usb driver
debug   libnfc.general  0 device(s) found using pn53x_usb driver
debug   libnfc.chip.pn53x       Diagnose
debug   libnfc.chip.pn53x       Timeout value: 500
debug   libnfc.chip.pn53x       SAMConfiguration
debug   libnfc.chip.pn53x       Timeout value: 1000
debug   libnfc.bus.i2c  TX: 00 00 ff 03 fd d4 14 01 17 00
debug   libnfc.bus.i2c  wrote 10 bytes successfully.
debug   libnfc.driver.pn532_i2c timeout reached with no READY frame.
pn53x_check_communication: Timeout
debug   libnfc.chip.pn53x       InRelease
debug   libnfc.bus.i2c  TX: 00 00 ff 03 fd d4 52 00 da 00
debug   libnfc.bus.i2c  wrote 10 bytes successfully.
debug   libnfc.driver.pn532_i2c timeout reached with no READY frame.
debug   libnfc.general  Unable to open "pn532_i2c:/dev/i2c-1".
nfc-list: ERROR: Unable to open NFC device: pn532_i2c:/dev/i2c-1

可能是相关的I2Cdectect报告,每一个地址都存在一个设备PN532连接到PI:

$ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         08 09 0a 0b 0c 0d 0e 0f
10: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
20: 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f
30: 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f
40: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f
50: 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f
60: 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f
70: 70 71 72 73 74 75 76 77

如果PN532与PI断开连接,则I2CDECT仅找到一个设备:

$ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- 67 -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

/dev和I2C-2中只有两个I2C接口,而I2C-2没有任何连接的设备。

$ ls -la /dev/ | grep i2c
crw-rw----   1 root i2c      89,   1 Jun 23 15:39 i2c-1
crw-rw----   1 root i2c      89,   2 Jun 23 15:35 i2c-2

如何解决超时错误?

I want to read NFC tags using a PN532 NFC reader, which is connected via I2C to a Raspberry Pi Zero. The Pi has I2C enabled via raspi-config.

When attempting to access the device using nfc-list or nfc-pull I get a timeout error:

$ nfc-list
debug   libnfc.general  log_level is set to 3
debug   libnfc.general  allow_autoscan is set to true
debug   libnfc.general  allow_intrusive_scan is set to false
debug   libnfc.general  1 device(s) defined by user
debug   libnfc.general    #0 name: "PN532 over I2C", connstring: "pn532_i2c:/dev/i2c-1"
nfc-list uses libnfc 1.8.0
debug   libnfc.general  0 device(s) found using acr122_usb driver
debug   libnfc.general  0 device(s) found using pn53x_usb driver
debug   libnfc.chip.pn53x       Diagnose
debug   libnfc.chip.pn53x       Timeout value: 500
debug   libnfc.chip.pn53x       SAMConfiguration
debug   libnfc.chip.pn53x       Timeout value: 1000
debug   libnfc.bus.i2c  TX: 00 00 ff 03 fd d4 14 01 17 00
debug   libnfc.bus.i2c  wrote 10 bytes successfully.
debug   libnfc.driver.pn532_i2c timeout reached with no READY frame.
pn53x_check_communication: Timeout
debug   libnfc.chip.pn53x       InRelease
debug   libnfc.bus.i2c  TX: 00 00 ff 03 fd d4 52 00 da 00
debug   libnfc.bus.i2c  wrote 10 bytes successfully.
debug   libnfc.driver.pn532_i2c timeout reached with no READY frame.
debug   libnfc.general  Unable to open "pn532_i2c:/dev/i2c-1".
nfc-list: ERROR: Unable to open NFC device: pn532_i2c:/dev/i2c-1

It may be related that i2cdetect reports that there exists a device at every address once the PN532 is connected to the Pi:

$ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         08 09 0a 0b 0c 0d 0e 0f
10: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
20: 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f
30: 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f
40: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f
50: 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f
60: 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f
70: 70 71 72 73 74 75 76 77

If the PN532 is disconnected from the Pi, i2cdetect only finds one device:

$ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- 67 -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

There are only two i2c interfaces in /dev and i2c-2 does not have any connected devices.

$ ls -la /dev/ | grep i2c
crw-rw----   1 root i2c      89,   1 Jun 23 15:39 i2c-1
crw-rw----   1 root i2c      89,   2 Jun 23 15:35 i2c-2

How do I fix the timeout error?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

最笨的告白 2025-02-16 20:16:12

我想尝试NFC一段时间,然后开始接口PN532 NFC RFID读/写模块v3套件与beaglebone black black

-where-where-where-i-where-i-bought-ther-ther-ther-ther-ther-ther-ther-ther-ther-ther-ther-this-this-kit:

​我尝试通过DTS启用此功能。再加上NFC虽然Menuconfig。但无法启动图像。它悬挂在 pn532_i2c 驱动程序加载的地方

是我所做的更改:

dts更改我进行:

”

我确保在 i2cdetect 上,我能够看到该NFC套件检测到。

一段时间后,我开始探索, libnfc ,我在此方面取得了巨大的成功。我有这个 libnfc 克隆在我的BBB上,并使用以下步骤编译:

autoreconf -vis
./configure --prefix=/usr --sysconfdir=/etc --with-drivers=pn532_i2c
make 
make install

libnfc 在这里:

libnfc

libnfc.conf.conf.sample 如下

更新 img src =“ https://i.sstatic.net/2fksovzm.png” alt =“ libnfc.conf”>

我能够启动和运行NFC使该模块启动并运行的方法。确保您更新 device.name device.connstring 与您的硬件连接匹配。

结果我已经

设置了

“

nfc-list-out

I wanted to try NFC for a while and I started off by interfacing PN532 NFC RFID Read/Write Module V3 Kit with BeagleBone Black

Link-From-Where-I-Bought-This-Kit: PN532 NFC RFID Read / Write Module V3 Kit

Initially, I connected this kit with BBB and I tried enabling this through DTS. Plus also enabled NFC though menuconfig. But couldn't get image booted up. It hung at place where pn532_i2c driver was getting loaded

Here are the changes I made:

OS-Release-info

DTS changes I made:

i2c-1-pins
DeviceTree-Updates

I ensured that on i2cdetect, I was able to see this NFC kit detected.

After a while I started exploring, libnfc and I had good success with this. I had this libnfc cloned on my BBB and compiled using steps below:

autoreconf -vis
./configure --prefix=/usr --sysconfdir=/etc --with-drivers=pn532_i2c
make 
make install

libnfc that I used is here:

libnfc

updated libnfc.conf.sample as below and moved it to /etc/nfc/

libnfc.conf

I was able to get NFC up and running, it's important to update conf in right way to get this module up and running. Ensure you update device.name and device.connstring that matches with your hardware connections.

Results I had

Setup

Setup

nfc-list-output

nfc-list-output

nfc-poll-output

nfc-poll-output

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文