I'm using nearly identical code with the following https://github.com/gassajor000/pn532pi/ ... 43a_uid.py using the I2C option.
When calling nfc-list in the console I can see the UID of any card or tag on the reader.
When executing the code it crashes 19/20 times. (I've only seen it fully execute once, and that time it was only the first part of the code). However, when running it it usually crashes on nfc.getFirmwareVersion(). However, roughly 30% of the time it prints the version data and crashes on nfc.setPassiveActivationRetries(0xFF). If I comment out this line that 30% chance passes on to the next line nfc.SAMConfig(). When both are commented out I've never seen it get passed getFirmwareVersion.
All this inconsistent behaviour and what I've searched online seems to indicate it is a wiring problem. However, I am very sceptical that is the issue.
![Image]()
Here is how the PN532 is connected to the RPi 5
![Image]()
Here is a close up of the soldering job. Contact should be consistent
The output from nfc-list is the following:This tells me the interface is working correctly. Below is the output I get from executing the code:This is an example of it getting passed getFirmwareVersionIf anybody has any ideas or come across this before, please let me know. If you think it is the wiring please be specific on what needs to be done to correct it. The mapping of the pins is as follows: SCL->pin5, SDA->pin3, VCC->pin4, GND->pin6, though I'm pretty sure if this was wrong nfc-list would never work.
(I'm having trouble getting images to show up, I've tried using image hosting service to link them but they never render, the images are too big to attach even after shrinking them to less than 500Kb. So You'll just have to assume that the soldering job is sufficient)
Thanks,
When calling nfc-list in the console I can see the UID of any card or tag on the reader.
When executing the code it crashes 19/20 times. (I've only seen it fully execute once, and that time it was only the first part of the code). However, when running it it usually crashes on nfc.getFirmwareVersion(). However, roughly 30% of the time it prints the version data and crashes on nfc.setPassiveActivationRetries(0xFF). If I comment out this line that 30% chance passes on to the next line nfc.SAMConfig(). When both are commented out I've never seen it get passed getFirmwareVersion.
All this inconsistent behaviour and what I've searched online seems to indicate it is a wiring problem. However, I am very sceptical that is the issue.
Here is how the PN532 is connected to the RPi 5
Here is a close up of the soldering job. Contact should be consistent
The output from nfc-list is the following:
Code:
nfc-listnfc-list uses libnfc 1.8.0error libnfc.buses.usbbus Unable to find USB busses (No such file or directory)error libnfc.buses.usbbus Unable to find USB busses (No such file or directory)NFC device: PN532 board via I2C opened1 ISO14443A passive target(s) found:ISO/IEC 14443A (106 kbps) target: ATQA (SENS_RES): 00 04 UID (NFCID1): 24 ef 68 b4 SAK (SEL_RES): 08
Code:
Traceback (most recent call last): File "/workspaces/OpenAccess/webserver/test.py", line 10, in <module> versiondata = nfc.getFirmwareVersion() ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/pn532pi/nfc/pn532.py", line 183, in getFirmwareVersion if (self._interface.writeCommand(bytearray([PN532_COMMAND_GETFIRMWAREVERSION]))): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/pn532pi/interfaces/pn532i2c.py", line 58, in writeCommand return self._readAckFrame() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/pn532pi/interfaces/pn532i2c.py", line 160, in _readAckFrame responses = self._wire.transaction(reading(PN532_I2C_ADDRESS, len(PN532_ACK) + 1)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/quick2wire/i2c.py", line 78, in transaction ioctl(self.fd, I2C_RDWR, ioctl_arg)OSError: [Errno 121] Remote I/O error
Code:
Found chip PN5 0x32 Firmware ver. 1.6Traceback (most recent call last): File "/workspaces/OpenAccess/webserver/test.py", line 14, in <module> nfc.setPassiveActivationRetries(0xFF) File "/usr/local/lib/python3.11/dist-packages/pn532pi/nfc/pn532.py", line 371, in setPassiveActivationRetries if (self._interface.writeCommand(header)): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/pn532pi/interfaces/pn532i2c.py", line 58, in writeCommand return self._readAckFrame() ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/pn532pi/interfaces/pn532i2c.py", line 160, in _readAckFrame responses = self._wire.transaction(reading(PN532_I2C_ADDRESS, len(PN532_ACK) + 1)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/dist-packages/quick2wire/i2c.py", line 78, in transaction ioctl(self.fd, I2C_RDWR, ioctl_arg)OSError: [Errno 121] Remote I/O error
(I'm having trouble getting images to show up, I've tried using image hosting service to link them but they never render, the images are too big to attach even after shrinking them to less than 500Kb. So You'll just have to assume that the soldering job is sufficient)
Thanks,
Statistics: Posted by tantonj — Sun Dec 15, 2024 4:38 pm — Replies 0 — Views 5