RFID-Unit Reading and Writing do not work in UIFlow

  • 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

  • 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])))

  • @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():
    rfid0.writeBlock(4,'Test', keyB=[0xFF,0xFF,0xFF,0xFF,0xFF,0xFF])
    label1.setText(str(rfid0.readBlockStr(4, keyB=[0xFF,0xFF,0xFF,0xFF,0xFF,0xFF])))

  • @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.