Basic serial messages are being transferred between an embedded device and a PC app.
MCU UART Peripheral -> FTDI cable -> PC USB Serial Library
The messages are currently fixed-length (32B) and being transferred in the format:
start_low_byte start_high_byte payload_0 payload_1 ... payload_(n-1) end_low_byte end_high_byte
Where not all of the payload bytes are necessarily being used.
Now I know there are many tradeoffs that are application dependent (fault-tolerant, bandwidth => overhead/payload ratio limitations, range of the values in the payload, etc). In this case, I'm trying to transfer an arbitrary payload which makes me wonder:
If needed, how can I ever transmit a start or end sequence? And is there any advantage to having a separate start and stop sequence, or is a single delimiter sequence OK?
If I escape the start/stop sequence, then my message seems as though it can grow up to twice as long.