RS232 to UART Converter.

I have a MAX 2323 device with its RS232 port connected to a GPS device and the TTL output to UART 2 of an Arduino MEGA.

I'm using this Sketch as a simple test to ensure the data is coming in:

void setup() {
** // initialize both serial ports:**
** Serial.begin(9600);**
** Serial2.begin(4800, SERIAL_8N1);**
}
void loop() {
** // read from port 1, send to port 0:**
** if (Serial2.available()) {**
** char in = Serial2.read();**
** Serial.write(in);**
** }**
}

Initially the data being output was mostly garbled but then after leaving it running for an hour the data suddenly became 98% good but then after 10 mins returned to garbage.

I've connected the GPS into my Mac and the data is flawless so i'm beginning to suspect the MAX2323 device. I have tried the same setup on an Arduino DUE also.

Can anyone recommend an RS232 to TTL adapter that is known to work? The one I have is made by LC Technology Inc

Many thanks.

Have you connected the ground of your adaptor to the ground of your Arduino?

Yes, I have.

I suspect that because the data drifts in and out of sync (more out than in!) that the little converter is the culprit.

Do you know of a similar item that works?

Thanks.

Sorry that does not make sense. The item you have is working. What is not working is how you are using it, either in software or hardware terms. Data can not drift in and out of sync, all an RS232 to TTL converter does is to shift the voltage levels and invert the logic level.

Use the recommended circuit diagram given on the MAX2323 datasheet (you need four 1uF caps) and it will work perfectly.

Check connections
Check polarity of capacitors
Check common ground
Check Rx,Tx proper use