1

I use Adafruit_CircuitPython_PN532 to read the card id with a PN532 on SPI. After booting my pi my script doesn't work. However, when I execute nfc-poll in a terminal everything works fine.

My python script:

import board
import busio
from digitalio import DigitalInOut
import spi
from adafruit_pn532.spi import PN532_SPI

# SPI connection
spi_device = busio.SPI(board.SCK, board.MOSI, board.MISO)
cs_pin = DigitalInOut(board.D5)
pn532 = PN532_SPI(spi_device, cs_pin, debug=False)

ic, ver, rev, support = pn532.firmware_version
Terminal.write("[PN532] Found PN532 with firmware version: {0}.{1}".format(ver, rev))

What am I missing what nfc-poll does?

3
  • that depends on what you currently think that it does
    – jsotola
    Jun 6 at 3:14
  • 1
    I don't know. The scripts ends with printing "PN532 not found", when calling the PN532_SPI constructor before executing nfc-poll. Jun 6 at 7:55
  • 1
    You should probably include a schematic showing how the PN532 is connected. Are your running the script right at boot time? If so, does it change anything if you delay a bit?
    – jcaron
    Jun 6 at 15:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.