MIFARE DESFire Light Invalid Command String Error

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MIFARE DESFire Light Invalid Command String Error

ソリューションへジャンプ
2,639件の閲覧回数
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 解決策
2,430件の閲覧回数
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.
-------------------------------------------------------------------------------

元の投稿で解決策を見る

6 返答(返信)
2,430件の閲覧回数
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 件の賞賛
返信
2,430件の閲覧回数
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 件の賞賛
返信
2,430件の閲覧回数
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 件の賞賛
返信
2,430件の閲覧回数
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 件の賞賛
返信
2,431件の閲覧回数
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,430件の閲覧回数
wilmer_suarez
Contributor III

Yes, thank you. This helped a lot.

0 件の賞賛
返信