<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<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">
	<channel>
		<title>LeafLabs Garden &#187; Topic: UART, Missing Characters when Communicating at 115200 Baud</title>
		<link>http://forums.leaflabs.com/topic.php?id=803</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:13:10 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://forums.leaflabs.com/search.php</link>
		</textInput>
		<atom:link href="http://forums.leaflabs.com/rss.php?topic=803" rel="self" type="application/rss+xml" />

		<item>
			<title>mbolivar on "UART, Missing Characters when Communicating at 115200 Baud"</title>
			<link>http://forums.leaflabs.com/topic.php?id=803#post-4854</link>
			<pubDate>Fri, 27 May 2011 15:19:45 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">4854@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;JR,&#60;/p&#62;
&#60;p&#62;Great!  Glad to hear that things are working out for you and that you're having a good time so far.  I've pushed the change to usart.h I mentioned earlier here:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;https://github.com/leaflabs/libmaple/commit/bb981bbaae9ed8633365fe5f7cb085050ca3a875&#34; rel=&#34;nofollow&#34;&#62;https://github.com/leaflabs/libmaple/commit/bb981bbaae9ed8633365fe5f7cb085050ca3a875&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>JR on "UART, Missing Characters when Communicating at 115200 Baud"</title>
			<link>http://forums.leaflabs.com/topic.php?id=803#post-4853</link>
			<pubDate>Fri, 27 May 2011 15:02:38 +0000</pubDate>
			<dc:creator>JR</dc:creator>
			<guid isPermaLink="false">4853@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi!  Thanks for the quick reply and sorry about posting the code, I'm still learning the etiquette.  &#60;/p&#62;
&#60;p&#62;It was indeed the buffer, I increased the size to 128 and it works wonderfully!&#60;/p&#62;
&#60;p&#62;StephenFromNYC, yes, the code I posted above is only the basic code.  The Maple allows me to have a more powerful battery on board (LiPo vs 9V) to drive the GPS logger and sensors simultaneously, and also I plan on doing some data processing in real time if I have the extra computational power.  Also, I've wanted to learn how to use ARM processors, so it seemed like a good choice.&#60;/p&#62;
&#60;p&#62;gbulmer, I didn't try the code since changing the buffer worked, but I think that would work since there would be nothing in the way of the device from reading the incoming serial stream.&#60;/p&#62;
&#60;p&#62;Perry, yes that's what it was, thanks for the reply!&#60;/p&#62;
&#60;p&#62;mbolivar, thanks a ton for showing me where to look in the code, and making the Maple, you guys rock!&#60;/p&#62;
&#60;p&#62;Thanks everyone for your time and help, I really appreciate it!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>StephenFromNYC on "UART, Missing Characters when Communicating at 115200 Baud"</title>
			<link>http://forums.leaflabs.com/topic.php?id=803#post-4843</link>
			<pubDate>Fri, 27 May 2011 09:56:43 +0000</pubDate>
			<dc:creator>StephenFromNYC</dc:creator>
			<guid isPermaLink="false">4843@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hello JR,&#60;/p&#62;
