Go Down

Topic: Implement a DTR pin for RS232? (Read 10214 times) previous topic - next topic

cruzze

Dec 14, 2011, 12:10 am Last Edit: Dec 14, 2011, 12:16 am by cruzze Reason: 1
Hi,

I am using the Arduino for RS232 serial communication with a few external devices. Most of the devices only require the Rx, Tx and GND (pins 2,3 and 5 on a DB9) but one device also requires the DTR ("data terminal ready", pin 4). This pin can be connected directly to Arduino +5V via a 47 ohm resistor. Although it seems to work ok, I am not 100% confident that this is the proper way to solve it. Does anyone have a better idea on how to implement the DTR signal for RS232?
For the record I use a MAX233 chip between the Arduino and the external devices to get the proper signal levels (apart from the DTR which goes directly to Arduino as said).

Thanks!

Cruzze

pwillard

Technically, what you have done is "ok" but not best practice.   Since DTR is only supposed to signal to the other end that your device is powered on an ready, it should not need to change state. The MAX233 has 2 "inverting" transmitters and 2 "inverting" receivers.  Why not use an extra transmitter from the IC to the RS-232 connector DTR pin... tying the ttl side of the transmitter to a logic state (or even  pin so you could change it if you need to).

cruzze

Many thanks for the info! I might consider to connect the DTR to MAX233.

Cheers

Cruzze

betterthanalemur

Using the other transmit port on your MAX233 is the best way to go.  Just hook the 'tx in' pin to an Arduino digital output pin and hook the 'Tx Out' pin to the DE9 pin that you want to drive.  Fwiw, this is the correct way to drive *any* (all) of the serial port IO pins, including the Ring Indicator.
It should wire up like:


Also for what it's worth, (and for anyone else who finds this thread in a search who may not have to actually control the hardware lines, but can get by with just overriding them) a lot of hardware flow control problems can be dealt with (skipped) by jumpering respective signals.
DSR (6) to DTR (4)
RTS (7) to CTS (8)
Similar to:


And for good measure you can wire in the DCD line similar to:


So you would end up with your arduino connected to Tx (2) and Rx (3) and have
RTS (7) to CTS (8) to DCD (1)
and
DSR (6) to DTR (4)

I wouldn't recommend connecting RI (9) to the DSR/DTR combination as this can trigger an interrupt in some equipment (pretty much nothing nowadays, but I'm guessing that you are interfacing to something legacy if you are dealing with hardware flow control)

betterthanalemur

I just did some searching around and even this commercial arduino sheild doesn't have the hardware flow control lines hooked up *or* bypassed.
http://www.cutedigi.com/arduino-shields/rs232-shield-for-arduino.html
for what it's worth, you can add DTR control using only two wires. 
Run one wire from D2 (or any other digital port) to U1, Pin 10
Run another wire from U1, Pin 7 to pin 4 of the DE9 connector
Pins on the serial chip (U1) are labeled Counter Clockwise from the pin with the 'dot' by it (Pin 1 is on the lower left when you look at the chip so you can read the text)
like:

and:

zoomkat

Google for serial port "loopback" schematics, as they may tie the appropriate pins together to simulate DTR.
Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0

Go Up