Difference between revisions of "Serialpedia"
(→Table of hardware) |
(→Table of hardware: Correct misidentification after confirming the version of the device that was screwy) |
||
(15 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | This page is for all things serial (RS232, RS422, RS485): how serial cables should be | + | This page is for all things serial (RS232, RS422, RS485): how serial cables should be viewed, mistakes people make in the documentation, list of devices and the cables they require. |
= Serial theory = | = Serial theory = | ||
Line 7: | Line 7: | ||
We'll refer to DE-9 connectors only. | We'll refer to DE-9 connectors only. | ||
− | RS232 was meant for communication between a computer (Data Terminal Equipment, DTE) and a non-computer ( | + | RS232 was meant for communication between a computer (Data Terminal Equipment, DTE) and a non-computer (modem, Data Communication Equipment, DCE). The computer was master, and all the signal names were defined from the point of view of the computer. |
==== Signals ==== | ==== Signals ==== | ||
− | As the signals are | + | As the signals are defined from the point of view of the computer, the names can be extended to refer to the wires on the serial cable themselves. The signals are: |
[https://en.wikipedia.org/wiki/Serial_port#Pinouts Serial port pinouts] | [https://en.wikipedia.org/wiki/Serial_port#Pinouts Serial port pinouts] | ||
− | {| style="margin:auto; text-align:center;" | + | {| class="wikitable" style="margin:auto; text-align:center;" |
! Pin !! Abbreviation !! Name !! Direction* !! Description | ! Pin !! Abbreviation !! Name !! Direction* !! Description | ||
|- | |- | ||
Line 39: | Line 39: | ||
* * Computer = DTE is on the left side; Modem = DCE is on the right side | * * Computer = DTE is on the left side; Modem = DCE is on the right side | ||
− | I'll repeat: '''all the signals are defined from the point of view of the computer'''. This can result in much confusion, because not many people expect something (the modem) to ''transmit'' on the ''receive'' line and ''receive'' on the ''transmit'' line. There are devices which take a [#Straight_cable straight cable] but their documentation errorneously describes a [# | + | I'll repeat: '''all the signals are defined from the point of view of the computer'''. This can result in much confusion, because not many people expect something (the modem) to ''transmit'' on the ''receive'' line and ''receive'' on the ''transmit'' line. There are devices which take a [[#Straight_cable|straight cable]] but their documentation errorneously describes a [[#Crossed_cable_-_null_modem|crossed cable]], for example. |
==== Signal pairs ==== | ==== Signal pairs ==== | ||
Line 45: | Line 45: | ||
The signals that work in pairs are: | The signals that work in pairs are: | ||
− | {| style="margin:auto; text-align:center;" | + | {| class="wikitable" style="margin:auto; text-align:center;" |
! Pair !! Description | ! Pair !! Description | ||
|- | |- | ||
Line 59: | Line 59: | ||
=== Numbering of pins === | === Numbering of pins === | ||
When looking at the DE-9 from the front, the pins are numbered like this: | When looking at the DE-9 from the front, the pins are numbered like this: | ||
− | {| style="margin:auto; text-align:center;" | + | {| class="wikitable" style="margin:auto; text-align:center;" |
! Male DE-9 !! Female DE-9 | ! Male DE-9 !! Female DE-9 | ||
|- | |- | ||
Line 67: | Line 67: | ||
| | | | ||
5 4 3 2 1 | 5 4 3 2 1 | ||
− | 9 7 | + | 9 8 7 6 |
|} | |} | ||
=== Straight cable === | === Straight cable === | ||
− | A straight cable is ''usually'' a cable with '''one male end and one female end''' ([#Exceptions see exceptions]), with all pins on one end connected pins that have the same number on the other end. | + | A straight cable is ''usually'' a cable with '''one male end and one female end''' ([[#Exceptions|see exceptions]]), with all pins on one end connected pins that have the same number on the other end. |
Their main purpose was to connect a computer to a modem. | Their main purpose was to connect a computer to a modem. | ||
− | {| style="margin:auto; text-align:center;" | + | {| class="wikitable" style="margin:auto; text-align:center;" |
! Male DE-9 !! Signal !! Female DE-9 | ! Male DE-9 !! Signal !! Female DE-9 | ||
|- | |- | ||
Line 100: | Line 100: | ||
In practice, you'll need a simplified 3-wire cable only: | In practice, you'll need a simplified 3-wire cable only: | ||
− | {| style="margin:auto; text-align:center;" | + | {| class="wikitable" style="margin:auto; text-align:center;" |
! Male DE-9 !! Signal !! Female DE-9 | ! Male DE-9 !! Signal !! Female DE-9 | ||
|- | |- | ||
Line 112: | Line 112: | ||
=== Crossed cable - null modem === | === Crossed cable - null modem === | ||
− | A crossed cable is usually cable with '''same gender at each end''' ([#Exceptions see exceptions]), with signals that come in pairs crossing over, to simulate a modem in the middle. | + | A crossed cable is ''usually'' cable with '''same gender at each end''' ([[#Exceptions|see exceptions]]), with signals that come in pairs crossing over, to simulate a modem in the middle. |
Their main purpose was to connect two computers to each other, while lying to them that modems are involved. | Their main purpose was to connect two computers to each other, while lying to them that modems are involved. | ||
− | {| style="margin:auto; text-align:center;" | + | {| class="wikitable" style="margin:auto; text-align:center;" |
! Left DE-9 !! Left Signal !! Right Signal !! Right DE-9 | ! Left DE-9 !! Left Signal !! Right Signal !! Right DE-9 | ||
|- | |- | ||
Line 143: | Line 143: | ||
In practice, you'll need a simplified 3-wire cable only: | In practice, you'll need a simplified 3-wire cable only: | ||
− | {| style="margin:auto; text-align:center;" | + | {| class="wikitable" style="margin:auto; text-align:center;" |
! Left DE-9 !! Left Signal !! Right Signal !! Right DE-9 | ! Left DE-9 !! Left Signal !! Right Signal !! Right DE-9 | ||
|- | |- | ||
Line 163: | Line 163: | ||
The order of operations is this: | The order of operations is this: | ||
− | + | # Computer 1 sends data out through its TxD pin (2) | |
− | + | # Modem 1 receives data on its TxD pin (2) | |
− | + | # Modem 1 sends the data to Modem 2 through the telephone network | |
− | + | # Modem 2 receives the data from Modem 1 through the telephone network | |
− | + | # Modem 2 sends data though its RxD pin (3) | |
− | + | # Computer 2 receives data through its RxD pin (3) | |
Remember that the signal lines are named relative to the computer, not the modem. | Remember that the signal lines are named relative to the computer, not the modem. | ||
Line 174: | Line 174: | ||
If we abstract the modem, the order of operations becomes: | If we abstract the modem, the order of operations becomes: | ||
− | + | # Computer 1 sends data out through its TxD pin (2) | |
− | + | # Computer 2 receives data through its RxD pin (3) | |
The other pins that cross over are RTS to CTS, and DTR to DSR. This is so that one computer appears to be a modem to the other computer. Or so that a modem appears to be between them, happily signaling backwards and forwards. Pin 1 is jumpered to Pin 6 to piggy back on the other computer's DTR signal, completing the modem-in-the-middle illusion. | The other pins that cross over are RTS to CTS, and DTR to DSR. This is so that one computer appears to be a modem to the other computer. Or so that a modem appears to be between them, happily signaling backwards and forwards. Pin 1 is jumpered to Pin 6 to piggy back on the other computer's DTR signal, completing the modem-in-the-middle illusion. | ||
Line 201: | Line 201: | ||
This table contains devices have have been encountered, and the type of serial cable they require for a computer to speak to them. | This table contains devices have have been encountered, and the type of serial cable they require for a computer to speak to them. | ||
− | {| style="margin:auto; text-align:center;" | + | {| class="wikitable" style="margin:auto; text-align:center;" |
! Brand !! Model !! Class !! Cable !! Notes | ! Brand !! Model !! Class !! Cable !! Notes | ||
|- | |- | ||
Line 210: | Line 210: | ||
| RTI || AD-8 || audio matrix amplifier || normal straight || The manual doesn't make the type of cable clear at all | | RTI || AD-8 || audio matrix amplifier || normal straight || The manual doesn't make the type of cable clear at all | ||
|- | |- | ||
− | | HDAnywhere || | + | | HDAnywhere || HKHA414SW_V1 || HDMI matrix || unknown || Identification: screws at the bottom of the back plate; two LAN ports<br> |
+ | Baud rate: 600 | ||
|- | |- | ||
− | | HDAnywhere || | + | | HDAnywhere || HKHA414SW_V2 || HDMI matrix || weird crossed? || Identification: screws at the top of the back plate; two LAN ports<br> |
+ | Baud rate: 600 | ||
+ | |- | ||
+ | | HDAnywhere || HKHA414SW_V3 || HDMI matrix || weird crossed || Identification: only one LAN port (older versions have two LAN ports)<br> | ||
+ | Baud rate: 9600<br> | ||
+ | Encountered one model that wouldn't speak anything over serial or UDP - had to abuse the web control interface using wget/curl to control it | ||
|} | |} |
Latest revision as of 14:43, 11 July 2013
This page is for all things serial (RS232, RS422, RS485): how serial cables should be viewed, mistakes people make in the documentation, list of devices and the cables they require.
Contents
Serial theory
RS232
Physical channel
We'll refer to DE-9 connectors only.
RS232 was meant for communication between a computer (Data Terminal Equipment, DTE) and a non-computer (modem, Data Communication Equipment, DCE). The computer was master, and all the signal names were defined from the point of view of the computer.
Signals
As the signals are defined from the point of view of the computer, the names can be extended to refer to the wires on the serial cable themselves. The signals are:
Pin | Abbreviation | Name | Direction* | Description |
---|---|---|---|---|
1 | DCD | Data Carrier Detect | <- | Modem tells computer the connection to the remote peer has been established |
2 | TxD | Transmitted Data | -> | Computer sends data to modem over this line |
3 | RxD | Received Data | <- | Computer receives data from modem over this line |
4 | DTR | Data Terminal Ready | -> | Computer present, ready to talk |
5 | G | Common Ground | - | Just your run of the mill electrical ground |
6 | DSR | Data Set Ready | <- | Modem ready to receive commands or data from the computer |
7 | RTS | Request To Send | -> | Computer wants to send data to the modem |
8 | CTS | Clear To Send | <- | Modem responds to RTS signal to clear computer to send data |
9 | RI | Ring Indicator | <- | Modem tells computer that there's an incoming call |
- * Computer = DTE is on the left side; Modem = DCE is on the right side
I'll repeat: all the signals are defined from the point of view of the computer. This can result in much confusion, because not many people expect something (the modem) to transmit on the receive line and receive on the transmit line. There are devices which take a straight cable but their documentation errorneously describes a crossed cable, for example.
Signal pairs
The signals that work in pairs are:
Pair | Description |
---|---|
TxD, RxD | Computer sends data through TxD and receives data through RxD. The modem receives data through TxD and transmits through RxD |
DTR, DSR | Computer sets DTR, telling the modem its there, and ready to send. The modem sets DSR back to tell the computer it can send data |
RTS, CTS | Computer sets RTS, telling the modem its there, and ready to send. The modem sets CTS back to tell the computer it can send data |
The descriptions for DTR+DSR and RTS+CTS look the same, because that's how they are used when flow control is involved. An application can choose which pair to use for flow control. While with real modems weirder things happen with these signals, for our purposes, this is Accurate Enough(tm).
Numbering of pins
When looking at the DE-9 from the front, the pins are numbered like this:
Male DE-9 | Female DE-9 |
---|---|
1 2 3 4 5 6 7 8 9 |
5 4 3 2 1 9 8 7 6 |
Straight cable
A straight cable is usually a cable with one male end and one female end (see exceptions), with all pins on one end connected pins that have the same number on the other end.
Their main purpose was to connect a computer to a modem.
Male DE-9 | Signal | Female DE-9 |
---|---|---|
1 | DCD | 1 |
2 | TxD | 2 |
3 | RxD | 3 |
4 | DTR | 4 |
5 | G | 5 |
6 | DSR | 6 |
7 | RTS | 7 |
8 | CTS | 8 |
9 | RI | 9 |
In practice, you'll need a simplified 3-wire cable only:
Male DE-9 | Signal | Female DE-9 |
---|---|---|
2 | TxD | 2 |
3 | RxD | 3 |
5 | G | 5 |
Crossed cable - null modem
A crossed cable is usually cable with same gender at each end (see exceptions), with signals that come in pairs crossing over, to simulate a modem in the middle.
Their main purpose was to connect two computers to each other, while lying to them that modems are involved.
Left DE-9 | Left Signal | Right Signal | Right DE-9 |
---|---|---|---|
1 + 6 | DCD* | DCD* | 1 + 6 |
2 | TxD | RxD | 3 |
3 | RxD | TxD | 2 |
4 | DTR | DSR | 6 |
5 | G | G | 5 |
6 | DSR | DTR | 4 |
7 | RTS | CTS | 8 |
8 | CTS | RTS | 7 |
9 | N/C** | N/C** | 9 |
- * Pin 1 is jumpered to Pin 6 to piggy back on the other computer's DTR signal
- ** Pin 9 has no meaning in this usage - nobody is going to ring you
In practice, you'll need a simplified 3-wire cable only:
Left DE-9 | Left Signal | Right Signal | Right DE-9 |
---|---|---|---|
2 | TxD | RxD | 3 |
3 | RxD | TxD | 2 |
5 | G | G | 5 |
What is a "null modem"?
A null modem is an imaginary device that connects two computers together, just like a real modem does, but without involving phone lines.
In a normal setup, two computers speak to each other over the following setup:
Computer 1 -- straight cable -- Modem 1 -- telephone network -- Modem 2 -- straight cable -- Computer 2
The order of operations is this:
- Computer 1 sends data out through its TxD pin (2)
- Modem 1 receives data on its TxD pin (2)
- Modem 1 sends the data to Modem 2 through the telephone network
- Modem 2 receives the data from Modem 1 through the telephone network
- Modem 2 sends data though its RxD pin (3)
- Computer 2 receives data through its RxD pin (3)
Remember that the signal lines are named relative to the computer, not the modem.
If we abstract the modem, the order of operations becomes:
- Computer 1 sends data out through its TxD pin (2)
- Computer 2 receives data through its RxD pin (3)
The other pins that cross over are RTS to CTS, and DTR to DSR. This is so that one computer appears to be a modem to the other computer. Or so that a modem appears to be between them, happily signaling backwards and forwards. Pin 1 is jumpered to Pin 6 to piggy back on the other computer's DTR signal, completing the modem-in-the-middle illusion.
The modem-in-the-middle illusion is what is called a "null modem".
Exceptions
As if the above weren't confusing enough, there are situations like these:
- Same gender at both ends, but straight cable
- Male gender at one end, female gender at the other end, but crossed cable
I named these "weird", for lack of a better term.
Shortcuts
- If a USB serial adapter plugs directly into your device, and you can communicate, you need a normal straight cable (male-female straight)
- If a USB serial adapter plugs directly into your device, but works only after you added a null modem adapter in the middle, you need a weird crossed cable (male-female crossed)
- If you need a gender changed between the USB serial adapter and your device, and you can communicate, you need a weird straight cable (female-female straight)
- If you need a gender changer and a null modem adapter between the USB serial adapter and your device, you need a normal crossed cable (female-female crossed)
Table of hardware
This table contains devices have have been encountered, and the type of serial cable they require for a computer to speak to them.
Brand | Model | Class | Cable | Notes |
---|---|---|---|---|
Triax | HMX 8x8V | HDMI matrix | normal straight | The manual is wrong and specifies a weird crossed configutation |
RTI | AD-4 | audio matrix amplifier | normal straight | The manual doesn't make the type of cable clear at all |
RTI | AD-8 | audio matrix amplifier | normal straight | The manual doesn't make the type of cable clear at all |
HDAnywhere | HKHA414SW_V1 | HDMI matrix | unknown | Identification: screws at the bottom of the back plate; two LAN ports Baud rate: 600 |
HDAnywhere | HKHA414SW_V2 | HDMI matrix | weird crossed? | Identification: screws at the top of the back plate; two LAN ports Baud rate: 600 |
HDAnywhere | HKHA414SW_V3 | HDMI matrix | weird crossed | Identification: only one LAN port (older versions have two LAN ports) Baud rate: 9600 |