🤖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

    Units
    2
    4
    5.8k
    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
      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
        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
          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
            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
            • First post
              Last post