I recently started playing around with cheap electronic sensors from Aliexpress with ESP32 and Pi. One of the sensors I got was an MFRC-522 RFID module which came with 2 MIFARE tags. Before actually setting up the RFID module I decided to use the tags with the Home Assistant Android app, which wrote its own data to the tags. I knew nothing about RFID and doing this seems to have made them incompatible with the RC-522 Arduino libraries. I found posts from a few people who had similar problems but no fixes, just people saying they had "bricked" their cards.

The problem was that the authentication keys had been messed up, or overwritten, by the Home Assistant tag data giving errors like:

Card UID: 09 5A F1 05
Card SAK: 08
PICC type: MIFARE 1KB
Sector Block   0  1  2  3   4  5  6  7   8  9 10 11  12 13 14 15  AccessBits
  15     63  PCD_Authenticate() failed: Timeout in communication.
  14     59  PCD_Authenticate() failed: Timeout in communication.
  13     55  PCD_Authenticate() failed: Timeout in communication.
  12     51  PCD_Authenticate() failed: Timeout in communication.
  11     47  PCD_Authenticate() failed: Timeout in communication.
  10     43  PCD_Authenticate() failed: Timeout in communication.
   9     39  PCD_Authenticate() failed: Timeout in communication.
   8     35  PCD_Authenticate() failed: Timeout in communication.
   7     31  PCD_Authenticate() failed: Timeout in communication.
   6     27  PCD_Authenticate() failed: Timeout in communication.
   5     23  PCD_Authenticate() failed: Timeout in communication.
   4     19  PCD_Authenticate() failed: Timeout in communication.
   3     15  PCD_Authenticate() failed: Timeout in communication.
   2     11  PCD_Authenticate() failed: Timeout in communication.
   1      7  PCD_Authenticate() failed: Timeout in communication.
   0      3  PCD_Authenticate() failed: Timeout in communication.

Eventually I found a post saying that you might be able to fix the cards using the NXP tag writer app, but that just said my cards were not compatible. So I almost gave up with using them with the RC522, but then gave it one last try with an app called MIFARE Classic Tool and it worked. All I had to do was chose the Write Tag option, then Factory Format and tick the std.keys key file then I could hold the tag to the phone and format it.

Holding the tag to the MFRC-522 connected to the ESP32 now showed the data from the tag again (which was all nulls after formatting, unsurprisingly :) ).

PXL_20260117_170617308

Previous Post