Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

What is the definition of RS232 DB9 female?

Status
Not open for further replies.

tony_lth

Advanced Member level 5
Joined
Jul 28, 2010
Messages
2,086
Helped
377
Reputation
756
Reaction score
368
Trophy points
1,363
Location
Beijing
Activity points
12,621
ALL
I am confusion about the RS232 9pin female connector definition.
1. Could you clear if the following is right or not?
RS232 DB9 9pin female definition:

It should be DCE.
pin# pin name I/O
1 DCD O
2 TXD O
3 RXD I
4 DSR I
5 GND
6 DTR O
7 CTS I
8 RTS O
9 RI O

2. And I used MAX3237EIDBR to convert STM32 UART to RS232 by the aforesaid definition, but the RS232 can't do the flow control, why?
Thanks for your help.
Best,
Tony Liu
 

This is the industry standard pin assignment of a modem that can be connected to a PC RS232 through a straight cable. I don't understand what you mean with "can't do the flow control"? Different flow control option can be selected, hardware flow control must not necessarily be used.
 
Hi, FvM, and ALL
I found from Wiki, https://en.wikipedia.org/wiki/RS-232
As the following picture, for DCE, DTR is "In", which is different from the post#1 definition.
So I don't know which is right?
Thanks.
Best,
Tony Liu
 

Attachments

  • RS232.JPG
    RS232.JPG
    251.5 KB · Views: 97

As the following picture, for DCE, DTR is "In", which is different from the post#1 definition.
So I don't know which is right?
As said, the pin direction in your post #1 table corresponds to the modem and PC standard. The signal naming is however partly different, it depends if the signal function is seen from the DCE or DTE side. Respectively the data output may be either designated RxD or TxD. same with RTS/CTS and DTR/DSR.

You didn't tell what the peer in your test is and how you checked flow control. In case of doubt, I would always check the direction of each signal with a multi meter or RS232 tester.

- - - Updated - - -

The Wikipedia names are correct according to the RS-232 standard as far as I see, the post #1 names are flipped. E.g. TxD according to RS-232 is the signal transmitted from DTE (e.g. computer) to DCE (e.g.) modem, it's using pin 3 of DB9 and is an input on DCE side. In your table, pin 3 is correctly marked as input, but designated RxD (I guess because it's the DCE receiver input). If you assign MAX232 receiver and transmitter channels according to the post #1 "I" and "O" annotation, the circuit should be correct.
 
