Search code examples
raspberry-pinfcpn532

Problem with detecting badge with PN532 and Raspberry Pi


I have been trying to detect an tag using the PN532 module that I bought from amazon here:

https://www.amazon.ca/ASHATA-Controller-Raspberry-Interface-Switching/dp/B07XFNDHNS

I followed the tutorial here:

http://wiki.sunfounder.cc/index.php?title=PN532_NFC_Module_for_Raspberry_Pi

I tried using both I2C or SPI, but both results just give me the following when I run nfc-poll:

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

It seems like the PN532 is connected to the Pi properly, but the tag is not being detected or printing any info. I am beginning to wonder if the problem is with the PN352 device itself. Maybe I got a faulty one?

Thanks


Solution

  • Answer

    Update 2020mar29hkt2040

    Part 1 - libnfc v1.17 I2C config tested OK

    The OP has no luck in testing libnfc I2C mode and SPI mode. I tried I2C mode and found everything OK. I guess the OP has not set the config file, or has not set "auto scan = true". See my example libnfc171 config file in Appendix A. PS - (1) My NFC reader can detect a tag without any problem. (2) I am using Rpi4B buster 2020mar13.


    Part 2 - Now testing SPI mode 2020mar29hkt2044

    Sunfounder config instructions recommends lowering SPI speed 50kHz. So I have changed the /bbo/config.txt file as shown in Appendix F.

    / to continue, ...


    References

    (1) The OP's NFC RFID Controller Module

    (2) SunFounder Rpi PN532 NFC Module Tutorial

    (3) Libnfc NFC Library

    (4) Libnfc Configuration Manual

    (5) Libnfc Main Page

    (6) Libnfc: configuration

    (7) Libnfc: nfc-list

    (8) MIFARE Card


    Appendices

    Appendix A - Installing libnfc 1.7.1

    nfc config


    Appendix B - Reading a tag

    reading a tag


    Appendix C - NFC Reader Tested

    NFC


    Appendix D - My NFC readers and tags

    nfc readers and tags


    Appendix E - PN532 NFC reader V3 Wiring

    pn532 v3


    Appendix F - SPI configuration for testing PN532 using libnfc 1.1.7

    spi config