xSIID and NDEF. Not reading the data?

Hello meow!
I’ve got an xSIID implanted in my body now im a cyber cat!
I’m trying to read data from my ESP32, but I’m running into some issues:
my reader:

I have two text records on my chip, which I wrote using an iPhone (with NFC Tools). I attempted to use the NDEF library from GitHub - TheNitek/NDEF: NDEF Library for Arduino. Read and Write NDEF Messages to NFC tags with Arduino. to read the tag, but I was unsuccessful.

Reading NFC tag
19:21:31.409 -> Pages 4-7
19:21:31.409 -> 01 03 78 18 77 02 03 7B 75 07 03 FF 01 72 91 01 AD DD  ..x.w..{u..�.r�.��
19:21:31.409 -> 77 02 03 7B 75 07 03 FF 01 72 91 01 AD DD 36 27 FB 3F  w..{u..�.r�.��6'�?
19:21:31.409 -> 75 07 03 FF 01 72 91 01 AD DD 36 27 FB 3F 00 FF 00 00  u..�.r�.��6'�?.�..
19:21:31.409 -> 01 72 91 01 AD DD 36 27 FB 3F 00 FF 00 00 00 00 FF 00  .r�.��6'�?.�....�.
19:21:31.409 -> messageLength 0
19:21:31.445 -> ndefStartIndex 0
19:21:31.445 -> 2
19:21:31.445 -> UID: XX XX XX XX XX XX XX
19:21:31.445 -> 
19:21:31.445 -> This NFC Tag contains an NDEF Message with 1 NDEF Record.
19:21:31.445 -> 
19:21:31.445 -> NDEF Record 1
19:21:31.445 ->   TNF: 0
19:21:31.445 ->   Type:   
19:21:31.445 ->   Payload (HEX):   
19:21:31.445 ->   Payload (as String): 

The chip can be read without any issues using NFC Tools. Does this mean the NfcAdapter library is incompatible? If so, why is that the case? What changes should I make to get it working? I’d be interested in forking the library and adding support for xSIID if I knew how to do it.
Thank you!

1 Like

Scan your xSIID with taginfo and post the full scan data so we can compare

I don’t have an android so i (and chatGPT) wrote a NFC dump program (updated)

from the output, there is a lot going on.

[04]  01 03 78 18 |..x.|
[05]  77 02 03 7B |w..{|
[06]  75 07 03 1E |u...|
[07]  91 01 0C 54 |...T|
[08]  02 65 6E 4D |.enM|
[09]  65 6F 77 20 |eow |
[0A]  6D 65 6F 77 |meow|
[0B]  51 01 0A 55 |Q..U|
[0C]  04 62 6F 6E |.bon|
[0D]  67 6F 2E 63 |go.c|
[0E]  61 74 FE 00 |at..|
[0F]  3A 54 02 65 |:T.e|
[10]  6E 0A 42 6F |n.Bo|

it followed by fragments of old data

[63]  5F 63 61 74 |_cat|
[64]  FE 00 00 74 |...t|
[65]  00 00 00 00 |....|
[66]  00 00 00 00 |....|

don’t ask me why i am writing so many meows and cats on it.
and it just empty till

[E1]  53 69 69 44 |SiiD|
[E2]  00 00 FF 00 |....|
[E3]  00 00 00 E2 |....|
[E4]  00 00 00 00 |....|
[E5]  00 00 00 00 |....|
[E6]  00 00 00 00 |....|
[E7]  00 00 00 00 |....|
[E8]  01 00 F8 48 |...H|
[E9]  08 01 00 00 |....|
MIFARE_Read() failed: A MIFARE PICC responded with NAK.

i mean, it’s not broken, but the nfc apps and even phones can still read/write it.
However ndef lib still can’t.

Hopefully this clarified some issue.
Thank you

there is an ios version of taginfo for iphone :slight_smile: … check the linked page and scroll down for the link to the iOS version.

if that really is the accurate output, then the NDEF container is basically broken. does it even read on your iPhone?

as for the RFID unit (WS1850S) and why the data is not the same, it feels like this is data corruption. I see in the spec there are two I2C data rates: Fast mode: up to 400 Kbit/s; High-speed mode: up to 3400 Kbit/s … are you pushing data too fast into your ESP32? it’s a major strap-grab but it’s all i have at the moment.

the ios app gives way less information but here you go





it reads on my phone.

the code read data in normal mode(not fast mode) (0x30)
actually MFRC522.h offer CRC checking already. if there is data corruption the program should log it.
do you think a better nfc reader like PN7150 will help? or the NDEF container is broken like you said. if so how to fix it?

UPDATE:
there was a bug in my dump program that shift 4 bytes every loop (no idea why).
Now it should be the correct dump data. still trying to figure out the NDEF container tho. no idea why the old data is still there… maybe that causing issue with NDEF lib.

1 Like

That would be frustrating AF. What program?

the pastebin i posted. it should help other people who only have an iPhone with no full version of the TagInfo app.

So I updated the dump in the previous post.
ndef is still not reading the correct data on ESP32.

No offense, but

In my experience, ChatGPT isn’t the best programmer. Yes, it’s programs get 90% of the way there most of the time, but you’ll always have to hunt out bugs in the end.

XD so true

Ok so. After my new dump script, i noticed whatever on this chip is not standard NDEF .

[04]  01 03 78 18
[05]  77 02 03 7B
[06]  75 07 03 <- NDEF start byte

what does 10 bytes of data do before NDEF starts? Can i just overwrite it with an empty NDEF header like

[04]  00 00 00 00
[05]  00 00 00 00
[06]  00 00 00 00

and start over again?

The NDEF message envelope and record header contain length TLVs that specify the exact length of the data payload. There’s also a termination byte at the end of the payload. Therefore, it is not necessary to blank or wipe any data after the end of your NDEF message. In fact, doing so would wear memory blocks faster for no reason and take longer to write. In short, you’ve written a long record at some point and that data is in memory, then you wrote a shorter record and after the termination byte you will see the old data. This is normal.

UPDATE:
Write 04-06 with 0 doesn’t work. You need to write this

[04]  03 03 D0 00
[05]  00 FE 00 00

aka command

A2040303D000
A20500FE0000

What does it mean:

A2 Writes one 4 byte page

04 page:
03 indicate it's NDEF format
03 length of record (3 bytes)
D0 NDEF record header
00 type length(0)

05 page:
00 payload length(0)
FE end of the NDEF message

if you have Arduino, here are the scripts. I’m only posting the loop function, as setup is easy to find anywhere.

Read raw data for debugging purpose

 void loop() {
  Serial.println("=====Reading Start=====");
  if (!mfrc522.PICC_IsNewCardPresent()) {
    return;
  }
  if (!mfrc522.PICC_ReadCardSerial()) {
    return;
  }
  Serial.print("Card UID:");
  dump_byte_array(mfrc522.uid.uidByte, mfrc522.uid.size);
  Serial.println();

  Serial.println("Card Data:");
  for (byte block = 0; block < 255; block++) {
    byte buffer[18];
    byte size = sizeof(buffer);
    byte status = mfrc522.MIFARE_Read(block, buffer, &size);
    if (status != MFRC522_I2C::STATUS_OK) {
      Serial.print("MIFARE_Read() failed: ");
      Serial.println(mfrc522.GetStatusCodeName(status));
      break;
    }
    Serial.print("[");
    if (block < 16) {
      Serial.print("0");
    }
    Serial.print(block, HEX);
    Serial.print("] ");
    dump_byte_array(buffer, 4); 
    Serial.println();
  }
  Serial.println("=====Reading End=====");
  delay(1000);
}

void dump_byte_array(byte *buffer, byte bufferSize) {
  for (byte i = 0; i < bufferSize; i++) {
    Serial.print(buffer[i] < 0x10 ? " 0" : " ");
    Serial.print(buffer[i], HEX);
  }
  Serial.print(" |");
  for (byte i = 0; i < bufferSize; i++) {
    if (buffer[i] >= 32 && buffer[i] <= 126) {
      Serial.print((char)buffer[i]);
    } else {
      Serial.print('.'); 
    }
  }
  Serial.print('|');
}

Fix your NDEF format, only when apps don’t work!

void loop() {
  Serial.println("=====Writing Start=====");
  if (!mfrc522.PICC_IsNewCardPresent()) {
    return;
  }
  // Select one of the cards
  if (!mfrc522.PICC_ReadCardSerial()) {
    return;
  }
  // load your bytes here, starts at 0x04
  byte bufferArray[][4] = {
    { 0x03, 0x03, 0xD0, 0x00 },
    { 0x00, 0xFE, 0x00, 0x00 },
  };
  byte size = sizeof(bufferArray[0]);

  for (byte i = 0x04; i <= 0x04 + sizeof(bufferArray) / sizeof(bufferArray[0]) - 1; i++) {
    byte status = mfrc522.MIFARE_Ultralight_Write(i, bufferArray[i - 0x04], size);

    if (status != MFRC522_I2C::STATUS_OK) {
      Serial.print("MIFARE_Ultralight_Write() failed: ");
      Serial.println(mfrc522.GetStatusCodeName(status));
      break;
    }
    dump_byte_array(&i, 1);
    dump_byte_array(bufferArray[i - 0x04], 4);
    Serial.println(mfrc522.GetStatusCodeName(status));
  }
  Serial.println("=====Writing End=====");
  delay(1000);
}

references:

Also, chatGPT can help you explaining your NDEF raw data! Just copy your hex code with page number and ask it to explain byte by byte! Super neat.

Now with a NDEF (start at page 04), NDEF lib can load it without any issue! I can finally be a cyber cat meow!

1 Like

Nice job!