0

I am using this micropython library -> https://github.com/wendlers/micropython-mfrc522/blob/master/mfrc522.py

I have my pi pico connected to my raspberry pi 4 over USB. When I run read.do_read() it totally restarts my raspberry pi pico and I see this error: Traceback (most recent call last):autoconnect: /dev/ttyACM2 action: remove which tells me that the board itself has some issues.

I did confirm that the wires are connected properly. I soldered the pin headers onto the RC522 and I can confirm that there are no solder bridges or anything that might short circuit it. I also can confirm that it is connected to 3.3V power and Ground. I also wanted to see if the RFID itself was interfering with the pi pico so I tried to run it while a separate pi pico was running an LED blink routine at the same time, but there were no issues with that one.

Is it some issue in my code? I'm just following the example, otherwise could it just be my raspberry pi itself?

Here is my code I'm testing with:

import mfrc522
from os import uname
print(uname()[0])

def do_read():
    if uname()[0] == 'rp2':
        rdr = mfrc522.MFRC522(14, 16, 15, 22, 17)
    elif uname()[0] == 'esp8266':
        rdr = mfrc522.MFRC522(0, 2, 4, 5, 14)
    else:
        raise RuntimeError("Unsupported platform")

    print("")
    print("Place card before reader to read from address 0x08")
    print("")

    try:
        while True:

            (stat, tag_type) = rdr.request(rdr.REQIDL)

            if stat == rdr.OK:

                (stat, raw_uid) = rdr.anticoll()

                if stat == rdr.OK:
                    print("New card detected")
                    print("  - tag type: 0x%02x" % tag_type)
                    print("  - uid   : 0x%02x%02x%02x%02x" % (raw_uid[0], raw_uid[1], raw_uid[2], raw_uid[3]))
                    print("")

                    if rdr.select_tag(raw_uid) == rdr.OK:

                        key = [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]

                        if rdr.auth(rdr.AUTHENT1A, 8, key, raw_uid) == rdr.OK:
                            print("Address 8 data: %s" % rdr.read(8))
                            rdr.stop_crypto1()
                        else:
                            print("Authentication error")
                    else:
                        print("Failed to select tag")

    except KeyboardInterrupt:
        print("Bye")

1 Answer 1

0

Swapped the library with the code from this youtube video and it works perfectly lol -> https://www.youtube.com/watch?v=blW7QlMOhh8

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Apr 22 at 16:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.