Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IOERROR] - problem when doing i2c communication on the raspberry pi 5 using the Elechouse NFC Module V3 #25

Open
ekinsol opened this issue Dec 28, 2024 · 1 comment
Labels
bug Something isn't working ioerror Describes an IOError (communication Error)

Comments

@ekinsol
Copy link

ekinsol commented Dec 28, 2024

What happened?

I have a PN532 NFC MODULE V3 connected over i2c.

OS: Debian GNU/Linux 12 (bookworm)
Device: Rasbpberry Pi 5

sudo i2cdetect -y 1 -> Shows it connected on 0x24
nfc-poll also detects cards:

nfc-poll uses libnfc 1.8.0
NFC reader: PN532 over I2C opened
NFC device will poll during 36000 ms (20 pollings of 300 ms for 6 modulations)
ISO/IEC 14443A (106 kbps) target:
ATQA (SENS_RES): 00 44
UID (NFCID1): 04 a3 0b 5a eb 6c 80
SAK (SEL_RES): 00

Couldn't get my scripts to work, so now switched to the example (ntag21x_rw.py).

When running the sample, I get this error.

-------Looking for PN532--------
Traceback (most recent call last):
  File "/home/p1/flowz/devicebridge/pn532pi/examples/ntag21x_rw.py", line 77, in <module>
    setup()
  File "/home/p1/flowz/devicebridge/pn532pi/examples/ntag21x_rw.py", line 39, in setup
    versiondata = nfc.getFirmwareVersion()
                  ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/p1/flowz/devicebridge/flowz/lib/python3.11/site-packages/pn532pi/nfc/pn532.py", line 183, in getFirmwareVersion
    if (self._interface.writeCommand(bytearray([PN532_COMMAND_GETFIRMWAREVERSION]))):
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/p1/flowz/devicebridge/flowz/lib/python3.11/site-packages/pn532pi/interfaces/pn532i2c.py", line 58, in writeCommand
    return self._readAckFrame()
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/p1/flowz/devicebridge/flowz/lib/python3.11/site-packages/pn532pi/interfaces/pn532i2c.py", line 160, in _readAckFrame
    responses = self._wire.transaction(reading(PN532_I2C_ADDRESS, len(PN532_ACK) + 1))
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/p1/flowz/devicebridge/flowz/lib/python3.11/site-packages/quick2wire/i2c.py", line 78, in transaction
    ioctl(self.fd, I2C_RDWR, ioctl_arg)
OSError: [Errno 121] Remote I/O error

I can confirm that there is data (0) returned on the SMBus.

import smbus

bus = smbus.SMBus(1)  # I2C bus 1
address = 0x24        # Replace with your NFC device's address
try:
    data = bus.read_byte(address)
    print(f"Read byte: {data}")
except Exception as e:
    print(f"Error accessing I2C device: {e}")

Reproducibility

Always (100% of runs)

Steps to Reproduce

  1. Run example ntag21x_rw.py with i2c connection set to true

Code to reproduce

ntag21x_rw.py example

Host Controller

Raspberry 5

Python Version

3.8

Interface Mode

I2C

Power Supply

Wall adapter 5V

Logic Traces and other details

Can't get sigrok to work :/

@ekinsol ekinsol added bug Something isn't working ioerror Describes an IOError (communication Error) labels Dec 28, 2024
@ekinsol
Copy link
Author

ekinsol commented Dec 28, 2024

Adding info:

After running ntag21x_rw.py and receiving the error, when I do nfc-poll, I get this error message:

nfc-poll uses libnfc 1.8.0
error libnfc.chip.pn53x Unexpected PN53x reply!
pn53x_check_communication: Input / Output Error

Running it the second time then works:

nfc-poll uses libnfc 1.8.0
NFC reader: PN532 over I2C opened
NFC device will poll during 36000 ms (20 pollings of 300 ms for 6 modulations)
ISO/IEC 14443A (106 kbps) target:
ATQA (SENS_RES): 00 44
UID (NFCID1): 04 a3 0b 5a eb 6c 80
SAK (SEL_RES): 00

@ekinsol ekinsol changed the title [IOERROR] - problem when doing i2c communication on the raspberry pi 5 using the Elechose NFC Module V3 [IOERROR] - problem when doing i2c communication on the raspberry pi 5 using the Elechouse NFC Module V3 Dec 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ioerror Describes an IOError (communication Error)
Projects
None yet
Development

No branches or pull requests

1 participant