Uno: Dropped Characters With Hardware/SoftwareSerial Bridge?

Hi all,

I am interfacing an RN-XV to an older PC at 2400 baud. It works perfectly, no data is dropped when connected directly. Not using flow control.

However, I’d like to introduce an Arduino Uno (actually, a MicroView) into the middle of the setup to eventually do some real-time data translation. This mostly works, but when there is a large burst of incoming data, a few characters get dropped and the data gets a slightly garbled, but it does recover.

Helpful diagram:

http://i.imgur.com/iAVZQrH.png

Code:

#include <SoftwareSerial.h>

SoftwareSerial mySerial(8, 9); // RX, TX

void setup()  
{
  Serial.begin(2400);
  mySerial.begin(2400);
}

void loop() // run over and over
{
  if (mySerial.available())
    Serial.write(mySerial.read());
  if (Serial.available())
    mySerial.write(Serial.read());
}

Nothing to it, right? I’m having a hard time believing that the Uno can’t keep up, especially at such a low baud rate, but I’m sure there are background issues with interrupts and so on introduced by SoftwareSerial. Initial guess is that a buffer is filling up somewhere, but I’m not an expert on the innards.

Any suggestions?

The software serial port solution can fail to notice bytes comming in on the RX pin when it get’s flooded. The SoftwareSerial library built into the IDE has it’s limitations. You may have better luck with:

http://www.pjrc.com/teensy/td_libs_AltSoftSerial.html

or

http://arduiniana.org/libraries/NewSoftSerial/