title: error detection/correction/recovery in serial protocols
body: <p>I have some designing to do for a serial protocol and am running into some questions that I figure must have been considered elsewhere.</p>
  
  <p><strong>So I'm wondering if there are some recommendations for best practices in designing serial protocols.</strong> (<em>Please either state a fact that is easily verifiable, or cite a reputable source if you make a claim.</em>) General recommendations for websites/books are also welcome.</p>
  
  <p>In particular I have to deal with issues like</p>
  
  <ul>
  <li>parsing a stream of bytes into packets</li>
  <li>verifying a packet is correct (easy with a CRC, for instance)</li>
  <li>identifying reasonable types of errors that can occur (e.g. in a point-to-point serial stream, sporadic single bit errors, and dropped series of bytes, are both likely, but extra phantom bytes are unlikely; whereas with a record stored in flash memory or on a disk drive the types of errors that predominate are different)</li>
  <li>error correction or recovery (if I detect an error in a packet, can I correct it? If not, can I resync to the boundary of the next packet?)</li>
  <li>how to make variable-length packets robust to error correction / recovery.</li>
  </ul>
  
  <p>Any suggestions?</p>