(Sorry for my limited English ability and limited technical ability.)
I have been requested to design an I/O-Control (Communication) Protocol. This simple protocol is designed for a LPC23xx based USBCDC, the USBCDC software solution is based on the open source project LPCUSB. The USB Host side is a Linux X86 platform. So that, the Linux X86 platform can control the I/O Port of my LPC23xx board via USBCDC connection.
Due to my limited technical ability, I am afraid that, I may make some obvious mistakes, or be unable to consider some complicated scenarios. So, please kindly give me some advices.
This simple protocol:
======================== 0xDEF0 -> 2Bytes (Head, 0xDE first) >=======Content=======< Length -> 2Bytes (Little-Endian) C-Type -> 3Bytes C-Data -> 13Bytes (Variable Length) CRC-32 -> 4Bytes (Little-Endian) >=======Content=======< 0xDE0F -> 2Bytes (Tail, 0xDE first) ======================== Length = C-Type size + C-Data size CRC-32 is for { Length, C-Type, C-Data } Stuffing Rule -> Tx-Side replaces all 0xDE of the Content with 0xDEAA Rx-Side replaces all 0xDEAA of the Content with 0xDE So that, the Length and CRC32 fields are also stuffed.
This is my first time doing the Bit Stuffing, are there any obvious defects or potential problems on my design?
And, if my design is acceptable, then I have a question, will the Stuffing break the CRC32 Error Detection? Because, the transmitted data is stuffed, not the same as the original one.