User:Modiba S.E

From Wikibooks, open books for an open world
Jump to navigation Jump to search

'Bold text(stub)

[edit] Physical LayerRS-485 is the physical layer for many higher-level protocols, including Profibus and other fieldbus systems, SCSI-2, SCSI-3, and BitBus. [1]

Unlike RS-232, which has a "transmit wire" and a "receive wire", RS-485 has a "transmit wire pair". Typically one wire is labeled "A" and the other is labeled "B", and the wires are twisted together (a "twisted pair"). This allows RS-485 to transmit over much longer distances, using equivalent wires and equivalent transmitters and receivers, than RS-232.

Many RS-485 implementations use 2 wires (1 pair). At all times, at most one device is transmitting on the pair, and all the other devices on the network are listening (half-duplex). It is the responsibility of user software to ensure that several different devices don't try to transmit at the same time; this can be a tricky coordination task.

Some RS-485 implementations (in particular, some Ethernet configurations) (also some Macintosh GPIO socket) use 4 wires (2 pairs) for point-to-point communication. One of the pairs is dedicated to PC-to-peripheral communication. The other pair is dedicated to peripheral-to-PC communication. Each pair can transmit at full speed whether or not the other pair is transmitting (full-duplex).

Typically the bit sequence is generated by a UART inside a microcontroller, which is wired to a RS-485 interface IC (also called a "RS485 Line Driver/Receivers" or "RS-485/RS422 Transceiver"). Many manufacturers make such interface chips [2] . From there the RS-485 signaling typically travels over CAT-5 cable [3] . At the other end of the cable is (typically) the same thing -- the connectors, the RS-485 interface IC, and a UART inside a microcontroller.

[edit] RequirementsA full-duplex RS-485 system requires 3 twisted pairs: 2 twisted pairs for signaling, and another conductor for ground. This so-called "four-wire RS-485" system requires 5 wires. A half-duplex system only requires 2 twisted pairs: one twisted pair for signaling, and another conductor for ground. This so-called "two-wire RS-485" system requires 3 wires.[4][5][6]

There must be a common "ground" shared between all the chips connected to the RS-485 signal pair. However, that "ground" wire and the rest of the RS-485 network (the signal wires and the RS-485 transceiver chips directly connected to them) can be galvanically isolated and "floating" relative to earth ground and the rest of the system. For long RS-485 cable runs -- from one building to another -- typically each local system sends power through a small isolating transformer to power the local RS-485 transceiver chip, and the local system sends data to and receives data from that transceiver chip through optoisolators.[7]


[edit] Limitations(stub)

Standard RS-485 is limited to a maximum speed of 35 Mbps with a network length of 12 meters, and 100 Kbps with a network length of 1200 meters. [8]

With interface devices that exceed standards and careful network design, higher throughput over longer cables is possible. [9]

[edit] HandshakingThere is no hardware handshaking in RS-485. If handshaking is required for RS-485 it can be done using X-On / X-Off handshaking protocol.

The RS-485 standard originally used half-duplex communication and handshaking signals such as RTS/CTS to control the direction of data flow. Many USB to serial converters come with ADDC (Automatic Data Direction Control) to automatically sense and control data direction, making the handshaking signal method obsolete.

[edit] RS-485 in the Real WorldNow being used commonly in the pro audio industry to control digital audio and signal processors such as the DBX driverack and other manufacturers equivalent products. Preferred to RS232 due to cheaper cabling run costs and the common availability of cables (similar to RJ-45).

When wiring a RS-485 network, always connect "A" to "A", "B" to "B", and "G" to "G".[10]

Many people recommend writing prototype software as if it will be connected to a half-duplex RS-485 network. Then the software will work unchanged when connected to a full-duplex RS-485 network, a RS-232 network, and a variety of other communication media.

Many people recommend wiring things up on a prototype with Category 5 cable connected as point-to-point full-duplex RS-485. The CAT-5 cable allows you to relatively quickly switch -- to half-duplex RS-485, or the 3 wires of RS-232, or a variety of other communication protocols -- without pulling any new cables. The point-to-point full-duplex RS-485 network allows you to get the complete prototype system fully operational quickly, since it is easier to debug and more immune to certain common problems on other systems (noise problems on RS-232, turn-around problems on half-duplex RS-485, etc.).

[edit] ApplicationsApplications

[edit] Nonstandard Connectors and Wiring see the 4 wires in the socket? Localtalk only uses the outer pair.The LocalTalk network uses RS-485-compatible differential signaling on standard 4-wire RJ11 telephone connectors and cable. LocalTalk only connects to the next-outermost pair of wires (the "outer pair" on a standard 4-wire cable).

The innermost pair of wires is ignored by LocalTalk, so the inner pair is often used for standard analog telephones.

(Is there a similar standard for RS-485 on a RJ45?)

RJ45 connections are used for RS-485 frequently, due to the ease of using the modular connectors and availability of cables and connectors. A RS-485 interface will usually use pins 7 and 8 for the two data lines, since they comprise a twisted pair. This avoids conflict with both Ethernet (Pins 1-3, 6) and analog phone (Pins 4-5). Grounding can be problematic depending on the application. Often, use of shielded CAT5/6 cable can give an adequate signal ground, although this is not recommended.

