arduino mega rs232 serial2 rx-tx speed

Hello,

I use the serial2 port on arduino mega throug a max232.

I can easily send & receive ascii and 9600 & 19200 bauds At higher (until 115200 bauds) speed, I can still receive message correclty but message are not sent correcly (some strange chars).

Any idea about the problem?

Stef

Hi Stef

Please post your code. Use code tags (the </> button on the toolbar above the reply window).

What device do you have connected to the max232? Can you post a schematic of your hardware.

Regards

Ray

Hello Ray,

the arduino must communicante with a GPS (nmea messages). when connected at 115200 i Can receive all message correctly from the GPS. Unfortunately sending commands to the GPS failed. i replaced the GPS by HyperTerminal in order to check what was transmitted, and i notices that some transmitted chars are "corrupted".

the code is nothing else than:

serial2.println(myStringVariable);

i also add the Line:

serial.println(myStringVariable);

in ordre to check on the serial monitor, it is well,transmitted at 115200 on This port!!!

i Can post ail the complète code but it is quite long & complexe

thanks

stef

So the data is correct on serial monitor but has errors via the max232?

Can you post a schematic of your hardware?

EDIT ...

I've assumed you have built a circuit using the MAX232 chip. Is that the case, or are you using an off-the-shelf converter that uses that chip?

yes, that exactly that strange behaviour!

i use a max233cpp which is quite easy to wire because there is no need of additionnals capacitors. This chip only needs to wire the 5v , gnd, tx and rx. so if it Works fine at 9600, ut Élans that wires are correclty mapped.

i use a max233cpp which is quite easy to wire because there is no need of additionnals capacitors.
This chip only needs to wire the 5v , gnd, tx and rx.

And it’s rated up to 120kbps, so you are at the upper end but still within limits.

What sort of wiring do you have between Arduino <> MAX233CPP <> GPS? How long are the connections?

EDIT …

Looking at the Maxim datasheet, the 233 sample circuit does have one capacitor, a 1uF decoupling capacitor on the +5V supply. Might be worth trying that. Also, it has some pins that need to be looped together. Figure 11 in this datasheet: http://www.mouser.com/ds/2/256/MAX220-MAX249-67423.pdf

you are right, the 1µ capacitor and the "loops" are indeed implemented on my pcb.

i know that 115200 is near the limit, but i already have the problem starting at 38400Bauds!

GPS câble (shielded) length is 4meters. when connected to HyperTerminal, 1 mètre.

stefdas: you are right, the 1µ capacitor and the "loops" are indeed implemented on my pcb.

i know that 115200 is near the limit, but i already have the problem starting at 38400Bauds!

GPS câble (shielded) length is 4meters. when connected to HyperTerminal, 1 mètre.

what is the capacitance per meter of your cable, do you have an oscilloscope to look at the signal at the receiver?

I expect you are using too long of cable. here is a recommendation from LavaLink a Serial Communications products vendor Baud Rate v Cable Length

From their recommendations you should be using 19200 for 14ft.

Chuck.

Hello Chuck,

I don't know the capacitance and I don't have an oscilloscope.

However I can tell you that when that I have no problem when I use this cable plugged into the serial port of my PC, I even use a longer cable around 8 meters in to my PC serial port without any problem at 115200 bauds.

I have only the problem when transmitting from the max233cpp implemented into arduino.

stef

Hello Ray & Chuck,

I finally find out the problem; the wire between pin 12 and 17 on the max233cpp was not effective!!!

Thanks a lot for your time and advices.

best regards.

stef

stefdas: Hello Chuck,

I don't know the capacitance and I don't have an oscilloscope.

However I can tell you that when that I have no problem when I use this cable plugged into the serial port of my PC, I even use a longer cable around 8 meters in to my PC serial port without any problem at 115200 bauds.

I have only the problem when transmitting from the max233cpp implemented into arduino.

stef

I agree with your statement that you are having problems with the Max233cpp. the symptoms you are describing convince me that the MAX233cpp cannot drive that much cable that fast. the Slew rate limits of between 6V/us and 11V/us and the Output Voltage vs Data Rates combine to cause problems.

these graphs |500x201 Show that as the datarate increases, the max output voltage decreases, and the Slew(speed of change) of the output voltage decreases. As the capacitance of the wire(mainly length) increases they both get worse. You might need a more robust driver to achieve those rates/distances, the SN75188 are a more powerfull, faster RS232 driver, but they need +-15V (or +- 12V) to function.

Chuck.