React to interrupt (IRQ) of PN532

Asked by Florian

Hello everyone.

I was able to successfully install my PN532 board to a Raspberry PI via serial (UART). Tagtool.py is also working with --device tty:AMA0:pn53x.

However I saw that the example code is using polling to wait for a tag to be read. Has anyone of you ever managed to utilize the board’s IRQ to actually trigger the card read command?

I’d love to use GPIO.add_event_detect(IRQ_PIN, GPIO.FALLING, callback=my_callback_to_actually_read_the_tag)

Thank you very much for your answers and support,
Florian

Question information

Language:
English Edit question
Status:
Answered
For:
nfcpy Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Stephen Tiedemann (stephen-tiedemann) said :
#1

I haven't tried myself, but the key to handle the polling loop in the PN532 is to use InAutoPoll instead of InListPassiveTarget. With properly configured InAutoPoll the host can just wait for the answer, whatever it takes. The IRP_PIN is actually unusable for card detection when the link is HSU, it only fires when the PN532 is configured as a target (card) to indicate that a reader came close and started communication. The use of IRP_PIN is different in SPI mode, where it fires for every chip response (ack or data response). But this should actually be evaluated by the host's SPI hardware interface, I'd hope.

Can you help with this problem?

Provide an answer of your own, or ask Florian for more information if necessary.

To post a message you must log in.