[edit] Physical Limitations in Practice(stub) [edit] Differences between RS-232 and full-duplex RS-485(stub)

From a software point of view, full-duplex RS-485 looks very similar to RS-232. With 2 pairs of wires -- a dedicated "transmit" pair and a dedicated "receive" pair (similar to some Ethernet hardware), software can't tell the difference between RS-485 and RS-232.

From a hardware point of view, full-duplex RS-485 has some major advantages over RS-232 -- it can communicate over much longer distances at higher speeds.

Alas, a long 3-conductor cable intended for RS-232 can't be switched to full-duplex RS-485, which requires 5 conductors.

RS-232 is only defined for point-to-point connections, so you need a separate cable for each sensor connected to a host CPU. RS-485 allows a host CPU to talk to a bunch of sensors all connected to the same cable.

[edit] Differences between RS-232 and half-duplex RS-485But a lot of RS-485 hardware uses only 1 pair of wires (half-duplex). In that case, the major differences are

Each RS-485 node, including the host CPU, must "turn off the transmitter" when done transmitting a message, to allow other devices their turn using the shared medium The RS-485 hardware generally receives on the receiver every byte that was transmitted by every device on the shared medium, including the local transmitter. So software should ignore messages sent by itself. A long 3-conductor cable intended for RS-232 can often be switched to half-duplex RS-485, allowing communication at higher speeds and at higher external noise levels than the same cable used with RS-232 signaling.

RS-232 is only defined for point-to-point connections, so you need a separate cable for each sensor connected to a host CPU. RS-485 allows a host CPU to talk to a bunch of sensors all connected to the same cable.

Alas, half-duplex RS-485 networks are often more difficult to debug when things go wrong than RS-232 networks, because

When a "bad message" shows up on the cable, it is more difficult (but not impossible) to figure out which node(s) transmitted that message when you have a shared-medium with a dozen nodes connected to the same single cable, compared to a point-to-point medium with only 2 nodes connected to any particular cable. Transmitting data bidirectionally over the same wire(s), rather than unidirectional transmission, requires a turn-around delay. The turn-around delay should be proportional to the baud rate -- too much or too little turn-around delay may cause timing problems that are difficult to debug[10]

[edit] Differences between RS-232 and both kinds of RS-485RS-485 signal levels are typically 0 to +5 V relative to the signal ground.

RS-232 signal levels are typically -12 V to +12 V relative to the signal ground.

RS-232 uses point-to-point unidirectional signal wires: There are only two devices connected to a RS-232 cable. The TX output of a first device connected to the RX input of a second device, and the TX output of the second device connected to the RX input of the first device. In a RS-232 cable, data always flows in only one direction on any particular wire, from TX to RX.

RS-485 typically uses a linear network with bidirectional signal wires: There are typically many devices along a RS-485 shared cable. The "A" output of each device is connected to the "A" output of every other device. In a RS-485 cable, data typically flows in both directions along any particular wire, sometimes from the "A" of the first device to the "A" of the second device, and at a later time from the "A" of the second device to the "A" of the first device.

[edit] Alternatives to ASCII UARTs that drive RS-485 signal levels

I've been told that 10BASE-T Ethernet and SCSI cables use a bunch of RS-485 pairs -- is that right ? In the case of 8 bit SCSI this is not the case, the drivers are single wire with a 220/330 ohm terminator at each end of the buss. Half of the conductors in a 50 way cable are ground return wires. This applies to the 8 bit version of the original 50 way SCSI interface. Ultrawide SCSI does use differential drive but whether it is RS485 compatible, I don't know.

CAN bus Cables and Connectors shows standard (?) pinouts for connecting w:CANbus to RJ11 and DE9 connectors. (CANbus uses RS-485 signal levels and hardware, but not ASCII UARTs, right?) CANbus can use RS485 but can also use open collector, optical or its own drivers. In any discussion of these bus systems you need to make a distinction between the physical layer and software and protocol layers. An ASCII UART can use 485 with suitable driver chips...--AndrewJWilson 18:50, 22 June 2006 (UTC)

[edit] Termination Wikipedia has related information at electrical termination

Perhaps the most controversial part of RS-485 is what to do at the end of the line. There are a wide variety of popular techniques, each of which works great under one narrow range of conditions.

Bob Perrin lists the 4 most popular techniques[11]:

unterminated: This is the simplest system, but only works if both the data rate and length are low enough. A good guideline for when it can be used is to keep the product of the data rate (in baud) and the longest end-to-end cable length below four hundred thousand.[12] Number of transmitters / receivers aren't important (just keep them within RS-485 specification). This is the only case where a star bus topology works reliably.[13]. one-way resistor termination: Only works if there is only one transmitter, which must be at the opposite end (from the resistor) of a linear bus. two-way resistor termination: Only works with a linear bus, but allows transmitters only at the endpoints of the bus[citation needed]. AC termination: While AC termination may work well on backplanes[14], others discourage its use on RS-485 lines: "In practice, I have never seen [AC termination] do anything except butcher signal integrity."[15]''''Bold text'[1]

  1. wikipedia