Nodon
Nodon

Reputation: 1027

How to do a protocol for SerialPort with error check?

I have a device, which send me messages like this [CommandID][Data][Data][CRC]. If CRC not equal i will skip this command, because i know the command lenght. But what i have to do if any byte will lose in transmission?

Upvotes: 0

Views: 118

Answers (1)

stoarch
stoarch

Reputation: 44

Your CRC check will fail. And you must query again. I'm preferring to query 3-5 times before failing. Hardware unstable and very good chanel/device can fail.

Upvotes: 1

Related Questions