An Old RS232 Question

Go To Last Post
12 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Folks, I've looked all over the 'net without finding a good answer. There still, after all these years, seems to be a lot of confusion.

I am putting a DB9 RS232 connector on a board. It will be driven from a PC (as host).

My question is WHICH gender for the connector and which pins for Rx and Tx. And, are these Rx with respect to the host (or remote device), etc?

Thanks
Jim Wagner

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is from my understanding of the RS232:

Depends if the device is meant as DCE or DTE (see modems). http://en.wikipedia.org/wiki/Dat... DTE is the "master" like device - the computer. The DCE is the "slave", or modem. The modem is "female" and has the RxD and TxD switched, therefore you should be able to cennect them with a 1:1 connector.

Note: This is just my understanding. It may be crap.

[edit]: http://en.wikipedia.org/wiki/RS-232 has a few words to add.

There are pointy haired bald people.
Time flies when you have a bad prescaler selected.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I always used the mnemonic 'a modem always transmits on pin3' as a memory jogger. My pc here has -12V on pin 3 with a straight cable, so its a 'modem'. A vax used to wire its serial ports as DTE so they would plug into DCE with a straight cable. I guess IBM did it the other way?

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jim,

Modem=DCE (Data Communication Equipment), female
PC is wired as a DTE (Data Terminal Equipment), and thus male.

To connect a modem to a PC, a 1:1 cable should be used with a male at one end and a female at the other end.

Your board will have to be wired as if it was a modem. So female on the targetboard

Now for pinning and the names TxD and RxD .... that can drive men nuts .... so I always add in the schematic something like: TxD of the AVR, or something simular.

And now for the pinning I need to go upstairs once more ... is keeping me fit :)

A GIF is worth a thousend words   They are called Rosa, Sylvia, Tricia, and Ulyana. You can find them https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Okay. Indeed very confusing. But we knew that already.

Like Bob says: on the 9p-subD of the PC pin 3 is on -10V. So that's PC's TxD.

But but but: on PC's with a 25p subD (like in the old days), TxD is on pin 2. And the 25p female subD in the modem expects data on pin 2. (measured)

So with the move from 25p to 9p subD, the pins 2 and 3 were exchanged.

Since the 25 p subD are no longer used, we stick to the 9p. And we use a 1:1 cable to connect the PC with the target. If we need to chit-chat from one PC to another PC, the cable should have female subD's at each end, and the wiring must be made that 2 on one end is 3 on the other end.

Your board will have to receive data on pin 3.

I hope this helps.

Nard

A GIF is worth a thousend words   They are called Rosa, Sylvia, Tricia, and Ulyana. You can find them https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So, does a "standard" (if thee is such a thing) RS232 cable connect straight through, pin2 to pin2 and pin3 to pin3?

I have so many cables, all "custom made" and I have no idea what is more or less "right". I now have something that I want to sell, so need to be a bit more picky than in the past.

Thanks, again,
Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

At the moment IBM decided to drop the 25p subD on PC's and introduced the 9p, all standards became useless. Because modems kept their 25p, and we got an adapter-cable with every modem. And that cable brings:
pin 3 of the 9p female subD that plugs into the PC to:
pin 2 of the 25p female subD in case you have an antique computer, and from there to:
pin 2 of a male 25 p male subD that plugs into the modem.

Holy moly ...

Quote:
So, does a "standard" (if thee is such a thing) RS232 cable connect straight through, pin2 to pin2 and pin3 to pin3?

A 1:1 cable will have all pins wired 1:1, except 5, that's ground, and connected to shield on both ends.

It makes perfect sense to connect your AVR-targetboard with such a 1:1-cable.

And when I need to communicate between 2 AVR's, I use a cross-wired cable with males at each end of the connector. So like you, I have more cables, and I pick the one that was made for that job. And by keeping the standard of male-female, I prevent a mix-up.
The cross-wired cable for two PC's carries two male connectors.

If I need to connect an AVR target to the PC, I use one of the three extension-cables, all wired 1:1, coming from three RS232-ports of the PC.

Phew. And I didn't loose track.

Cheers Jim

Nard

A GIF is worth a thousend words   They are called Rosa, Sylvia, Tricia, and Ulyana. You can find them https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I could have used less words ....

A cable with different sexes on the ends is a 1:1 cable; uni-sexed cables are always cross wired.

Bedtime here ...

Nard

A GIF is worth a thousend words   They are called Rosa, Sylvia, Tricia, and Ulyana. You can find them https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the insight. That answers all my questions (on this topic).

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, null modem cables are pretty standart too. Be careful to notify the user of what he needs :-)

There are pointy haired bald people.
Time flies when you have a bad prescaler selected.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Good point. David!

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

To duplicate what others have said... I build all my AVR remote ends with a female 9-pin wired so that I can use a straight-through cable such as http://www.maplin.co.uk/module.a....

I don't usually do anything with the CTS/RTS and other control pins, so it's a three-wire connection:

*From the AVR*

TXD -> MAX232 T1 in, MAX232 T1 out -> pin 2 (data out)
RXD -> MAX232 R1 out, MAX232 R1 in -> pin 3 (data in)
Ground -> pin 5

Neil (but these days I'd probably sling an FT232R in anyway)