<?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: Maple 3 Port Serial Comm. Turnaround Test</title>
		<link>http://forums.leaflabs.com/topic.php?id=96</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:19:36 +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=96" rel="self" type="application/rss+xml" />

		<item>
			<title>leaflabsandy on "Maple 3 Port Serial Comm. Turnaround Test"</title>
			<link>http://forums.leaflabs.com/topic.php?id=96#post-529</link>
			<pubDate>Sat, 10 Jul 2010 15:10:27 +0000</pubDate>
			<dc:creator>leaflabsandy</dc:creator>
			<guid isPermaLink="false">529@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I left this code for other board users to quickly check out all three serial ports on their Maple. It is a very crude test but gets the job done.&#60;br /&#62;
I am extremely happy with all three ports running normal at 9600 8 N 1. The maximum&#60;br /&#62;
of 153600, I found on my Maple is a baud rate I would never use due to extra hardware handshake I/O pins.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bnewbold on "Maple 3 Port Serial Comm. Turnaround Test"</title>
			<link>http://forums.leaflabs.com/topic.php?id=96#post-528</link>
			<pubDate>Sat, 10 Jul 2010 13:11:46 +0000</pubDate>
			<dc:creator>bnewbold</dc:creator>
			<guid isPermaLink="false">528@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Perhaps 330 Ohm is too much impedance for these higher baud rates? You could check with a scope and see how clean the waveform is.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>leaflabsandy on "Maple 3 Port Serial Comm. Turnaround Test"</title>
			<link>http://forums.leaflabs.com/topic.php?id=96#post-526</link>
			<pubDate>Fri, 09 Jul 2010 17:17:03 +0000</pubDate>
			<dc:creator>leaflabsandy</dc:creator>
			<guid isPermaLink="false">526@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;For other users:&#60;/p&#62;
&#60;p&#62;------&#60;br /&#62;
code&#60;br /&#62;
------&#60;/p&#62;
&#60;p&#62;/*&#60;br /&#62;
 Author: LeaflabsAndy&#60;br /&#62;
 Date: 7/1/10&#60;br /&#62;
 Revision: 1.0b&#60;br /&#62;
 Platform: Win XP SP3&#60;br /&#62;
 Device: Maple Rev. 3 red&#60;br /&#62;
 IDE Rev.: 0.5.0&#60;/p&#62;
&#60;p&#62; Maple 3 Port Serial Comm. Turnaround Test&#60;br /&#62;
 Insert 3 330 ohm resistors (for current limit protection)&#60;br /&#62;
 into the following headers on the Maple for each serial port.&#60;/p&#62;
&#60;p&#62; USART2  D0-D1 (RX to TX)&#60;br /&#62;
 USART1  D7-D8 (TX to RX)&#60;br /&#62;
 USART3  D29-D30 Ext. HDR. (TX to RX) center 5 up either way&#60;/p&#62;
&#60;p&#62; This Maple Communication Turnaround Port Test sends out one char then checks the receive buffer&#60;br /&#62;
 on all three USARTS.&#60;br /&#62;
 If everything is Ok the blue LED stays on and flashes.&#60;br /&#62;
 On any char mismatch the program halts and the blue LED is off.&#60;br /&#62;
 All three resistors will have to be installed. Removing any turnaround resistor will halt the program.&#60;/p&#62;
&#60;p&#62; Standard baud rates:&#60;br /&#62;
•110 •300 •600 •1200 •2400 •4800 •9600&#60;br /&#62;
•14400 •19200 •28800 •38400 •56000&#60;br /&#62;
•57600 •115200&#60;br /&#62;
max baud on hardware uart is 225000? per okie but this test could only do 153600 max.&#60;br /&#62;
 Special baud rates:&#60;br /&#62;
•128000 •153600 •230400&#60;br /&#62;
•256000 •460800 •921600 &#60;/p&#62;
&#60;p&#62; Program status: OK - it works.&#60;br /&#62;
 */&#60;/p&#62;
&#60;p&#62;#define BLUE_LED 13&#60;br /&#62;
#define BAUD 153600&#60;/p&#62;
&#60;p&#62;int toggle = 0;&#60;br /&#62;
static int x = 0;&#60;br /&#62;
static long loop1, loop2, loop3;&#60;br /&#62;
static byte inByte1, inByte2, inByte3;&#60;/p&#62;
&#60;p&#62;void setup() {&#60;br /&#62;
  Serial1.begin(BAUD);&#60;br /&#62;
  Serial2.begin(BAUD);&#60;br /&#62;
  Serial3.begin(BAUD);&#60;/p&#62;
&#60;p&#62;  //Serial1.flush(); &#38;lt;----- does not work????&#60;br /&#62;
  //Serial2.flush(); &#38;lt;----- does not work????&#60;br /&#62;
  //Serial3.flush(); &#38;lt;----- does not work????&#60;/p&#62;
&#60;p&#62;  /* Set up the LED to blink  */&#60;br /&#62;
  pinMode(BLUE_LED, OUTPUT);&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;void abort(void){&#60;br /&#62;
digitalWrite (BLUE_LED,LOW);&#60;br /&#62;
while(1) {}&#60;br /&#62;
}  &#60;/p&#62;
&#60;p&#62;void serial1Test(void){&#60;br /&#62;
Serial1.write(x);&#60;br /&#62;
loop1 = 0;&#60;br /&#62;
START1:&#60;br /&#62;
if (Serial1.available()) {inByte1 = Serial1.read(); goto check_Data1;}&#60;br /&#62;
loop1++;&#60;br /&#62;
if (loop1 &#38;gt; 5000) {abort();}&#60;br /&#62;
goto START1;&#60;br /&#62;
check_Data1:&#60;br /&#62;
if (inByte1 != x) {abort(); }&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;void serial2Test(void){&#60;br /&#62;
Serial2.write(x);&#60;br /&#62;
loop2 = 0;&#60;br /&#62;
START2:&#60;br /&#62;
if (Serial2.available()) {inByte2 = Serial2.read(); goto check_Data2;}&#60;br /&#62;
loop2++;&#60;br /&#62;
if (loop2 &#38;gt; 5000) {abort();}&#60;br /&#62;
goto START2;&#60;br /&#62;
check_Data2:&#60;br /&#62;
if (inByte2 != x) {abort(); }&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;void serial3Test(void){&#60;br /&#62;
Serial3.write(x);&#60;br /&#62;
loop3 = 0;&#60;br /&#62;
START3:&#60;br /&#62;
if (Serial3.available()) {inByte3 = Serial3.read(); goto check_Data3;}&#60;br /&#62;
loop3++;&#60;br /&#62;
if (loop3 &#38;gt; 5000) {abort();}&#60;br /&#62;
goto START3;&#60;br /&#62;
check_Data3:&#60;br /&#62;
if (inByte3 != x) {abort(); }&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;void loop() {&#60;br /&#62;
toggle ^= 1;&#60;br /&#62;
digitalWrite(BLUE_LED, toggle);&#60;/p&#62;
&#60;p&#62;for(x = 0; x &#38;lt; 256; x++){  //seed values&#60;br /&#62;
serial1Test();  // Serial1 test&#60;br /&#62;
serial2Test();  // Serial2 test&#60;br /&#62;
serial3Test();  // Serial3 test&#60;br /&#62;
} // end of for&#60;/p&#62;
&#60;p&#62;} //The end
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
