I am facing a rather interesting issue with nearly the example code for USBSerial on F5529 launchpad.
- MSP-EXP430F5529LP
- MSP430F5529
- energia-0101E0011
- Win 7
When using the USBSerial interface at any baudrate, performing a simple char by char loopback test with more then 2 characters before the terminator, this behaviour is exhibited. Both 16MHz or 25MHz clock do this.
The minimal loopback code directly modified from the example to replicate this issue:
#include <USBSerial.h>
USBSerial mySerial(1); // USB
void setup()
{
digitalWrite(RED_LED, LOW); // set the LED off
digitalWrite(GREEN_LED, LOW); // set the LED off
pinMode(RED_LED, OUTPUT);
pinMode(GREEN_LED, OUTPUT);
// Open serial communications and wait for port to open:
Serial.begin(9600);
Serial.println("Goodnight moon!");
digitalWrite(RED_LED, HIGH); // set the LED on
// open the USBSerial port
mySerial.begin();
mySerial.println("Hello USB world");
digitalWrite(GREEN_LED, HIGH); // set the LED on
}
void loop() // run over and over
{
if (Serial.available())
Serial.write(Serial.read());
if (mySerial.available())
mySerial.write(mySerial.read());
}
The problem occurs for the 3rd and 4th characters, the rest appears to be ok. This is rather early in the string for buffer issues. Usually there is some char remaining at the end that can not be ascii decoded.
txd:1 rxd:1 txd:12 rxd:12 txd:123 rxd:123[06] txd:1234 rxd:123 [12] txd:12345 rxd:1235 [12] txd:123456 rxd:12356[12] txd:1234567 rxd:123567X txd:123456789 rxd:12356789[12]
Can someone please confirm this problem, before I report it further or go exploring.