1

我最近买了这个 NFC/RFID 阅读器PN532 模块 V3

我想将它与我的树莓派 3 一起使用。我已经安装并配置了库libnfc。PN532 与 I2C 连接。我已经在我的 RPi 上很好地启用了它。

我的问题是我无法扫描任何东西。事实上,当我nfc-poll在控制台中运行该函数时,我得到了这个:

nfc-poll uses libnfc 1.7.1
NFC reader: pn532_i2c:/dev/i2c-1 opened
NFC device will poll during 30000 ms (20 pollings of 300 ms for 5 modulations)
nfc_initiator_poll_target: Success

在投票期间,我在 PN532 附近经过了很多不同的标签,甚至是那些随它一起到达的标签。但从来没有任何检测。尽管如此,RPi 似乎与 PN532 正确通信,如第二行所示。


该命令i2cdetect -y 1很好地返回:

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

PN532 接线如下:

  • 接地 --> GPIO 6
  • VCC --> GPIO 4
  • SDA --> GPIO 3
  • SCL --> GPIO 5

我检查了接线(我的黄色 LED 灯亮,如果我移除 SDA 或 SCL 连接,我会收到一条错误消息nfc-poll,表明连接正常)


我检查了 PN532 上两个开关的位置以启用 I2C 通信。


我的 libnfc 配置文件 ( /etc/nfc/libnfc.conf) 如下:

# Allow device auto-detection (default: true)
# Note: if this auto-detection is disabled, user has to set manually a device
# configuration using file or environment variable
allow_autoscan = true

# Allow intrusive auto-detection (dehttp://www.jamesrobertson.eu/pages/2014/mar/30/rfid-module.htmlfault: false)
# Warning: intrusive auto-detection can seriously disturb other devices
# This option is not recommended, user should prefer to add manually his device.
allow_intrusive_scan = false

# Set log level (default: error)
# Valid log levels are (in order of verbosity): 0 (none), 1 (error), 2 (info), 3 (debug)
# Note: if you compiled with --enable-debug option, the default log level is "debug"
log_level = 1

# Manually set default device (no default)
# To set a default device, you must set both name and connstring for your device
# Note: if autoscan is enabled, default device will be the first device available in device list.
device.name = "Itead_PN532_SPI"
device.connstring = "pn532_i2c:/dev/i2c-1"

我试图将参数设置allow_intrusive_scantrue,但它不会改变任何东西。


你有什么主意吗 ?非常感谢您提前。

4

1 回答 1

0

“Raspberry Pi 没有提供足够的电流来驱动PN532 chip.如果您尝试PN532关闭Raspberry Pi它,它将随机重置并且可能无法响应命令。相反,您将需要another power source (3.3v) to power the PN532.”

我找到了这篇文章,它可能会有所帮助。 https://pypi.org/project/pn532pi/

于 2021-02-01T14:37:56.003 回答