&#60;p&#62;In your opening message you said the code runs well on an Arduino Duemilanove.  On the following page it says the serial receive buffer holds 128 bytes:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://arduino.cc/en/Serial/Available&#34; rel=&#34;nofollow&#34;&#62;http://arduino.cc/en/Serial/Available&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;This supports the suggestion from mbolivar to increase the size of the Maple receive buffer from the default size of 64.  Try 128 or 192.&#60;/p&#62;
&#60;p&#62;JR, are there project goals which can be accomplished using a Maple, but not a Duemilanove/UNO?  Which Maple board are you using?&#60;/p&#62;
&#60;p&#62;Please let us know if things work.&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://forums.leaflabs.com/profile.php?id=843&#34;&#62;Stephen from NYC&#60;/a&#62; (full disclosure: I am not a member of the LeafLabs staff)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "UART, Missing Characters when Communicating at 115200 Baud"</title>
			<link>http://forums.leaflabs.com/topic.php?id=803#post-4840</link>
			<pubDate>Fri, 27 May 2011 05:22:55 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">4840@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;What happens if you simplify this down to something like:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;loop() {
   if (Serial1.available() &#38;gt; 0) {
      while (Serial1.available() &#38;gt; 0) {
          GPSbyte = Serial1.read();
          Serial2.print(GPSbyte,BYTE);
      }
      Serial2.println();
   }
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Do you see everything, or do you still see dropped bytes?&#60;br /&#62;
Do you sometimes see a GPS reading spread over multiple lines?&#60;/p&#62;
&#60;p&#62;[WARNING: I have not compiled and tested the code]&#60;/p&#62;
&#60;p&#62;(full disclosure: I am not a member of LeafLabs staff)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>perry on "UART, Missing Characters when Communicating at 115200 Baud"</title>
			<link>http://forums.leaflabs.com/topic.php?id=803#post-4833</link>
			<pubDate>Thu, 26 May 2011 20:56:58 +0000</pubDate>
			<dc:creator>perry</dc:creator>
			<guid isPermaLink="false">4833@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;It appears you're reading from Serial1 faster than you're sending them out Serial2. It's possible you're not pulling them out of the ring buffer fast enough before it overruns itself and drops bytes on the floor.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mbolivar on "UART, Missing Characters when Communicating at 115200 Baud"</title>
			<link>http://forums.leaflabs.com/topic.php?id=803#post-4832</link>
			<pubDate>Thu, 26 May 2011 20:12:42 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">4832@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;JR,&#60;/p&#62;
&#60;p&#62;Sorry to hear you're having problems.  However, can you please not paste such long code listings directly into the forum?  There are a ton of websites where you can post code.  Please do that and provide a link instead.  I happen to like GitHub Gists, but you can do whatever you like.&#60;/p&#62;
&#60;p&#62;Sorry to hear you're dropping bytes.  Just to be clear, are you saying that the USART is losing bytes on both transmit and receive, or just on receive?&#60;/p&#62;
&#60;p&#62;In answer to your question about buffers, yes, the USART RX buffer has size 64 by default:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;https://github.com/leaflabs/libmaple/blob/0.0.10/libmaple/usart.h#L231&#34; rel=&#34;nofollow&#34;&#62;https://github.com/leaflabs/libmaple/blob/0.0.10/libmaple/usart.h#L231&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;(Actually, due to the way the ring_buffer implementation works, that leaves 63 bytes open for actual data).&#60;/p&#62;
&#60;p&#62;If you need a quick fix, you could try going into usart.h and change that #define to something larger.  I should probably have put that #define within an #ifndef USART_RX_BUF_SIZE.  Will do that for the next release.&#60;/p&#62;
&#60;p&#62;Another solution might be to try to use DMA, but I've had some issues interrupting on buffer full when reading from the USART that I didn't have time to fully debug.  So while there is some example code here, be aware that trying to dma_attach_interrupt() when your buffer is full won't work in 0.0.10:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;https://github.com/leaflabs/libmaple/blob/0.0.10/examples/test-usart-dma.cpp&#34; rel=&#34;nofollow&#34;&#62;https://github.com/leaflabs/libmaple/blob/0.0.10/examples/test-usart-dma.cpp&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;I'll look into it and try to get a working USART/DMA example to you.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>JR on "UART, Missing Characters when Communicating at 115200 Baud"</title>
			<link>http://forums.leaflabs.com/topic.php?id=803#post-4827</link>
			<pubDate>Thu, 26 May 2011 15:51:46 +0000</pubDate>
			<dc:creator>JR</dc:creator>
			<guid isPermaLink="false">4827@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Forgot to include, in between GPS reads, the output is '$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X' to hold the place of GPS characters.  And it appears as though only the checksum is getting through for the dropped GPS reads.  Is there a small RX1 buffer?  If so what size is it, and do you have any suggestions for working around this?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>JR on "UART, Missing Characters when Communicating at 115200 Baud"</title>
			<link>http://forums.leaflabs.com/topic.php?id=803#post-4826</link>
			<pubDate>Thu, 26 May 2011 15:49:59 +0000</pubDate>
			<dc:creator>JR</dc:creator>
			<guid isPermaLink="false">4826@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi, I'm trying to connect a GPS device to the Maple, via the RX1 port at 115200 Baud.  I transmitting only the RMC data, and I am getting a number of odd character drops.  GPS is refreshing at 5 Hz.  Below are a sample of my results, from the SerialUSB port, and below that will be results from Serial2 stored to a uSD card with OpenLog.&#60;/p&#62;
