miguelbalboa / rfid

Arduino RFID Library for MFRC522
The Unlicense
2.75k stars 1.43k forks source link

ISO/IEC 14443-4 Cards, does not or not properly work #458

Closed knopserl closed 2 years ago

knopserl commented 5 years ago

Arduino IDE version: 1.8.7 MFRC522 Library version: latestd master, (1.4.3) just downlaoded and installed on 22.3.2019 via Arduino Library Manager Arduino device: Wemos D1 Mini (ESP8266) MFRC522 device: MFRC-522 (RFID-RC522) with NXP Chip, Firmware v92 V2.0 from Aliexpress

I know, this was already discussed and the thread was closed, but before I give up on that and change the reader, I anted to confirm, that this is either solved or not solvable (because of the reader)

I have also many of this RC522 cards with firmware v92 version 2 which is the most recent version from NXP. THe library is really great, but I have now new Security Chips (Cards) with obviously ISO 14443-4 type and cant communicate with the controller. I guess the same type of chips on my Maeastro and Credit Card as I have the same type and the same problem. I have used the MFRC522Extended.h class I get timeouts if I communicate with the cards using the proper (according to the docu) command structure. I have used both: TCL_Transceive and PCD_TransceiveData. I think it might be also a problem of the MFRC522 readers as they could have problems with ISO 14443-4 (non A) cards. Can anybody confirm that or have a solution? I have already odered other readers like PN532 which claims to read ISO 14443-4 cards.

Here my log:

UID: 0123456789abcdefaa55 Card UID: 01 23 45 67 89 AB CD EF AA 55 Card SAK: 20 PICC type: PICC compliant with ISO/IEC 14443-4 Dumping memory contents not implemented for that PICC type.

PCD_TransceiveData status=3 0000000000000000000000000000000000000000000000000000000000000000

Rotzbua commented 5 years ago

please add the basic information from template:


Arduino IDE version: _____
MFRC522 Library version: _____
Arduino device: _____
MFRC522 device: _____
knopserl commented 5 years ago

@Rotzbua ok, here are the missing infos

Arduino IDE version: 1.8.7

MFRC522 Library version: latestd master, (1.4.3) just downloaded and installed on 22.3.2019 via Arduino Library Manager

Arduino device: Wemos D1 Mini (ESP8266) as well as LOLIN32

MFRC522 device: MFRC-522 (RFID-RC522) with NXP Chip, Firmware v92 V2.0 from Aliexpress https://de.aliexpress.com/item/MFRC-522-RC-522-RC522-13-56-MHz-RFID-Modul-F-r-arduino-SPI-Schriftsteller-Reader/32909482286.html?spm=a2g0x.search0104.3.1.3cb06d5bH0XaRL&ws_ab_test=searchweb0_0%2Csearchweb201602_9_10065_10068_10547_319_317_10548_10696_10084_453_10083_454_10618_10304_10307_10820_10821_537_10302_536_10902_10059_10884_10887_321_322_10103%2Csearchweb201603_70%2CppcSwitch_0&algo_pvid=a7814690-355f-434c-8af9-bc7d8cb7f71f&algo_expid=a7814690-355f-434c-8af9-bc7d8cb7f71f-0

Code: Attached the code of the sketch (currenty only the code parts for the RFID chip reading is active).

ESP8266_IFX_Card.zip

Comment: The cards which come with the RFID-RC522 work fine, but don't have the feature I'm using/I need. I'm using the IFX Security Controller which is also in Pasports, Mater Card, Maestro Card ...

Card UID: 01 23 45 67 89 AB CD EF AA 55 Card SAK: 20 PICC type: PICC compliant with ISO/IEC 14443-4

I have tried the PCD_TransceiveData, and TCL_Transceive (MFRC522Extended). Maybe I'm doing something wrong. I have tried much more than what is now left in the sketch. I have not found examples how to use the TransceiverData and Transceive for 14443-4.

knopserl commented 5 years ago

I got the PN532 NFC Reader and with that, I can read the Security Card using the isDataExchange API and I get a response from the Security Controller (0x90 00 which is success)

bitkinbitki commented 5 years ago

@knopserl I've same issue with mfrc522 IC. I want to try with PN532 reader like you do but I didn't find isDataExchange API. Could you help me?

knopserl commented 5 years ago

@bitkinbitki I was switching to a PN532 library. This one seem to work for me https://github.com/elechouse/PN532. At least I could communicate with the security processor on the chipcard. Take a look if this helps. I used the API: nfc.inDataExchange(selectApdu, sizeof(selectApdu), response, &responseLength) of this lib.

knopserl commented 4 years ago

as this is still open and I did not give up using this very nice library, I spent another couple of hours but no success so far. I'm using an Infineon Security2Go card which I was told, that is compareable to standard credit or passport chips. So these cards are definitly NO Mifare tags but have a standard ISO/IEC 14443-4 interface to the PICC (security controller). The key question is: can the RC522 and the library in principle support non Mifar cards like the one above? Otherwise I will spend (and did already spent) days with no success.

There is a detailed documentation available: https://github.com/Infineon/Blockchain/blob/master/doc/BlockchainSecurity2Go_UserManual.pdf I attach also the sketch and the respone I get from the PICC:

So I no longer get a command timeout but a wrong result. It should be length of 75 and according to chaper 4.3.1 (SELECT command) the last two bytes shall be 0x90 00 (success). The sketch with the PN532 returns length 75 and the last to bytes are 0x90 00.

I have tried to look at the PN532 code (which works with the PN532) but was not able to get a "translated" or adopted code to work with this libary (send command code with select statement) using this API: inDataExchange(selectApdu, sizeof(selectApdu), response, &responseLength)

I get this as response from the Tag (which is wrong): NFC Manager Firmware Version: 0x92 = v2.0 waiting for cards Card placed Card UID: 01 23 45 67 89 AB CD EF AA 55 .#Eg.....U

nfcType: SECURITY, PICC compliant with ISO/IEC 14443-4 retlen: 64 23 00 00 00 13 00 00 00 00 FF 00 00 00 00 FF 00 00 00 00 FF 0B 0E 0D 80 50 1F FB 3F 14 01 FC 3F FA 10 40 3F 10 00 00 00 00 FF 00 00 00 00 FF 00 00 00 00 FF 57 0E 0D 80 70 1F FB 3F 14 01 FC 3F #.......................P..?...?..@?................W...p..?...?

Maybe we are not so far away and just a small thing is missing/wrong, or the RC522 does not read such cards (I believe it can communicate with this card, I hope).

ESP32_NFC_RC522.zip

Rotzbua commented 4 years ago

Note: may related to #312.

xsulitoz commented 2 years ago

Since you have already got the PN532 reader, would you please try it with a smartphones and see if the UID is changing or not? I will be very thankful for you if you did. please contact me on xsulitoz@gmail.com

Obsttube commented 1 year ago

@knopserl In line 118 in ESP32_NFC_RC522.ino from ESP32_NFC_RC522.zip change "uint8_t dat[64];" to "uint8_t dat[75];" or maybe better to sth like "uint8_t dat[128];" Let me know if it works now or how you ended up solving it.

edit: You didn't set dat[0...n] to 0... You just get random data that changes every time you restart Arduino I guess. set all dat to zeros,eg.: for (int i = 0; i < 64; i++) { dat[i] = 0; }

(change 64 to 75 or 128)

sharuhabeel-shareef commented 1 year ago

So this closed as solve ? where you able to get the reading on

Card SAK: 20 PICC type: PICC compliant with ISO/IEC 14443-4 Dumping memory contents not implemented for that PICC type.

Such type of cards ?