UDP communication and CRC16 calculations
-
I am trying to communicate with a TurnStile but cant understand how that build their commands. This is example of command: [^] The command is 0xA005 as it states as CMD but it shows as 05 A0 ... confuses me. Is that really correct? Shoudn't it be A0 05? Any reason for doing it backwards? CRC16 calculation of command should be "1F 4A" according to that example but I have tried to calculate for that command I cant get same result. Anyone can help me with that CRC15 calculation? Regards // Maw
-
I am trying to communicate with a TurnStile but cant understand how that build their commands. This is example of command: [^] The command is 0xA005 as it states as CMD but it shows as 05 A0 ... confuses me. Is that really correct? Shoudn't it be A0 05? Any reason for doing it backwards? CRC16 calculation of command should be "1F 4A" according to that example but I have tried to calculate for that command I cant get same result. Anyone can help me with that CRC15 calculation? Regards // Maw
MaWeRic wrote:
Is that really correct? Shouldn't it be A0 05?
Well 05 A0 is what they say, so I'm inclined to believe it. Though sending little endian over the network is a bit unusual, it is not all *that* weird. As for the CRC16, it seems to use one of the CRC-CCITT polynomials, 0x1021. (I just tried a bunch..) You should be able to plug that in already available crc code.
-
MaWeRic wrote:
Is that really correct? Shouldn't it be A0 05?
Well 05 A0 is what they say, so I'm inclined to believe it. Though sending little endian over the network is a bit unusual, it is not all *that* weird. As for the CRC16, it seems to use one of the CRC-CCITT polynomials, 0x1021. (I just tried a bunch..) You should be able to plug that in already available crc code.
HeyyThanks! If I try this calculator : [^] I try calculate : 05A0 Looking at "CRC-CCITT (XModem)" the result is correct but backwards. Why is that? Edit: I guess I should send it as 1F4A as documentation says? I am totally new to this with UDP and sending bytes. But I gess id I dont ask I dont learn :) I goggled Little and big endians and I guess little endians means sending reversed order? //Henrik
-
HeyyThanks! If I try this calculator : [^] I try calculate : 05A0 Looking at "CRC-CCITT (XModem)" the result is correct but backwards. Why is that? Edit: I guess I should send it as 1F4A as documentation says? I am totally new to this with UDP and sending bytes. But I gess id I dont ask I dont learn :) I goggled Little and big endians and I guess little endians means sending reversed order? //Henrik