<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Framing in serial communications</title>
	<atom:link href="http://eli.thegreenplace.net/2009/08/12/framing-in-serial-communications/feed/" rel="self" type="application/rss+xml" />
	<link>http://eli.thegreenplace.net/2009/08/12/framing-in-serial-communications/</link>
	<description>Eli Bendersky's personal website</description>
	<lastBuildDate>Wed, 28 Jul 2010 12:22:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: eliben</title>
		<link>http://eli.thegreenplace.net/2009/08/12/framing-in-serial-communications/comment-page-1/#comment-210012</link>
		<dc:creator>eliben</dc:creator>
		<pubDate>Fri, 25 Sep 2009 07:27:38 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/?p=1872#comment-210012</guid>
		<description>@matthew,
That&#039;s a whole different level. My post refers to the data link layer, where the goal is to get a packet across. What you&#039;re interested in is the transport layer (at least in the TCP/IP stack land). Read up on TCP - it uses a sliding window protocol to handle bad packets that drop from time to time, with minimal losses.</description>
		<content:encoded><![CDATA[<p>@matthew,<br />
That&#8217;s a whole different level. My post refers to the data link layer, where the goal is to get a packet across. What you&#8217;re interested in is the transport layer (at least in the TCP/IP stack land). Read up on TCP &#8211; it uses a sliding window protocol to handle bad packets that drop from time to time, with minimal losses.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matthew</title>
		<link>http://eli.thegreenplace.net/2009/08/12/framing-in-serial-communications/comment-page-1/#comment-209538</link>
		<dc:creator>Matthew</dc:creator>
		<pubDate>Thu, 24 Sep 2009 01:15:30 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/?p=1872#comment-209538</guid>
		<description>I understand the necessity of having the framing flags and escape characters, but I&#039;m still unsure of how to handle bad packets on the sender&#039;s side.  Does the sender keep a quasi-infinite list of all the messages sent, deleting them as a valid reply is returned? Or does the sender poll the serial port awaiting a valid reply before it sends another message, or resends the bad message?</description>
		<content:encoded><![CDATA[<p>I understand the necessity of having the framing flags and escape characters, but I&#8217;m still unsure of how to handle bad packets on the sender&#8217;s side.  Does the sender keep a quasi-infinite list of all the messages sent, deleting them as a valid reply is returned? Or does the sender poll the serial port awaiting a valid reply before it sends another message, or resends the bad message?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marcelo MD</title>
		<link>http://eli.thegreenplace.net/2009/08/12/framing-in-serial-communications/comment-page-1/#comment-194775</link>
		<dc:creator>Marcelo MD</dc:creator>
		<pubDate>Mon, 17 Aug 2009 14:20:52 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/?p=1872#comment-194775</guid>
		<description>Oh, I see it now. I&#039;ve never tought about getting the wrong size. Silly me.
Thanks a lot =)</description>
		<content:encoded><![CDATA[<p>Oh, I see it now. I&#8217;ve never tought about getting the wrong size. Silly me.<br />
Thanks a lot =)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: eliben</title>
		<link>http://eli.thegreenplace.net/2009/08/12/framing-in-serial-communications/comment-page-1/#comment-194007</link>
		<dc:creator>eliben</dc:creator>
		<pubDate>Fri, 14 Aug 2009 04:58:07 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/?p=1872#comment-194007</guid>
		<description>&lt;strong&gt;@Joseph&lt;/strong&gt;,
As you said yourself, you have a very reliable link, so most issues don&#039;t apply. In addition, your feedback-based resync method is considerably more complex than simple byte stuffing.

&lt;strong&gt;@Marcelo&lt;/strong&gt;,
header + size can work, but you must byte stuff as well. This is why: suppose your data has a header byte somewhere, by chance. This easily happens when you&#039;re transmitting some kind of physical measurement. Now, if your size byte is corrupt just once, you may never be able to resynchronize as the &quot;fake&quot; header byte will be tried as the message header over and over again.

But as long as you use escaping for the header (and for the escape char), this method isn&#039;t much different from header + footer.</description>
		<content:encoded><![CDATA[<p><strong>@Joseph</strong>,<br />
As you said yourself, you have a very reliable link, so most issues don&#8217;t apply. In addition, your feedback-based resync method is considerably more complex than simple byte stuffing.</p>
<p><strong>@Marcelo</strong>,<br />
header + size can work, but you must byte stuff as well. This is why: suppose your data has a header byte somewhere, by chance. This easily happens when you&#8217;re transmitting some kind of physical measurement. Now, if your size byte is corrupt just once, you may never be able to resynchronize as the &#8220;fake&#8221; header byte will be tried as the message header over and over again.</p>
<p>But as long as you use escaping for the header (and for the escape char), this method isn&#8217;t much different from header + footer.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marcelo MD</title>
		<link>http://eli.thegreenplace.net/2009/08/12/framing-in-serial-communications/comment-page-1/#comment-193301</link>
		<dc:creator>Marcelo MD</dc:creator>
		<pubDate>Wed, 12 Aug 2009 19:36:32 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/?p=1872#comment-193301</guid>
		<description>How do you compare it with something like:
`&lt;code&gt;[header][size][data][crc]&lt;/code&gt;`
Byte stuffing sounds good when you have an &#039;open ended&#039; byte stream, or when you have enough memory to hold the entire packet before processing it in the upper layers.

I prefer little packets, but it might just be my ethernet background. Maybe I should experiment with it.</description>
		<content:encoded><![CDATA[<p>How do you compare it with something like:<br />
<code class="backtick">[header][size][data][crc]</code><br />
Byte stuffing sounds good when you have an &#8216;open ended&#8217; byte stream, or when you have enough memory to hold the entire packet before processing it in the upper layers.</p>
<p>I prefer little packets, but it might just be my ethernet background. Maybe I should experiment with it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joseph Lisee</title>
		<link>http://eli.thegreenplace.net/2009/08/12/framing-in-serial-communications/comment-page-1/#comment-192861</link>
		<dc:creator>Joseph Lisee</dc:creator>
		<pubDate>Wed, 12 Aug 2009 06:38:44 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/?p=1872#comment-192861</guid>
		<description>The character count method works fine if you a have relatively reliable link, checksumed packets and a defined resynchronization protocol.  I have used such a system for real time robotics control for several years and I have had no issues.  In the simplest terms, when the receiver detects a bad packet it returns an error code which cause the sender to send sync packets at the receiver until the receiver responds with a valid response.

Oh course the serial link in question is really done over USB through an onboard FTDI serial USB converter chip, so the chance of corrupt data is much lower then a normal analog serial comms.</description>
		<content:encoded><![CDATA[<p>The character count method works fine if you a have relatively reliable link, checksumed packets and a defined resynchronization protocol.  I have used such a system for real time robotics control for several years and I have had no issues.  In the simplest terms, when the receiver detects a bad packet it returns an error code which cause the sender to send sync packets at the receiver until the receiver responds with a valid response.</p>
<p>Oh course the serial link in question is really done over USB through an onboard FTDI serial USB converter chip, so the chance of corrupt data is much lower then a normal analog serial comms.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
