Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 6980

Troubleshooting • Python GPIO error

$
0
0
Good morning

I am trying to use a MFRC522 RFID reader with a pi5 using python.

Here is my script:

Code:

import RPi.GPIO as GPIOfrom mfrc522 import SimpleMFRC522# Create an instance of SimpleMFRC522reader = SimpleMFRC522()try:    # Read the RFID tag    id, text = reader.read()    print("ID: ", id)    print("Text: ", text)finally:    # Cleanup the GPIO    GPIO.cleanup()
But when I try to run it i get the following error:
(env) pi@HIB2:~ $ python3 /home/pi/env/bin/kiosk/rfidread.py
Traceback (most recent call last):
File "/home/pi/env/bin/kiosk/rfidread.py", line 5, in <module>
reader = SimpleMFRC522()
^^^^^^^^^^^^^^^
File "/home/pi/env/lib/python3.11/site-packages/mfrc522/SimpleMFRC522.py", line 14, in __init__
self.READER = MFRC522()
^^^^^^^^^
File "/home/pi/env/lib/python3.11/site-packages/mfrc522/MFRC522.py", line 151, in __init__
GPIO.setup(pin_rst, GPIO.OUT)
RuntimeError: Cannot determine SOC peripheral base address
I understand that the GPIO libraries have changed for a pi5 from earlier models I have installed lgpio:
sudo apt install python3-rpi-lgpio
[sudo] password for pi:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
python3-rpi-lgpio is already the newest version (0.6-0~rpt1).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
Can anyone help get me out of my current cul de sac?

Statistics: Posted by leegreg77 — Fri Jan 17, 2025 11:30 am — Replies 2 — Views 55



Viewing all articles
Browse latest Browse all 6980

Trending Articles