Topic: Commands for DESFire

Hi all,

I'm newbie about MIFARE DESFire. Now, I'm using CLRC632 to read/write DESFire tag (part number MF3ICD4101DUD). However I have some problems.
1. When sending PICC Level Commands such as Getversion (0x60), I have to add 2 byte before the commands (0a and CID). Example:
(get uid 7 bytes)
Reader:     e0 52 (RATS)
Tag:         06 75 77 81 02 80
Reader:     d2 11 00 (PPS)
Tag:  d2
Reader:     0a 02 60 (Getversion)
Tag:         0a 02 af 04 01 01 01 00 18 50
Reader:     af (to get 2nd frame)
Tag: (no response)

I try many parameter such 0a 02 af, ect... but tag does not response data.
I also try Authenticate command:
Reader:     0a 02 0a 00 (key no)
Tag:         0a 02 af 1a c6 66 11 34 c7 07 73
Reader:     af (16 bytes)
Tag: (no response)

Anyone can tell me why adding 2 bytes before op-code?
With af command (get more data), how is right?

Tks!

Re: Commands for DESFire

The problem is solved!

Re: Commands for DESFire

Hi , could you please help for talking about how to solve this, I meet the same issue

Re: Commands for DESFire

Answer is in ISO/IEC14443-4:
The "02" is not CID but PCB and its bit 0 is the block number (counter on one bit...). bit1=1 which means it's an I-block.
So for each new command this bit0 has to be toggled.
In the example, after the GetVersion (PCB=0x02), the next command must be built with a PCB=0x03.
Then PCB=0x02, then 0x03 etc

Phil

Re: Commands for DESFire

Hi yobibe, I knew the bytes meaning,
but currently, the Desfire card can only response the first command I send after sending PPSS command.
whatever command I sending, only the first command after PPSS command (D0 xx xx) can get response from Tags.(Desfire)
after that, I can got nothing response.
could you please help for this.
the log is the same as this poster's author.

thank you very much

Re: Commands for DESFire

I don't have a CLRC632 but here is a similar session with a PN533 and pn53x-tamashell.

Do anticol & RATS, then:
Tx: 42  02  60 
Rx: 00  02  af  04  01  01  01  00  1a  05 
Tx: 42  03  af 
Rx: 00  03  af  04  01  01  01  04  1a  05 
Tx: 42  02  af 
Rx: 00  02  00  04  62  91  a2  8d  29  80  ba  25  15  95  00  46  11 

Ignore first byte, it's for pn532 framing.
See how CID byte is toggled between 02 & 03.

Phil

Re: Commands for DESFire

Hi Yobibe,
now the issue fixed.
thank you very much
Best Regards
Ethan Yi

Re: Commands for DESFire

yobibe wrote:

Answer is in ISO/IEC14443-4:
The "02" is not CID but PCB and its bit 0 is the block number (counter on one bit...). bit1=1 which means it's an I-block.
So for each new command this bit0 has to be toggled.
In the example, after the GetVersion (PCB=0x02), the next command must be built with a PCB=0x03.
Then PCB=0x02, then 0x03 etc

Phil

the "0a"is the pcb,and "02' is the cid.

Re: Commands for DESFire

ethan.yi.ethan wrote:

Hi Yobibe,
now the issue fixed.
thank you very much
Best Regards
Ethan Yi

Hi , could you please help for talking about how to solve this, I meet the same issue

thank you very mucch

Re: Commands for DESFire

pcb bit0 need to be toggled?

Re: Commands for DESFire

i fixed it ,pcb bit0 must be diffrent,first must be 0