Help needed! Serial communication basics.

I'm trying to get serial working between a Lantronix MatchPort and Arduino Pro Mini. I have the Arduino receiving data just fine, but it won't send back to the MatchPort, (or the MatchPort won't receive). I have MP TX to Arduino RX, and MP RX to Arduino TX. When I send "OK12" to the Arduino from the MP I get the led flashing once for each character, then I get the 1 second flash of the led to show that I am getting "OK" as the first two characters. The TX led on the MP also lights to show the data has been sent, but the RX never lights to show that it's received the "Ready" response from the Ardunio.

When I hook the USB cable back up and use the serial monitor in the IDE to check what's happening I get the "Ready" response when I send "OK12" through the IDE, and the MatchPort RX led lights up. With the USB cable hooked up I can no longer send via the MatchPort.

When I scope both lines without the USB hooked up, both the TX and RX signals are identical. With the USB hooked up I don't get any signals.

The MatchPort is set with no flowcontrol and 9600,8,None,1

Here's my simple debug sketch:

(The Serial.flush() and doneOnce byte are just my attempts to try and track down the problem, so they may look stupid. :slight_smile: )

#define ledPin 13

char dataIn[8];
byte doneOnce = 0;

void setup()
{
  delay(1000);
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
}

void loop()
{
  byte i = 0;
  if(Serial.available() && doneOnce == 0) {
    while (Serial.available()) {
      dataIn[i] = Serial.read();
      digitalWrite(ledPin, HIGH);
      delay(100);
      digitalWrite(ledPin, LOW);
      delay(100);
      i++;
    }
    Serial.flush();
    doneOnce = 1;
  }
  delay(500);
  if (dataIn[0] == 'O' && dataIn[1] == 'K') {
    digitalWrite(ledPin, HIGH);
    delay(1000);
    digitalWrite(ledPin, LOW);
    dataIn[0] = 0;
    Serial.println("Ready");
  }
}

Am I doing something wrong?

did you connect the two devices grounds together ?

did you connect the two devices grounds together ?

That was my eureka moment in the shower this morning. No I did not, so I was going to ask about that, but you've already brought it up. :slight_smile:

I'm going to give that a try as soon as I get home from work.

That was it. No common ground. :-[ Problem solved. :slight_smile: