07-05-2017 09:20 AM
Hello guys,
I am working on an RFID, and i need to send a CRC-16 to the reader in the form of a command. I have an example of the crc-16 used by the manufacturer however i have no knowledge of C++ language and some parameters are not clear. Maybe if someone has experience in dealing with CRC-16 can help me out?
I attached a snippet of the VI i am using that contains the CRC-16 calculation and the example given in the reader's manual. Is it possible to check them out and tell me if my VI is correct? Because i am not receiving a reading from the RFID and i am sure the rest of my parameters are correct.
Thank you,
Fadi
Solved! Go to Solution.
07-05-2017 10:55 AM
The labview code seems to match the C code and I see you even swapped the endianness of the I16 it generates.
Any documentation about the request/reply structure? Most smartcards I have seen give some sort of status word response at the end of a reply to denote if your command was good or not (which would also reply as bad if your checksum on your request was wrong).
Deceased
07-05-2017 11:16 AM
Hello Sir,
Thank you for replying,
I attached the reader's manual. In the Vi i previously attached i am trying to send the command " inventory " which returns the EPC of the tag. I think the parameters are correct except for the CRC because in the sample code, i found in the manual ( on page 6), there isn't any indication of what the inputs are. Maybe i shouldn't use all five parameters to return a CRC. If you have good understanding of this problem could you help me figure out what i am missing on?
And to reply to your question, i am not receiving a response from the reader, i just get an empty string indicator.
Should i define all the parameters first? such as power, frequency and all that. For now, i am only looking for a good communication between the PC and reader before building a complex code.
Thank you,
Fadi
07-05-2017 11:47 AM
You are using a length of 8 even though you only have 4 bytes in your message (excluding the length byte). If your length is 8, you should have 4 bytes of data for the command.
07-05-2017 11:52 AM
Hi sir,
you are right, i assigned 8 randomly. The manual specifies 0xXX for length, there isn't a speficied one. I thought that it won't create any problems.
07-05-2017 12:59 PM
You probably have to calculate how long the message is!
07-05-2017 01:05 PM - edited 07-05-2017 01:06 PM
Command:
Len |
Adr |
Cmd |
Data[] |
CRC-16 |
||
AdrTID |
LenTID |
|||||
0xXX |
0xXX |
0x01 |
0xXX |
0xXX |
LSB |
MSB |
Parameter Connect:
AdrTID: One byte. It specifies the starting word address for the TID memory read. For example, AdrTID = 00h specifies the first 16-bit memory word, AdrTID = 01h specifies the second 16-bit memory word, etc.
LenTID: One byte. It specifies the number of 16-bit words to be read. The value is less then 16, otherwise, it returns the parameters error message.
Notes: It will get tags’ EPC values when the AdrTID and LenTID vacant. Otherwise, get tags’ TID values. TID-inventory function is only available for reader with firmware version V2.36 and above.
-----------------------------------------------------------------------------------
From the manual it looks like you want a command like this
0x06 0xFF 0x01 0x00 0x0E + CRC
07-05-2017 01:13 PM
yes, this is it. except i am sending a value of 0 for LenTID as well in order to get the tag's EPC. My length initialization is wrong, but to get things clear, is this type of coding considered strict? if i define a larger length shouldn't it be okey?
So besides the length, if there is anything it's the CRC. And again my concern here is that the manual doesn't define what the inputs are when i am using all the my parameters as inputs.
Thank you for your help
07-05-2017 01:21 PM
I just tried it out and still no response from the reader. I would like to add that if the demo software is running and try to run labview code then i get an error and when i stop the demo software the VI works fine. So i guess Labview is communicating with the serial port connected to the reader.
07-05-2017 01:21 PM
Commonly smartcards will be incredibly strict over packet structure since specifying incorrect lengths can cause buffer overflows.
From the manual:
Two kinds of command reader cannot respond:
------------------------------
I agree its not clear which bytes the crc shoukd include, but best to assume all that are sent (unless it says otherwise) since the purpose of the crc is to detect packet corruption.