2022-07-04 8:16 PM
Hello,
We currently have a desktop application based on C# for communicating between ST25R3911B-DISCO board and ST25DV dynamic tag. The application itself is similar to ST PC software for ST25R3911B-DISCO board but with limited functionalities as currently we only need Fast Transfer Mode for communication.
My PC software based on C# is able to perform inventory discovery successfully, and is also able to read the data from mailbox (verified by writing data to mailbox using ST software and reading data by using C# software). But issue arrives when i try to perform Mailbox write operation, the error returned is invalid command code for write operation. I looked at the ST25DV datasheet for RF commands and frame formats also the logs of the ST PC software to understand how the write operation data frame is transmiited but that's different from the data frame that's sent from my application. There are files in my project which adds the protocol header to data frame.
So can anyone please help me what could be the issue here. I have added the payload that sent from my application to ST25DV dynamic tag for both read and write operation below:
Here is the frame format that's sent for read operation which is working:
READ:
--------------------
0F-15-00-44-00-10-04-40-DE-00-0C-22-AC-02-81-38-3F-05-00-25-02-E0-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
1st byte is counter
AC - read cmd
Here is the frame format that's sent for write operation which is not working and throwing error of invalid cmd:
WRITE :
--------------------
01-18-00-44-00-13-04-40-DE-00-0C-22-AA-02-81-38-3F-05-00-25-02-E0-04-FF-FF-FF-FF-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
1st byte is counter
AA - write cmd
04 - data length
FF-FF-FF-FF - data
NOTES:
In both write and read packets, (4-5)bytes before CMD code is same (i.e "40-DE-00-0C-22") and bytes after CMD code is same (i.e "02-81-38-3F-05-00-25-02-E0")
So can you please let me know what could be the possible reason why i am getting this invalid command error, although my command is right.
Solved! Go to Solution.
2022-07-05 2:08 AM
Hi Nikhil,
if you set MSGLength to 04, this means you want to write 5 bytes so the tag is expecting 5 bytes and you send only FF-FF-FF-FF i.e. 4 bytes.
If you want to send only 4 bytes, the MSGlength has to be 03 and the full RF command should be:
22-AA-02-81-38-3F-05-00-25-02-E0-03-FF-FF-FF-FF
Rgds
BT
2022-07-05 12:50 AM
Hi,
the data length is incorrect. "MSGlength parameter of the command is the number of Data bytes minus - 1 (00 for 1 byte of data, FFh for 256 bytes of data)" See § 7.6.31 Write Message and table Table 197. Write Message request format in the ST25DV datasheet.
Rgds
BT
2022-07-05 12:56 AM
Okay, will check this out. But as mentioned the error response which was received was of invalid command code.
2022-07-05 1:35 AM
Hi,
more details about inspect the firmware sources: st_stream.h and dispatcher.c the comment before processCmd().
Decoding the write request above:
I don't find anything wrong here. How is the "invalid command error" reported back to you?
BR, Ulysses
2022-07-05 1:45 AM
Hi Nikhil,
when sending 22-AA-02-81-38-3F-05-00-25-02-E0-04-FF-FF-FF-FF Write message command to the tag, the reply is 01-02 i.e. Command not recognized. As one byte is missing, the command cannot be properly recognized.
Rgds
BT
2022-07-05 1:47 AM
As per previous reply shouldn't the message length be 3 instead of 4 ?
2022-07-05 1:58 AM
Hi Nikhil,
the frame 01-18-00-44-00-13-04-40-DE-00-0C-22-AA-02-81-38-3F-05-00-25-02-E0-04-FF-FF-FF-FF-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 is the frame exchanged from the PC to the ST25R3911B NFC reader device. This frame conveys the RF payload (22-AA-02-81-38-3F-05-00-25-02-E0-04-FF-FF-FF-FF) that is exchanged between the ST25R3911B NFC reader and the ST25DV tag.
Ulysses explanation is related to the frame exchanged between the PC and the ST25R3911B NFC reader. From PC<->ST25R3911B communication protocol point of view, this frame is correct. Only the RF payload has an incorrect MSGlength value of 04 instead of 03.
Rgds
BT
2022-07-05 2:03 AM
Hello Brian,
Can you tell me which byte is missing than ?
2022-07-05 2:07 AM
Okay thanks. So if i send the correct data length (in my case 3) most probably it should successfully transmit right ? And if i still get the error, it could be related to something else ?
2022-07-05 2:08 AM
Hi Nikhil,
if you set MSGLength to 04, this means you want to write 5 bytes so the tag is expecting 5 bytes and you send only FF-FF-FF-FF i.e. 4 bytes.
If you want to send only 4 bytes, the MSGlength has to be 03 and the full RF command should be:
22-AA-02-81-38-3F-05-00-25-02-E0-03-FF-FF-FF-FF
Rgds
BT