Question

I'm trying to read the content of a Mifare Ultralight card using the NFC Reader Library.

I'm totally new with NFC and I'm using this github repository to start.

The code in this repo allows to detect which type of card is detected (Mifare, Mifare ultralight ...) and read the UID of the card. I added this code in order to read the content of a Mifare ultralight card:

uint8_t bBufferReader[96];
memset(bBufferReader, '\0', 0x60);
PH_CHECK_SUCCESS_FCT(status, phalMful_Read(&alMful, 4, bBufferReader));
int i;
for(i = 0; i < 96; i++){
   printf("%02X", bBufferReader[i]);
}

I have a card that contains the text "Hello world" and when I read it, the piece of code above print the following bytes:

0103A010440312D1010E5402667248650000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

So I'm reading some stuff out of my card, however there is no traces of a "Hello world" text.

Probably missing something (might be a big something or, hopefully, a little something). Any help would be great !

Edit

So I made some good progress. Mifare ultralight contains 16 pages of 4 bytes, 0 - 3 are for internal usage (serial number, lock etc ...) and 4 - 15 are for user data. I can now read the content of my cards, however, just a few question remains:

I'm reading a card that contains an URL, www.google.com, here is what I got:

03 0F D1 01  -> Page 1, 4 bytes of non text data, not sure what it is 
0B 55 01 67  -> Page 2, 3 bytes of non text data, then 1 bytes for the "g"
6F 6F 67 6C  -> Page 3, 4 bytes for "oogl"
65 2E 63 6F  -> Page 4, 4 bytes for "e.co"
6D FE 00 00  -> Page 6, 1 byte  for "m", 1 byte for I don't know
00 00 00 00  -> Other pages are just empty
00 00 00 00 
00 00 00 00 
00 00 00 00 
00 00 00 00 
00 00 00 00 
00 00 00 00 

So I have got 7 bytes of data + my url, "google.com" + 1 byte FE

I can't find what are these 7 prefix bytes + this 1 trailing byte...

Edit again

Ok got it, it's the NDEF message format.

Was it helpful?

Solution

Yes it is NDEF format!

03 NDEF Message
0F length
Record 1
D1 - MB, ME, SR, TNF=”NFC Forum well-known type”
01 Type length
0B Payload length
55 Type - “U”(Abbrivation for URL)  

67  6F 6F 67 6C  65 2E 63 6F 6D (google.com)

Record 2
FE Terminator NDEF
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top