MIFARE DESFire Light Invalid Command String Error

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

MIFARE DESFire Light Invalid Command String Error

Jump to solution
2,569 Views
wilmer_suarez
Contributor III

I am attempting to write to a MIFARE DESFire Light card using the Write Data command in ISO/IEC 7816 APDU Wrapping and native chaining. The card has a Standard File of size 256. I'm attempting to write exactly 256 bytes but I keep getting a response of "0x917E - Length of command string invalid". I've attempted to make the frame different sizes but that does not help. The datasheet says the card has a frame size of 128 bytes by default; but I still get the same error, so that cannot be the issue.

I tried writing just 7 bytes and that works, so the issue must be length parameter (3 bytes - little endian). If the file size is 256 I should be able to write 256 bytes, no? So, the length parameter should be 00 01 00.

Here's a byte view of the first frame that I'm sending to the card:

C-APDU --> 90 8D 00 00 71 00 00 00 00 00 01 00 |--- 87 bytes of data ---| 00

R-APDU <-- 91 7E

1 Solution
2,360 Views
Kan_Li
NXP TechSupport
NXP TechSupport

I created a doc and video on that topic, please kindly refer to MIFARE DESFire Light read and write demonstration for details.

Hope that helps,

Have a great day,
Kan

 


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

View solution in original post

6 Replies
2,360 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi,

According to the data sheet, up to 248 bytes are allowed to write in one time. Please refer to the following for details.

pastedImage_1.png

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply
2,360 Views
wilmer_suarez
Contributor III

Yes, I have seen this. If 248 bytes are allowed then why wouldn't 87 bytes (+ the MAC) work? My reader's FIFO is limited to 128 bytes. My problem is that the tag isn't responding with an AF status to send the rest of the data. Right now I've forgone the chaining mechanism and I'm manually keeping track of the bytes to send and that seems to be working.

0 Kudos
Reply
2,360 Views
Kan_Li
NXP TechSupport
NXP TechSupport

That is because the comm mode is full and data filed includes secure messaging. Please refer to the following for details.

pastedImage_1.png

pastedImage_2.png

pastedImage_3.png

so due to the padding, you can only write 239 bytes in one command, and the same rule applies for the read operation.

pastedImage_1.png

Hope that makes sense,

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply
2,360 Views
wilmer_suarez
Contributor III

I'm attempting to do the same using RFIDDiscover; but I keep getting the error:

Recv from card: Error, Error: HAL,BUFFER_OVERFLOW
How do I change the buffer size?

0 Kudos
Reply
2,361 Views
Kan_Li
NXP TechSupport
NXP TechSupport

I created a doc and video on that topic, please kindly refer to MIFARE DESFire Light read and write demonstration for details.

Hope that helps,

Have a great day,
Kan

 


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

2,360 Views
wilmer_suarez
Contributor III

Yes, thank you. This helped a lot.

0 Kudos
Reply