Actually the DB9 specs are not really a standard because several connections are left out. IBM used the 9-pin connector (DB-9) and the connections (named in #1) has become the standard now. I have not seen any DB25 connector using all the signals as specified in the standards. The wikipedia article does not specify all the signals and the pins.

For a simple connection, you will be needing crossed cables: TxD to RxD and RxD to TxD; DCR to DTR and DTR to DCR; CTS to RTS and RTS to CTS.

Most commonly, we just use RxD, TxD and GND (software flow control)- for basic applications.

Also remember that the original standards state +12 and -12V but in most modern systems we use logic levels.
 
Hi, FvM and c_mitra and ALL,
Thanks.
My case is simple, one side is laptop USB RS232 cable, and the other side is STM32 RS232 port.
I used MAX3237EIDBR to convert STM32 UART to RS232.
So I will use multimeter to check my design.
Best,
Tony Liu

- - - Updated - - -

BTW, FvM, how you test the DB9 I/O with multimeter?
Is it using AT command to set 0/1 for each line, such as RTS/CTS?
COuld you share more details on it?
Best,
 

Also remember that the original standards state +12 and -12V but in most modern systems we use logic levels.
No. According to the standard, a bipolar level of at least +/- 3V is required for RS-232, clearly distinguished from logic level UART interfaces. Also RS-232 level is inverted compared to UART level.

Checking signal direct is easy. Outputs are driven with low impedance to +/- 5.. +/-12V, inputs have kiloohm resistance against ground and no voltage.
 
Is it using AT command to set 0/1 for each line, such as RTS/CTS?,

AT command set is for the modem; you cannot use it to set the RS232 port parameters.

It depends on the actual hardware chip used in your laptop but the port can be configured from the control panel of windows (use setserial on linux).

most modern chips have a autodetect baud rate function. But ALL depends on the hardware configuration on the OTHER side- it can become messy.
 
Hi, FvM and ALL,
My case is a little complex.
I used 9pin female connector DSR as RS232 enable signal. Pls check the picture.
I can't do the flow control with the design.
I guess maybe I connect all the pins of 9pin connector. If I break other pins except TXD/RXD/RTS/CTS/GND, I can't do the chip select without DSR.
So how Can I do? I need one chip enable signal.
Best,
Tony Liu
 

Attachments

  • 111.JPG
    111.JPG
    195.4 KB · Views: 110

Most of the directions on your 9 pin are in the opposite direction that they should be for a female connector if you were trying to follow the standard. If you are trying to connect to a DE9 male with a straight through cable then you have inputs to inputs and outputs to outputs. The only two that are correct are DCD and RI.

The two ends for 232 are DCE and DTE. DCE stands for Data Communications Device (a modem) and has the female connector. DTE means Data Terminal Equipment (PC) and has the the male connector.

The signals OUT of the DCE are RXD, DSR, CTS, DCD, and RI.
The signals OUT of the DTE are TXD, DTR and RTS.

And it actually is a DE9, not a DB. The letter after the 'D' calls out a shell size and the digit is the number of connections. Not that anyone seems to bother with that anymore. Everyone simply calls anything with the basic 'D' shape a DB.
 

I used 9pin female connector DSR as RS232 enable signal. Pls check the picture.
I can't do the flow control with the design.
I guess maybe I connect all the pins of 9pin connector. If I break other pins except TXD/RXD/RTS/CTS/GND

I cannot figure out the function of the circuit you have shown; you have connected the signals to the bidirectional switches.

Short RTS and CTS at the connector itself. Tie both DTR and DSR high permanently. You will need software flow control.
 
Hi, c_mitra and ALL,
Let me explain my circuit.
I have a STM32 UART to output RS TTL signal, which have no prefix, such as RXD, TXD, RTS, CTS, etc.
The STM32 uart signal have two routes, one is routed to a back connector which output TTL.
The other route is a front DB9 female connector, and this route has high priority, and they are converted to RS232 signal with U204 MAX3237.
When front DB9 connector links to a male RS232 signal, the "F_DSR" should be 0 and the DSR level should be above +3V, then IC201 output high level, i.e. "F_RS232" is enabled, and U200 and U202 are enabled, but U201 and U203 are disabled. STM32 UART signal is forwarded to U204 and output to P200 female connector.
When no front connection, "B_232" is high and U201/U203 are enabled and U200/U202 are disabled, STM32 UART signal is output to the back connector and CAN'T reach to U204.
The logic is no problem, and the back STM32 signal is fine, and the front DB9 (P200) also works fine without flow control.
Now the problem is that the front RS232 signal (P200/U204 route) CAN'T DO the flow control.

What do you mean "Short RTS and CTS at the connector itself. Tie both DTR and DSR high permanently" ? Is my circuit any wrong? could you give more details?
Thanks.
Best,
Tony Liu

- - - Updated - - -

In the flow control, does the DSR must be high, which will disable U200 and U202, and the link should be break, is this the point?

- - - Updated - - -

DO you mean to test flow control with "shorting RTS and CTS and tying DTR and DSR to high"? What is "high" meaning? digital 1 or above +3V?
 

I now understand.

You are trying to switch between two route - and using DSR signal from the main source.

As you will be using DSR signal for the select option, it is not available for use in the RS232C data flow hardware control.

Remember that the remote device will not be able to connect to the primary source (you can use DSR signal from one source only).

One DSR is activated, the channel will remain active for bidirectional communication.

For transmission, the levels must be outside +/-5V; for reception the levels must be outside +/-3V. Modern chips accept logic level signals. If the chip needs +/-12V (or +/-5V), it is using RS232C levels.

CTS and RTS are also used for flow control (RS232C flow control is rather messy- the full set is used only on very old equipments- I have not seen them). It is important to loop back the CST and RTS together so that software flow control can be used.

If you want to use hardware flow, use CTS and RTS but DSR and DTR will be unavailable.
 
Hi, c_mitra and ALL,
I see now. Now I need hardware flow, and DTR/DSR are unavailable, could you suggest one solution so that I can detect RS232 signal is plugged in the DB9 female connector?
I need one signal to replace DSR to detect RS232 carrier, any comment?
Many thanks.
Best,
Tony Liu

- - - Updated - - -

Is it possible to use DCD or RI to detect the RS232 connection? But they are output for DCE.
 

You still have most of the connections on the 9 pin reversed in direction. See post #10. You will never get flow control because nothing ever drives CTS, and RTS is being driven from both ends. This may mean you need to rethink the logic side to see if you are using the proper signals from whatever isn't on the sheet you show.

You can use DTR from the DTE - it should be a positive voltage when the DTE is active. The data flow should be controlled with RTS and CTS.

To detect a power off condition at the DTE you may need to put a 300 ohm resistor in series with the DTR line between the connector and the MAX chip. This is dependent on what the DTE is using as a driver. If it's a true 232 driver, then the resistor isn't needed, but if they used something else it may insure the DCE receiver detects a missing voltage as off.

A couple of other observations:

The LM3940 regulator only guarantees a good 3.3 VDC output with at least 4.5 VDC as an input (see the data sheet, it mentions it at least twice). Your schematic shows it as 4.3 volts, so you may get less than 3.3, a noisy 3.3, or both.

You have some signals named as xxx_5v_tol, which I assume means 5 V tolerant? The MAX part is fine with that, but I think the LV4066 signals will diode clamp to the power supply rails, so a 5V signal is going to get reduced going through them (and generate a little heat...)

The two resistors on the HC1G04 inverter outputs do nothing as the inverter has a push-pull output anyway. Also, the second inverter output has the same levels as the signal that went into the first inverter, so you could just pick up your B_232 signal there.


edit:

The 300 ohm resistor is needed in some cases to detect the DTE is powered off but still physically connected to the DCE. If you unplug the 9 pin, the MAX chip will handle the proper default for no connection and signal it as off.
 
Last edited:

Hi, bking,
You said,
You can use DTR from the DTE
, that is what I am doing now, that is DSR for my design, my terminal is DCE.
Pls check what I said in the previous posts before you make a comment. Many thanks.
Best,
tony Liu
 

Hi, c_mitra and ALL,
I want to do hardware flow control, so the following pins should be connected:
TXD, RXD, RTS, CTS, DCD, RI, GND. And DSR and DTR should not be connected.
Right?
many thanks.
Tony Liu
 

Hi, ALL,
My board has two RS232 ports, both pass some convert circuit.
The rear RS232 works fine in hardware flow, and the convert circuit is designed by others ( I don't know its SCH). It has only two IC in the rear convert board, I guess one IC convert TTL to RS232, and the other IC is inverters. The rear Rs232 is originated from prefix "B" signal in post #9 and converted to RS232.
The front RS232 can't work in hardware flow which is designed by myself, as in the post #9. The front RS232 has prefix "F'.
I tested every pins' voltage in NO-connection status. Compare the two ports. The result is as following.
The two pins RTS and DTR are different, which are 0 or 1 in invert status.
But even break the line of DTR, the rear RS232 works fine in hardware flow only with TXD/RXD/GND/RTS/CTS five wires.
What is the root cause for the difference?
Best,
Tony Liu

- - - Updated - - -

HI, ALL
I also compared the two ports pins' voltage in connection established status.
Surely the rear RS232 port is fine and the front RS232 port can't work.
Also DTR and RTS are different.
Who know the root cause for such performance?
Best,
Tony Liu
 

Attachments

  • No_Connection.JPG
    No_Connection.JPG
    54.1 KB · Views: 81
  • Connection_Established.JPG
    Connection_Established.JPG
    48.3 KB · Views: 105

Hi, bking,
You said, , that is what I am doing now, that is DSR for my design, my terminal is DCE.
Pls check what I said in the previous posts before you make a comment. Many thanks.
Best,
tony Liu

While a terminal is, by definition, a DTE, what you have is not a DTE or DCE as the DCD and RI signals are in the opposite direction of CTS and DSR on your schematic when they should be the same direction. Your own post in #3 shows that, and there you asked what is correct, and you were told by more than one person. But feel free to continue to ignore all of that.

Good luck.
 

Hi, bking,
Thanks for your care.
Could you provide a detail definition of all pins of DE9 (miscalled DB9)? And their I/O properties? And your def quote address?

I browsed a few websites and believe my def is right.
1. Pls check this website, they provide a male DE9 def, and I convert it to my female pin def. http://xtronics.com/wiki/RS232_DB9_pinout.html
2. This website has clear def on its "RS232 on DB9 (EIA/TIA 574)" character. It is male, and I converted it to female, get the same def as in my post #1. http://www.zytrax.com/tech/layer_1/cables/tech_rs232.htm
3. Most important, I used a cable only with TXD/RXD/RTS/CTS/GND, and success to do the hardware flow.
Best,
Tony Liu

- - - Updated - - -

PS: I successfully did the hardware flow on my rear RS232 port, but I need to fix the front RS232 port, which CAN'T do the hardware flow.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top