COBS - Consistent Overhead Byte StuffingVery nice and simple protocol See https://en.wikipedia.org/wiki/Consistent_Overhead_Byte_Stuffing The cobs ideaThe basic idea behind cobs is to have a binary protocol with minimized stuffing overhead. The overhead is only 1 or 2 bytes. The limitation is that the lenght of one package is 254 bytes. There is no fail detection or cerrection in the cobs protocol itself. For that reason a CRC-16 checksum detection has been coded and is given below. Download an Arduino impl here An exampleJust an example With crc16
CRC16 library codeA small note: The CRC16 code below is targeted to an Arduino UNO. So the CRC table is located in code memory. It is easy to change to be located in normale data memory. and the arduino PROGMEM version The easiest way to use a CRC16 might just be install the Arduino CRC library by Rob Tillaart3 NB NB CRC16 NB NB A CRC16 is not just a CRC16 cheksum.There is a generator polynomial attached so you can have different implementations of CRC16 is not compatible is they used different generator polynomials.
|