Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't read payload data #623

Closed
serkanersozz opened this issue Mar 13, 2024 · 1 comment
Closed

Can't read payload data #623

serkanersozz opened this issue Mar 13, 2024 · 1 comment

Comments

@serkanersozz
Copy link

Step 1: Describe your environment

  • OS version: Ubuntu 22.04
  • Arduino IDE version: 2.3.2
  • MFRC522 Library version: 1.4.11
  • Arduino device: esp32
  • MFRC522 device:

I'm trying to read from mifare 13,56 rfid tags. I can read UID successfully but not payload.

Below what I tried recently and i'm kinda lost it because it shouldn't this hard so I'm looking in the wrong direction, probably.

String dump_byte_array(byte *buffer, byte bufferSize)
{
  String data = "";
  for (byte i = 0; i < bufferSize; i++)
  {
    data.concat(String(buffer[i] < 0x10 ? "0" : ""));
    data.concat(String(buffer[i], HEX));
  }
  Serial.println(data);
  return data;
}

// Running in a device loop so reader is the device index
if (mfrc522[reader].PICC_IsNewCardPresent() && mfrc522[reader].PICC_ReadCardSerial())
    {
      byte buffer[18];
      byte size = sizeof(buffer);
      mfrc522[reader].MIFARE_Read(4, buffer, &size);
      // BELOW DOES NOT WORKS. PRINTS 300426EE00000000000000009022FB3F
      dump_byte_array(buffer, 16);
      // BELOW WORKS
      card_id = dump_byte_array(mfrc522[reader].uid.uidByte, mfrc522[reader].uid.size);
      mfrc522[reader].PICC_HaltA();
      mfrc522[reader].PCD_StopCrypto1();
    }
@Rotzbua
Copy link
Collaborator

Rotzbua commented Feb 17, 2025

I think correct is:

dump_byte_array(buffer, size);

@Rotzbua Rotzbua closed this as not planned Won't fix, can't repro, duplicate, stale Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants