Write a block to Mifare Classic 1k via PN512

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Write a block to Mifare Classic 1k via PN512

2,980 Views
hofrichter
Contributor I

Hello,
I have a problem to write a block to a Mifare Classic 1k card.
Authentication and reading the card works without problems.
When I try to write a block (Command 0xA0) I get an ACK from the card after Write Part 1.
If the data+CRC are transferred afterwards, they are stored on the card,
but I'm not getting an ACK. Further communication with the card is no longer possible.

I use my own code without any library.

Does anyone have any idea why?
Thank you

0 Kudos
Reply
2 Replies

2,730 Views
Jonathan_Iglesias
NXP TechSupport
NXP TechSupport

Hope you are doing great, is it possible that you share more information such as the command logs of the card, key settings, authenticated key, etc.

 for example please check the following log what I basically did is took a Mifare classic authenticated with key A, write to  block 1 and block 2 the read them

ACTIVATE CARD IN ISO 14443 LAYER 3
 
Send to card: 26
Recv from card: 4400
Send to card: 9320
Recv from card: 880469F510
Send to card: 9370880469F510
Recv from card: 04
Send to card: 9520
Recv from card: 5A435280CB
Send to card: 95705A435280CB
Recv from card: 08





WRITE 11111111111111111111111111111111 TO BLOCK 01
Send to card: A001
Recv from card: 0A
Send to card: 11111111111111111111111111111111
Recv from card: 0A



WRITE 22222222222222222222222222222222 TO BLOCK 02
Send to card: A002
Recv from card: 0A
Send to card: 22222222222222222222222222222222
Recv from card: 0A





READ BLOCK 01  
Send to card: 3001
Recv from card: 11111111111111111111111111111111



READ BLOCK 02  
Send to card: 3002
Recv from card: 22222222222222222222222222222222
0 Kudos
Reply

2,730 Views
hofrichter
Contributor I

Hi Jonathan,

thanks for your reply.

First I read the first 8 blocks. Than I try to write the 4th block.

Here are the transferred data:

//REQA
Send: 26
Recv: 04 00

//ANTICOLL
Send: 93 20
Recv: CA 8F 82 08 CF

Send: 93 70 CA 8F 82 08 CF BB 08
Recv: 08 B6 DD

//AUTHENTICATION with Key A (Authenticate via PN512)
Send: 60 00 FF FF FF FF FF FF CA 8F 82 08  via PN512

//READ (Block 0)
Send: 30 00 02 A8
Recv: CA 8F 82 08 CF 08 04 00 62 63 64 65 66 67 68 69 8E C0

//READ (Block 1)
Send: 30 01 8B B9
Recv: D2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 99 4E

//READ (Block 2)
Send: 30 02 10 8B
Recv: D3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 89 C0

//READ (Block 3)
Send: 30 03 10 8B
Recv: 00 00 00 00 00 00 FF 07 80 69 FF FF FF FF FF FF D4 55

//AUTHENTICATION with Key A (Authenticate via PN512)
Send: 60 04 FF FF FF FF FF FF CA 8F 82 08  via PN512

//READ (Block 4)
Send: 30 04 26 EE
Recv: 9F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2D 2E

//READ (Block 5)
Send: 30 05 26 EE
Recv: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 37 49

//READ (Block 6)
Send: 30 06 34 CD
Recv: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 37 49

//READ (Block 7)
Send: 30 07 BD DC
Recv: 00 00 00 00 00 00 FF 07 80 69 FF FF FF FF FF FF D4 55


//WRITE (Block 4)
Send: A0 04 7B F7
Recv: 0A

Send: A0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 23 26
Recv: No Answer. But when i read the Block 4 next time, the Bytes (A0) was written

0 Kudos
Reply