Shop OBEX P1 Docs P2 Docs Learn Events
Standard wiring Serial DE9 — Parallax Forums

Standard wiring Serial DE9

Bobb FwedBobb Fwed Posts: 1,119
edited 2009-01-22 06:01 in Propeller 1
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?

Comments

  • LeonLeon Posts: 7,620
    edited 2009-01-20 18:53
    I use:

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

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • sylvie369sylvie369 Posts: 1,622
    edited 2009-01-20 19:37
    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

    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
    223 x 273 - 9K
  • JRod1JRod1 Posts: 7
    edited 2009-01-20 19:45
    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
  • hippyhippy Posts: 1,981
    edited 2009-01-20 20:35
    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
  • LeonLeon Posts: 7,620
    edited 2009-01-20 20:47
    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 MileskiAndrew E Mileski Posts: 77
    edited 2009-01-20 21:13
    There is also the simple circuit on page 5 of the Propeller Datasheet, "2.3.2 Alternative Serial Port Connection".
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2009-01-20 21:35
    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
    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?
  • LeonLeon Posts: 7,620
    edited 2009-01-20 22:22
    That's what I said, earlier.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2009-01-20 22:25
    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.
  • LeonLeon Posts: 7,620
    edited 2009-01-20 23:26
    Google RS-232, you'll find plenty of stuff.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2009-01-21 00:18
    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 MileskiAndrew E Mileski Posts: 77
    edited 2009-01-21 00:31
    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.

    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 FwedBobb Fwed Posts: 1,119
    edited 2009-01-21 00:49
    My application is another device is plugging into the prop. So the prop is acting as the computer.
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2009-01-21 01:14
    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 FwedBobb Fwed Posts: 1,119
    edited 2009-01-21 16:17
    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 FwedBobb Fwed Posts: 1,119
    edited 2009-01-21 22:20
    Or can I use the 1, 4, or 6 pins?
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2009-01-22 06:01
    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
Sign In or Register to comment.