Hi guys!
I have run into a bug affecting both Maple r5 and Maple Mini r2, that I was hoping I could get some help with.
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.
An example using Maple's IDE:
Load the following sketch -
int inByte = 0;
void setup() {
}
void loop() {
if (SerialUSB.available() > 0) {
inByte = SerialUSB.read();
}
}
In Windows XP SP3 32bit, do the following:
Step 1: open the Serial terminal in the IDE and send a string of A's, like this string of 63 A's:
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
or this string of 65 A's:
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Step 2: Send any other message (for instance, AAA)
So far so good.
Now, try the following:
Step 1: open the Serial terminal in the IDE and send a string of 64 A's
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Step 2: Send any other message (for instance, AAA)
The IDE should now be frozen, and you'll have to quit the process from the task manager.
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...
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.
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.
Cheers,
Josh