&#60;p&#62;Also, the code ran fine on an Arduino Duemillinove.&#60;/p&#62;
&#60;p&#62;SerialUSB:&#60;br /&#62;
...&#60;/p&#62;
&#60;p&#62;1270125,2038,2028,2449,2278,1653,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1270161,2052,2018,2461,2272,1651,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1270197,2052,2005,2451,2270,1659,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1270233,2034,2046,2443,2266,1652,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1270269,2037,2029,2458,2268,1649,$GPRMC,124426.800,V,2400.0000,N,12100.0000,E,0000.0,000.0,280606,,,N*47&#60;/p&#62;
&#60;p&#62;1270376,2051,2027,2465,2282,1642,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1270412,2047,2018,2458,2274,1651,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1270448,2043,2027,2451,2268,1655,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1270484,2041,2025,2462,2272,1654,,,,N*4E&#60;/p&#62;
&#60;p&#62;1270528,2040,2025,2452,2278,1653,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1270563,2032,2037,2456,2267,1651,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1270599,2038,2038,2459,2269,1652,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1270635,2053,2036,2456,2275,1649,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1270671,2043,2024,2470,2281,1653,$GPRMC,1&#60;/p&#62;
&#60;p&#62;1270715,2046,2029,2478,2274,1652,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1270751,2023,2028,2438,2267,1648,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1270786,2050,2030,2466,2278,1653,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1270822,2035,2037,2454,2281,1644,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1270858,2037,2034,2458,2279,1649,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1270894,2039,2029,2448,2273,1640,,,,N*4A&#60;/p&#62;
&#60;p&#62;1270938,2039,2031,2453,2280,1649,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1270974,2042,2031,2456,2278,1648,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1271010,2039,2031,2455,2269,1645,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1271045,2042,2030,2457,2267,1651,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1271081,2040,2032,2458,2267,1649,,,,N*48&#60;/p&#62;
&#60;p&#62;1271125,2034,2037,2454,2282,1651,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1271161,2039,2032,2456,2280,1647,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1271197,2039,2030,2457,2265,1652,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1271233,2039,2032,2457,2269,1650,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1271269,2046,2031,2459,2271,1651,$GPRMC,124427.800,V,2400.0000,N,12100.0000,E,0000.0,000.0,280606,,,N*46&#60;/p&#62;
&#60;p&#62;Serial2:&#60;br /&#62;
...&#60;br /&#62;
1300,2043,2031,2458,2177,1647,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1333,2043,2031,2458,2184,1647,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1367,2042,2032,2459,2182,1652,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1400,2044,2023,2464,2205,1672,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1433,2048,2030,2460,2175,1647,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1467,2044,2030,2457,2172,1651,$GPRMC,120314.000,V,2400.0000,N,12100.0000,E,0000.0,000.0,280606,,,N*4D&#60;/p&#62;
&#60;p&#62;1521,2044,2032,2460,2186,1651,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1555,2049,2029,2495,2167,1651,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1588,2045,2031,2459,2180,1649,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1621,2044,2032,2456,2170,1651,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1655,2046,2033,2460,2170,1651,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1688,2053,2034,2504,2177,1652,,,,N*4F&#60;/p&#62;
&#60;p&#62;1710,2045,2032,2458,2165,1649,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1743,2048,2030,2458,2165,1647,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1776,2042,2031,2460,2162,1649,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1810,2035,2036,2458,2160,1656,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1843,2046,2032,2462,2160,1647,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1876,2043,2032,2461,2158,1647,,,,N*49&#60;/p&#62;
&#60;p&#62;1898,2044,2030,2459,2146,1649,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1931,2042,2031,2429,2150,1655,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1964,2044,2032,2461,2146,1651,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
1998,2044,2031,2458,2149,1652,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
2031,2044,2030,2460,2141,1647,$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#60;br /&#62;
2064,2045,2031,2464,2136,1664,$GPRMC,120314.600,V,2400.0000,N,12100.0000,E,0000.0,000.0,280606,,,N*4B&#60;/p&#62;
&#60;p&#62;Maple Code:&#60;br /&#62;
// GPS Initilization&#60;br /&#62;
byte GPSbyte;&#60;/p&#62;
&#60;p&#62;void setup()&#60;br /&#62;
{&#60;br /&#62;
  Serial2.begin(19200);     // OpenLog Serial Port&#60;br /&#62;
  Serial1.begin(115200);    // GPS Input Serial Port&#60;br /&#62;
  delay(1000);              // Delay to allow initilization&#60;/p&#62;
&#60;p&#62;  Serial2.print(&#34;dt,Ax,Ay,Az,Gx,Gy,NEMA,Time,Valid,Latitude,&#34;);&#60;br /&#62;
  Serial2.println(&#34;NS,Longitude,EW,Speed,Heading,DDMMYY,,,Checksum&#34;);&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;void loop()&#60;br /&#62;
{&#60;br /&#62;
  // Gather IMU Sensor Data&#60;br /&#62;
  Serial2.print(millis());         // dt&#60;br /&#62;
  Serial2.print(&#34;,&#34;);&#60;br /&#62;
  Serial2.print(analogRead(18));    // Ax&#60;br /&#62;
  Serial2.print(&#34;,&#34;);&#60;br /&#62;
  Serial2.print(analogRead(19));    // Ay&#60;br /&#62;
  Serial2.print(&#34;,&#34;);&#60;br /&#62;
  Serial2.print(analogRead(20));    // Az&#60;br /&#62;
  Serial2.print(&#34;,&#34;);&#60;br /&#62;
  Serial2.print(analogRead(15));    // Gx&#60;br /&#62;
  Serial2.print(&#34;,&#34;);&#60;br /&#62;
  Serial2.print(analogRead(16));    // Gy&#60;br /&#62;
  Serial2.print(&#34;,&#34;);  &#60;/p&#62;
&#60;p&#62;//  SerialUSB.print(millis());         // dt&#60;br /&#62;
//  SerialUSB.print(&#34;,&#34;);&#60;br /&#62;
//  SerialUSB.print(analogRead(18));    // Ax&#60;br /&#62;
//  SerialUSB.print(&#34;,&#34;);&#60;br /&#62;
//  SerialUSB.print(analogRead(19));    // Ay&#60;br /&#62;
//  SerialUSB.print(&#34;,&#34;);&#60;br /&#62;
//  SerialUSB.print(analogRead(20));    // Az&#60;br /&#62;
//  SerialUSB.print(&#34;,&#34;);&#60;br /&#62;
//  SerialUSB.print(analogRead(15));    // Gx&#60;br /&#62;
//  SerialUSB.print(&#34;,&#34;);&#60;br /&#62;
//  SerialUSB.print(analogRead(16));    // Gy&#60;br /&#62;
//  SerialUSB.print(&#34;,&#34;);  &#60;/p&#62;
&#60;p&#62;  // Gather GPS data&#60;br /&#62;
  int ii = 0;&#60;/p&#62;
&#60;p&#62;  if (Serial1.available() &#38;gt; 0)&#60;br /&#62;
  {&#60;br /&#62;
    while (Serial1.available() &#38;gt; 0)&#60;br /&#62;
    {&#60;br /&#62;
      GPSbyte   = Serial1.read();&#60;br /&#62;
      Serial2.print(GPSbyte,BYTE);&#60;br /&#62;
//      SerialUSB.print(GPSbyte,BYTE);&#60;br /&#62;
    }&#60;br /&#62;
    Serial2.println();&#60;br /&#62;
//    SerialUSB.println();&#60;br /&#62;
  }&#60;br /&#62;
  else&#60;br /&#62;
  {&#60;br /&#62;
    Serial2.println(&#34;$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#34;);&#60;br /&#62;
//    SerialUSB.println(&#34;$,-1,X,-1,X,-1,X,-1,-1,-1,-1,X,X&#34;);&#60;br /&#62;
  }&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;Any suggestions?
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
