PDA

View Full Version : Standard wiring Serial DE9



Bobb Fwed
01-21-2009, 02:47 AM
I am looking for what the standard wiring is for a DE9 (9-pin) D-sub connector is. I have the male end and I am trying to connect it to a device that is normally connected to a computer's serial port.
All I know is the incoming serial line is supposed to have 22kohm resistance. I'm pretty sure pin 5 is ground.
The important pins I am looking for are in and out, but is there also other wiring to let the device know the cable is plugged in or anything like that?

I am wiring it to a propeller, is there any special precautions I should take to protect my device?

Leon
01-21-2009, 02:53 AM
I use:

pin signal
2 TxD (output from MCU)
3 RxD (input to MCU)
5 Ground

Leon

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle

sylvie369
01-21-2009, 03:37 AM
Bobb Fwed said...
I am wiring it to a propeller, is there any special precautions I should take to protect my device?


Per Wikipedia:

"signal levels of ▒5 V,▒10 V,▒12 V, and ▒15 V are all commonly seen depending on the power supplies available within a device. RS-232 drivers and receivers must be able to withstand indefinite short circuit to ground or to any voltage level up to ▒25 volts."

If you're talking about wiring pins from a standard serial adapter directly to a Propeller, I think you're heading for big trouble. You will want to build a MAX 232 circuit to bring the Serial levels to appropriate TTL 5V/0V levels, and then use a 1K resistor going to the Propeller chip I/O pin to compensate for the fact that the Propeller uses 3.3V.

I'm using a couple of these kits:

www.awce.com/rs1.htm (http://www.awce.com/rs1.htm)

but you'll find that you can build the circuit on protoboard for considerably less $$.

Attached is a diagram of the pins that I've found useful.

Post Edited (sylvie369) : 1/20/2009 7:44:17 PM GMT

JRod1
01-21-2009, 03:45 AM
Acroname has an adapter for $11.75 that will do the level translation for you. Check it out at http://www.acroname.com/robotics/parts/S13-SERIAL-INT-CONN.html

hippy
01-21-2009, 04:35 AM
I've had no trouble wiring a PC to a Propeller using a simple resistive interface ( run-time comms not programming ) but it all depends on what's actually wanted.

propeller.wikispaces.com/Two-Resistor+Serial+Interface (http://propeller.wikispaces.com/Two-Resistor+Serial+Interface)

Leon
01-21-2009, 04:47 AM
The MAX3232 is intended for 3.3V operation. I've got a 5V MAX202 on a little PCB with a DB-9 connector that works OK at 3.3V. It's the same as the adapters that are available for sale, but cost me next to nothing to make.

Leon

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle

Andrew E Mileski
01-21-2009, 05:13 AM
There is also the simple circuit on page 5 of the Propeller Datasheet (http://www.parallax.com/Portals/0/Downloads/docs/prod/prop/PropellerDatasheet-v1.1.pdf), "2.3.2 Alternative Serial Port Connection".

Bobb Fwed
01-21-2009, 05:35 AM
hippy said...
I've had no trouble wiring a PC to a Propeller using a simple resistive interface ( run-time comms not programming ) but it all depends on what's actually wanted.

propeller.wikispaces.com/Two-Resistor+Serial+Interface (http://propeller.wikispaces.com/Two-Resistor+Serial+Interface)

This is what I was looking for, great!
And to confirm with someone else, pin 2 out (from ÁC), pin 3 in (to ÁC), and 5 common ground?

Leon
01-21-2009, 06:22 AM
That's what I said, earlier.

Leon

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle

Bobb Fwed
01-21-2009, 06:25 AM
Not that I don't trust you, I just like getting a second opinion, and no other input on the pins has been given yet.

Leon
01-21-2009, 07:26 AM
Google RS-232, you'll find plenty of stuff.

Leon

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle

Dr_Acula
01-21-2009, 08:18 AM
I've found this site very helpful http://www.beyondlogic.org/serial/serial.htm

Max3232 as stated earlier.

I like to keep all serial stuff simple and 3 wires. If you use max3232s (or 232s) on every board/box etc it doesn't matter if you muddle all the wires up or power one board up and not the other as rs232 can handle that. Simple rule of thumb - 3 wires pins 2,3,5 and if the plug is male the data comes out of pin 3 and if it is female it comes out of pin 2. When data comes out of a pin the volts should be resting negative, so if you have a male plug and no data is coming out you should measure -9 or -12V or similar.

Sometimes you need to loop back the other pins. Eg if you are using a PC terminal program to talk to a board eg a propeller or picaxe then hypterterminal will not work until it gets a signal to say it can send. You can make sure you tell it to always send by wiring pins 1 4 and 6 together and wiring pins 7 and 8 together. I do this on all plugs (ie female) ones that connect to PCs because it will always work then. Hyperterminal has 3 types of comms - hardware, xon/xoff and none. Select none.

If you join pins 1.4.6 and join pins 7.8 on all plugs, and wire pins 2,3,5 through, it greatly simplifies all the things that can go wrong. The main problem then is wiring a male to a male plug or a female to female, and in that case, just cross over pins 2 and 3.

Andrew E Mileski
01-21-2009, 08:31 AM
Bobb Fwed said...
Not that I don't trust you, I just like getting a second opinion, and no other input on the pins has been given yet.


Here's one of the better sites with lots of pictures. (http://zytrax.com/tech/layer_1/cables/tech_rs232.htm)

On Computer (DTE)
pin 2 - RXD
pin 3 - TXD
pin 5 - GND

On Propeller (DCE)
pin 2 - TXD
pin 3 - RXD
pin 5 - GND

Bobb Fwed
01-21-2009, 08:49 AM
My application is another device is plugging into the prop. So the prop is acting as the computer.

Dr_Acula
01-21-2009, 09:14 AM
Back in the day there were rules about male and female and DTE and DCE but the rules kind of go out the window when sometimes you have a board acting as a device (ie you might be programming it) and then later you have the same board acting as a computer. So it doesn't really matter whether you put a male or female plug on it. Just make sure if it is male the data comes out of 3 and if female it comes out of 2. I'd probably put a male plug on it if it is acting as a computer. But it depends a bit on what devices are going to plug in to the prop board. You can always build crossover cables. Does your device need the handshaking lines?

Bobb Fwed
01-22-2009, 12:17 AM
No it doesn't need hand shake.
So if I want my device to detect when another device is plugged in, I can...? Feed 3.3V in to pin 7 and check for it on pin 8?

Bobb Fwed
01-22-2009, 06:20 AM
Or can I use the 1, 4, or 6 pins?

Dr_Acula
01-22-2009, 02:01 PM
Detecting something being plugged in might involve some 'custom' use of the pins, so your device might not work with other standard RS232 devices. Personally, I prefer a software approach. Just poll the pins every now and then with a "hello?" and if you get something back then a device is connected. You can poll at different baud rates to pick up more devices. But maybe have a read of the RS232 specs as there may be an official way to do this. RS232 never was "plug and play". It was more "plug and then spend an hour with a RS232 diagnostic device and a multimeter..." What are you connecting to and how much control do you have over that device and the way it talks/responds?

Re feeding 3.3V into a pin - is that via a max3232? Because while 3.3V is a valid RS232 voltage, 2.5V isn't and 0V certainly isn't.

Post Edited (Dr_Acula (James Moxham)) : 1/22/2009 6:07:01 AM GMT