Hi all,
This issue nearly ruined a project I made for a client. It was supposed to be an Arduino Uno talking to the computer via hardware serial, and to a peripheral device via software serial at 38,400 Baud (no servos, special interrupts or other potential sources of interference).
After much frustration I discovered that SoftwareSerial couldn't handle this speed, which is odd because everywhere I looked it says the limit is 57,600 or even higher. I finally resorted to an Arduino Mega with its extra hardware serials... still - ?
Here's a little test setup I made. Two Arduinos (Let's call then A and B) are connected to the PC. A has "empty sketch" uploaded, B has this sketch:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3);
void setup() {
Serial.begin(57600);
mySerial.begin(57600);
}
void loop() {
if (mySerial.available())
Serial.write(mySerial.read());
if (Serial.available())
mySerial.write(Serial.read());
}
Pins RX and TX of A are connected to pin 2 and 3 of B. So in theory, anything sent to one of them from the PC should return from the other, right?
I opened monitors for both (using my own Serial Monitor Deluxe, heh) and it works as expected for 9,600 and 19,200 Baud. However, for 38,400 and 57,600 it only works one way - from B to A, where the Software Serial is the sender.
From A to B, where the Software Serial is the receiver, I get total garbage at these speeds.
At some point I guess I'll have to use a logic analyzer... until then, can anyone give some input on this matter? Thanks!