<?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: WindowsXP SerialUSB message-size of doom</title>
		<link>http://forums.leaflabs.com/topic.php?id=2015</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:09:43 +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=2015" rel="self" type="application/rss+xml" />

		<item>
			<title>JoshSanders on "WindowsXP SerialUSB message-size of doom"</title>
			<link>http://forums.leaflabs.com/topic.php?id=2015#post-11609</link>
			<pubDate>Fri, 06 Jul 2012 10:09:35 +0000</pubDate>
			<dc:creator>JoshSanders</dc:creator>
			<guid isPermaLink="false">11609@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Yes, the board's main loop continues to operate - I modified the sketch above to include a few lines that blink the LED. When I send a 64-byte packet, the software crashes on the computer end, but the LED keeps blinking.&#60;/p&#62;
&#60;p&#62;I don't generally split the message in two because I often send large messages (up to 4000 bytes). So long as the entire message length isn't a multiple of 64, this works fine (presumably sending many 64 byte packets in the process). In terms of USB2.0, the hangup seems to be if the last packet in the message is full...&#60;/p&#62;
&#60;p&#62;Thanks for your feedback! I'm less of a USB expert than I'd like to be...
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mbolivar on "WindowsXP SerialUSB message-size of doom"</title>
			<link>http://forums.leaflabs.com/topic.php?id=2015#post-11547</link>
			<pubDate>Wed, 04 Jul 2012 14:41:33 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">11547@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi Josh,&#60;/p&#62;
&#60;p&#62;Thanks for the report. Glad you've got a workaround for now. Instead of chopping off bytes, however, why not just split the message in two, where neither part has a size divisible by 64?&#60;/p&#62;
&#60;p&#62;Also, just to be clear, does the board continue to work correctly after sending such a packet, even if the computer freaks out?&#60;/p&#62;
&#60;p&#62;gbulmer, you're correct that 64 bytes is the max packet size for USB 2.0, and we do set bMaxPacketSize to that value. So this is a suspicious happenstance, to say the least. It's odd that 65 bytes works correctly, however, since in principle you'd expect that to be sent as a 64 byte packet followed by a 1 byte packet.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "WindowsXP SerialUSB message-size of doom"</title>
			<link>http://forums.leaflabs.com/topic.php?id=2015#post-11527</link>
			<pubDate>Tue, 03 Jul 2012 19:16:55 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">11527@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Interesting - IIRC USB packets are 64 bytes.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>JoshSanders on "WindowsXP SerialUSB message-size of doom"</title>
			<link>http://forums.leaflabs.com/topic.php?id=2015#post-11525</link>
			<pubDate>Tue, 03 Jul 2012 18:49:49 +0000</pubDate>
			<dc:creator>JoshSanders</dc:creator>
			<guid isPermaLink="false">11525@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi guys!&#60;br /&#62;
I have run into a bug affecting both Maple r5 and Maple Mini r2, that I was hoping I could get some help with.&#60;br /&#62;
In 32-bit Windows XP SP3 (but not Windows 7), sending specifically 64 byte (or multiple thereof) messages over the serial terminal results in a crash of whatever software was talking to Maple.&#60;/p&#62;
&#60;p&#62;An example using Maple's IDE:&#60;br /&#62;
Load the following sketch -&#60;/p&#62;
&#60;p&#62;int inByte = 0;&#60;/p&#62;
&#60;p&#62;void setup() {&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;void loop() {&#60;br /&#62;
  if (SerialUSB.available() &#38;gt; 0) {&#60;br /&#62;
         inByte = SerialUSB.read();&#60;br /&#62;
  }&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;In Windows XP SP3 32bit, do the following: &#60;/p&#62;
&#60;p&#62;Step 1: open the Serial terminal in the IDE and send a string of A's, like this string of 63 A's:&#60;br /&#62;
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA&#60;br /&#62;
or this string of 65 A's:&#60;br /&#62;
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA&#60;br /&#62;
Step 2: Send any other message (for instance, AAA)&#60;/p&#62;
&#60;p&#62;So far so good.&#60;br /&#62;
Now, try the following:&#60;/p&#62;
&#60;p&#62;Step 1: open the Serial terminal in the IDE and send a string of 64 A's&#60;br /&#62;
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA&#60;/p&#62;
&#60;p&#62;Step 2: Send any other message (for instance, AAA)&#60;/p&#62;
&#60;p&#62;The IDE should now be frozen, and you'll have to quit the process from the task manager.&#60;/p&#62;
&#60;p&#62;I originally ran into this problem when sending messages of arbitrary lengths from the MATLAB serial terminal, and subsequently tested the bug on several WINXP and WIN7 computers with different configurations. WIN7 doesn't seem to have a problem here. Is this a driver issue? Or perhaps some quirk with XP's default configuration of the serial port? I'd have guessed a buffer overflow but it's specifically a problem with messages that are multiples of 64 bytes in length...&#60;/p&#62;
&#60;p&#62;Anyhow, if you guys have any guidance, please let me know! I'd rather not work on XP at all, but I'm developing a system that has to be robust across platforms.&#60;br /&#62;
For now I'll try to code around the issue by checking the message size, adding an extra byte if length is a multiple of 64, and chopping it off on the other end.&#60;/p&#62;
&#60;p&#62;Cheers,&#60;br /&#62;
Josh
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
