Go Down

Topic: Problem with arduino driver and serial communication (Read 1 time) previous topic - next topic

arinka62

Hi there,
I've got a project with the arduinouno rev3 and some other device communicating via rs232. When starting a terminal program on my pc all rs232 communication  seems to work well with using the arduino com port.
When starting the device, only the first string send is received and nothing after.
I allready tried lots of things, but no result. I found a workaround, which is fortunately working. When using a standard usb to rs232 converter and transforming the tx and rec to ttl level connecting to the arduino everything works fine. The problem must be somewhere in the arduino driver reacting on a control character. I allready cut the reset en jumper, but no difference. I've seen some settings in the inf file, but they don't tell me much. Allthough I've find a workaround, I would like to have everything running direct over the arduino driver. Anybody some suggestions?

Erdin

It is not clear to me what you have and how it is connected.

You have an Arduino Uno. Its RX and TX are connected via USB to the virtual serial port on the PC.
You can override that with something else, but you could be mixing signals. I think that is your problem.

You have an other device, but is that using RX and TX at 5V or 3.3V levels, or actual RS-232 with higher voltage levels ?
Use http://arduino.cc/en/Reference/SoftwareSerial to create a new serial port on the Arduino Uno.
Connect that to the other device. That way everything is seperated, and you can send debug messages to the serial monitor.

arinka62

Erdin, thanx for your reply. I have a PC running a program that communicates via RS232 (Port free selectable) to the outside world, which I catch with my uno Rev3. When I try this via a ready bought USB to RS232 converter with its own driver and then connect it via a rs232 to ttl converter to pin 0 and 1 on the arduino all works fine.
When using the standard arduino driver, most programs communicating via rs232 work fine, only my specific program is causing trouble by only receiving the first string.

Hope this clarifies your understanding.

Erdin

#3
Mar 23, 2013, 08:15 pm Last Edit: Mar 23, 2013, 08:19 pm by Erdin Reason: 1
Thanks, I do understand it now.

This is not a problem in linux. As soon as the serial port is recognized, it is a serial port to everything.
In Windows it might depend on the library and software used. Perhaps that program is using an older library, which is not compatible. If that is the case, fixing the driver could be very hard.

The difference is in the hardware:

  • The Arduino Uno R3 uses a microcontroller to interface with the USB bus, using hardware and software.

  • Your USB-to-serial-ttl-level converter uses a hardware chip.



Perhaps two solutions:

  • Use an Arduino board with a hardware chip. For example a FTDI chip, like the Arduino nano http://arduino.cc/en/Main/ArduinoBoardNano.

  • My idea for SoftwareSerial could still work. Use your USB-to-serial-ttl-level converter with a SoftwareSerial port. That way you can capture the serial data of the program, and still have the serial monitor of the Arduino IDE at the same time.




arinka62

Thanx Erdin,

Both of your idees are acceptable. My main concern is now indeed that the rec and tx are connected to an open 16u2 chip which can cause some unwanted noise. The other idee is good as well. My used serial converter which is working uses the FTDI chip.

Erdin

The RX and TX to the 16u2 are not open and there is no noise.

arinka62

I used a monitor program to check the communication with a terminal. This is the print-out of this monitor. What I receive in my arduino is "begin sequence". The next string should be "pos2", which is not received anymore. Probably it is going wrong with the purge serial port command.




COM is open Set timeouts: ReadInterval=1000, ReadTotalTimeoutMultiplier=1000,
ReadTotalTimeoutConstant=1000, WriteTotalTimeoutMultiplier=1000,
WriteTotalTimeoutConstant=1000 Baud rate 9600 RTS on DTR on Data bits=8, Stop
bits=1, Parity=None Set chars: Eof=0x00, Error=0x00, Break=0x00, Event=0x00,
Xon=0x11, Xoff=0x13 Handflow: ControlHandShake=(DTR_CONTROL),
FlowReplace=(TRANSMIT_TOGGLE, RTS_CONTROL), XonLimit=2048, XoffLimit=512 Purge the
serial port: RXABORT, RXCLEAR, TXABORT, TXCLEAR Purge the serial port: RXABORT,
RXCLEAR, TXABORT, TXCLEAR Purge the serial port: RXABORT, RXCLEAR, TXABORT, TXCLEAR
begin sequence

Purge the serial port: RXABORT, RXCLEAR, TXABORT, TXCLEAR pos2

Purge the serial port: RXABORT, RXCLEAR, TXABORT, TXCLEAR pos2

Purge the serial port: RXABORT, RXCLEAR, TXABORT, TXCLEAR pos2

Purge the serial port: RXABORT, RXCLEAR, TXABORT, TXCLEAR einde sequence

Purge the serial port: RXABORT, RXCLEAR, TXABORT, TXCLEAR begin sequence

Purge the serial port: RXABORT, RXCLEAR, TXABORT, TXCLEAR pos2

Purge the serial port: RXABORT, RXCLEAR, TXABORT, TXCLEAR pos2

Purge the serial port: RXABORT, RXCLEAR, TXABORT, TXCLEAR pos2

Purge the serial port: RXABORT, RXCLEAR, TXABORT, TXCLEAR einde sequence

Erdin

The only thing I noticed is 'DTR'.
The 'DTR' is used to reset the Arduino board by the Arduino IDE.
The hardware dtr/rts should be off.
If you use software Xon/Xoff, your sketch should handle those bytes.
It seems that codes like 0x00 are transmitted (eof,event), your sketch should also be able to handle the byte 0x00.

I don't know what this PURGE would involve. I hope you don't use the Serial.flush() command.

Go Up