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?