Stefan
Stefan

Reputation: 1

get challenge with arduino nfc MFRC522 module from an epassport

I am working with my Ardunio and the contactless reader/writer MFRC522 from NXP. I am using my ePassport (EU standard) and I want to start the Basic Access Control (BAC) procedure by sending the Get Challenge APDU command to its RFID chip.

Here in stackoverflow I found the APDU 00 84 00 00 08. To implement it on my Ardunio project I use the library of miguelbalboa (accessed here). Within this library there is a method to send data to an RFID chip and store its response. But first I get the ATQA which is the ATR equivalent to a contact card (which is in my case 00 08) and then a SAK (which is in my case 20). The library notes that it detected PICC compliant with ISO/IEC 14443-4 in my ePassport and finally I get its randomized UID. Next step I try to get the challenge with

// create MFRC522 instance „mfrc522“
// Init SPI bus 
// Init MFRC522 device
// Select RFID chip (PICC_Select method)
byte sendData[] = {0x00, 0x84, 0x00, 0x00, 0x08};
byte backLen = 10; // I know that the answer (= the challenge) is 8 bytes long + 2 bytes for SW1 + SW2
byte sendLen = sizeof(sendData);
byte backData[backLen];
MFRC522::StatusCode status = mfrc522.PCD_TransceiveData(sendData, sizeof(sendData), backData, &backLen);
// Print „status“

No matter what I do/change/extend, the StatusCode returned is always

Timeout in communication

and I can’t find out: What am I doing wrong? I am now doubting that it is a programming error but maybe rather a hardware issue? Maybe the FIFO buffer on the MFRC522 does not accept this command although I didn’t find any restrictions in its technical specs but then I am thinking: all I do is sending and receiving bytes according to the ISO/IEC 7816-4 standard with an ISO/IEC 14443-4 contactless RFID chip…

EDIT: I tried the APDU command with my NFC device in my smartphone and an APDU Debug app from Google Play Store and there it works fine! So the chip or the APDU command itself can’t be the problem.

Upvotes: 0

Views: 1729

Answers (1)

Have you tried sending a T=1 block?

The Block format PCB|CID|INF|EDC. This is described in http://read.pudn.com/downloads64/ebook/225463/M305_DESFireISO14443.pdf

I had success sending the GetVersion to DESFire but it timeout trying to fetch the next frame (0xAF)

Upvotes: 0

Related Questions