I have a Arduino MEGA, hooked up to my USB/serial port converter. I'm sending characters from my computer to the Arduino and display them.
What I observe is (using a simple terminal program to send bytes)
there is dataflow all the way to the Arduino board - it sees bytes and reads them with Serial.read()
The bytes it reads are not the bytes that I sent (for example: q->W, v->*,o->X,#->n,F->.,u->E,3->f,9->c and so on)
When I use the serial monitor of the Arduino GUI and the USB/FTDI that you program it with, it works
When I use the serial monitor of the Arduino GUI and my USB -> Serial converter it doesn't work
Hence it seems that there is some hardware issue. What puzzles me is, that the bytes that are wrongly read are very much repeatable, so it doesn't seem to be a connection issue. The only two wires I have hooked up are Pin3 of the Serial (Tx) to Rx of the Arduino and Pin5 of the Serial to GND of the Arduino. The baudrate is the same on both ends (verified), it just doesn't seem to be reading the bytes correctly.
FYI - here are the code snippets (although the same code works with the FTDI chip, so I don't think the code is wrong)
int incomingByte;
Serial.begin(1200);
incomingByte = Serial.read();
GLCD.PutChar(char(incomingByte)); // for the LCD display
int incomingByte;
Serial.begin(1200);
incomingByte = Serial.read();
GLCD.PutChar(char(incomingByte)); // for the LCD display
You can't read serial data until the serial data has arrived and is ready to be read. Compare the code below and notice the use of the Serial.avalible statment:
Example
int incomingByte = 0; // for incoming serial data
void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}
void loop() {
// send data only when you receive data:
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
// say what you got:
Serial.print("I received: ");
Serial.println(incomingByte, DEC);
}