🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    RFID-Unit Reading and Writing do not work in UIFlow

    Scheduled Pinned Locked Moved Units
    4 Posts 2 Posters 7.2k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E Offline
      endurojunky
      last edited by

      Hello
      I am using a M5StickC with the RFID-Unit from M5Stack and I am not able to find a solution for my Problem on the internet. Everyone using RFID-Units is only using the UID of their Tags but I also want to Read and Write into Storage Blocks. So I am using UIFlow to programm and there is a libary from M5 but "write "" to address X" and "read String from address X" seem not to be working. I tried it out a few times now and all i can get is if a card is near and the UID but thats not what I want.
      Please Help Me

      1 Reply Last reply Reply Quote 0
      • sodokuS Offline
        sodoku
        last edited by

        You might be using the wrong key to authenticate to the RFID sectors. See https://stackoverflow.com/questions/56225136/mifare-classic-standard-keys

        For my Mifare Classic tag, I go lucky with using FFFFFFFFFFFF as key B to access sector 4. Unfortunately they key cannot be changed in the UIFlow block, you have to manually change it in the Python code. For example:

        label0.setText(str(rfid0.readBlockStr(4, keyB=[0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF])))
        
        1 Reply Last reply Reply Quote 0
        • E Offline
          endurojunky
          last edited by

          @sodoku Thank you for your quick answer! It worked really well. How did you know this? As I researched I did not found anything about this. But im really glad that you helped me.

          My running code for reading and writing looks as followed:
          if rfid0.isCardOn():
          label0.setText(str(rfid0.readUid()))
          rfid0.writeBlock(4,'Test', keyB=[0xFF,0xFF,0xFF,0xFF,0xFF,0xFF])
          label1.setText(str(rfid0.readBlockStr(4, keyB=[0xFF,0xFF,0xFF,0xFF,0xFF,0xFF])))
          else:
          label0.setText('UID')
          label1.setText('Text')

          1 Reply Last reply Reply Quote 0
          • sodokuS Offline
            sodoku
            last edited by

            @endurojunky I am glad you got it to work. :)

            I couldn't get my RFID unit working in the beginning too, so I used an Android app for testing. That app tells you what keys it used to access the individual sectors. I then google for rfid default keys and found the link I mentioned. The UIFlow block doesn't allow to change the keys, so I looked at the source code of UIFlow. That source unfortunately wasn't update for two years, but the RFID unit is in there. There I found the default key being used: https://github.com/m5stack/UIFlow-Code/blob/master/units/_rfid.py#L284. This also helped me to find out how to set the keys.

            1 Reply Last reply Reply Quote 0
            • T taunushexe referenced this topic on

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post