3
\$\begingroup\$

This should be a basic but fundamental question.

Suppose I have a source and destination communicating over a wire.

Source wants to send bit stream 01101 to destination.

Suppose high voltage is used to represent 1 and low voltage is used to represent 0.

How are the bits transmitted over the wire?

Can multiple bits exist on the wire at an instant of time?

Or only a single bit can exist on the wire at an instant of time?

And how to understand this in the context of RS-232 communication?

enter image description here

enter image description here

ADD 1 - 5:55 PM 2/12/2022

Thanks for the great answers so far. I think I didn't make myself clear for one thing:

Almost all answers so far mentioned symbols that encode multiple bits. And in that sense, even a single symbol one wire means multiple bits on wire.

This reminds me that, what I really want to ask is, is it possible to have multiple symbols on wire? Be it representing 1 or multiple bits.

Summary - 3:10 PM 3/21/2022

(The summary is for bobflux's answer.)

  • The voltage value on the wire is meaningless if the sampling point is not decided. So we need a clock wire.

  • And the sampled bits are still meaningless if we don't know how to frame them into units like bytes. So we need a word clock wire. Or encode the framing info in the bit stream. Such as start/end bits.

  • It is not bits but symbols that are transmitted on the wire. A symbol may represent multiple bits. And there can be multiple symbols on the wire simultaneously. Just like passing balls through a pipe. Though the physical details can be intricate.

ADD 1 --- 9:34 AM 6/30/2023

  • As to the word/framing above, my understanding is, if we use a word clock wire, that means the frame/word boundary is fixed by the word clock signal. But if we encode the framing info in the bit stream, the location of the boudary can be flexible.
\$\endgroup\$
3
  • 4
    \$\begingroup\$ Try Wikipedia RS232 and if you have a more specific question, then update this question. With RS232, only one bit can exist on the wire at one time. More advanced encoding techniques can encode multiple bits, but that's another question. \$\endgroup\$
    – Kartman
    Feb 12, 2022 at 6:24
  • \$\begingroup\$ When talking about encoding multiple bits, I think that's related to baud rate. Thanks I will take a look at the RS232. \$\endgroup\$ Feb 12, 2022 at 6:28
  • 3
    \$\begingroup\$ Please note that RS-232 does not define how bits are or should be transferred over wire, so in fact looking at RS-232 won't help much. Some answers below assume UART protocol being used. \$\endgroup\$
    – Justme
    Feb 12, 2022 at 9:23

6 Answers 6

8
\$\begingroup\$

Suppose high voltage is used to represent 1 and low voltage is used to represent 0. How are the bits transmitted over the wire?

Bit values are only one half of the problem, the other is timing: the receiver needs to know when the bits happen, when one bit ends and the next one starts, etc. If the receiver gets a waveform like this:

enter image description here

then it wouldn't mean anything without the red lines below, which represent the time points when the bit value is meaningful and should be read:

enter image description here

One solution is to transmit a bit clock on another wire (like I2C or SPI) to tell the receiver when it should sample the incoming bits. That solves the bit timing problem, but that doesn't solve the other problem, which is... what do the bits mean? If the receiver needs to extract meaningful information from the bits, for example to combine them into bytes, characters, frames, packets, etc, then it needs to know which bit is the first one in one of those units.

This can be solved with another wire, like a word clock in I2S or chip select in SPI, which tells the receiver which bit is the first bit, ie when a frame starts.

So, a serial protocol that transmits raw bits over the wire, as voltage levels, needs at least 3 wires. But if you want to use less wires, then the above information has to be encoded into the data stream.

For example, in I2C, only two wires are used, and framing information (start of transaction, etc) is encoded by transitions that don't occur during normal data transmission.

In most other source-synchronous protocols (that means one separate clock line) like HDMI, framing information is encoded in the data.

Serial UART only needs one wire. There are start bits to signal when the transmission starts (solves the framing problem) and the user sets the baud rate manually to the same value on both ends, solving the timing problem.

So even if raw bit values are transmitted on the wire encoded as voltage levels, like in Serial UART/RS232, they're not the only thing being transmitted. There's also framing and timing.

Most systems don't transmit bit values directly, but use symbols instead. This can be anything (frequency, phase, amplitude levels, bit encoding, etc) that suits the transmission medium. For example you could use 4 voltage levels to encode 2 bits. In this case, there are no bits on your wire, only symbols.

For example, Ethernet. It's a layered system with each layer using the layer below. Suppose your browser makes an HTTP request. It is encapsulated into TCP/IP packets, which are then encapsulated into Ethernet packets, each layer adding its own information saying what the data means, where it should be routed, etc. This is passed to the Ethernet MAC/PHY chip (or pair of chips), whose job is to transmit this data to the other side of the Ethernet cable. In 100Mbps mode (the usual 100BaseT) it first converts the data to 4b5b encoding, which means each half byte (4 bits) is encoded into a 5-bit sequence which has some desirable properties, like avoiding long sequences of identical bits: since no clock is transmitted, the receiver has to extract it from the data by looking at the transitions between bits/symbols. If a long sequence of identical bits was transmitted, then there would be no transitions, and the receiver clock would not be able to realign with these transitions, so it would drift, and maybe miss the next bit when it comes. Some of those symbols also encode start conditions so the receiver knows where the packets start.

Encoding frame boundaries requires extra transmissions, it can't be done inside the original bitstream: if you define that a certain sequence marks the beginning of a frame, then when that sequence occurs at random in the transmitted data, it would be interpreted as frame boundary. The 4b5b encoding solves this problem along with clock recovery.

Then this is further encoded into analog modulation and sent on the wire. Note the modulation scheme is independent from the previous step. Optical ethernet and copper ethernet use different ones.

Can multiple bits exist on the wire at an instant of time?

If you use symbols that represent several bits (like 4 different voltage levels) then yes.

If you use symbols that represent less than one bit then you could have less than one bit on your wire.

If the wire is long enough relative to the symbol rate, then it is a transmission line. For example with USB3 at 5 Gbps, take a propagation speed of 200000km/s, then the signal propagates about 20cm in one nanosecond. With a rate of 5 symbols per nanoseconds, this means each symbol is about 4cm long in the wire. So if the wire is 1 meter long, there are about 25 symbols propagating in it. Each one represents slightly less than one actual data bit due to the encoding being used, but you get the idea.

\$\endgroup\$
6
  • \$\begingroup\$ Thanks for the great answer. It is really impressive to explain the needed number of lines from the perspective of data bits, framing and timing. And the last vivid example confirm my guess that a transmission line can be not conceptually but physically thought of like a pipe. \$\endgroup\$ Feb 12, 2022 at 9:41
  • \$\begingroup\$ And inspired by the last example, if I tap some logic analyzers on the wire every 4cm, the analyzers will show values of different symbols at the same instant of time. \$\endgroup\$ Feb 12, 2022 at 9:46
  • 1
    \$\begingroup\$ My only critique is assuming that RS-232 uses UART protocol. RS-232 does not define how to transmit bits, it is undefined and up to application. However, almost all applications of RS-232 happen to use UART protocol. \$\endgroup\$
    – Justme
    Feb 12, 2022 at 9:51
  • \$\begingroup\$ The answer also seems to assume there is only one type of Ethernet and it uses 8b10b encoding, which is not true. And it's not the MAC chip that talks over a cable, it's the PHY chip that defines the media interface. 10BaseT uses Manchester encoding, 100BaseTX uses 4b5b encoding with MLT-3 line code, and 1000BaseT is even more complex. No common Ethernet standard uses 8b10b. \$\endgroup\$
    – Justme
    Feb 12, 2022 at 10:46
  • 1
    \$\begingroup\$ @smwikipedia thanks! Yeah it's pretty much a pipe. If you put logic analyzer probes along the wires, the probes would most likely add impedance discontinuities that would reflect the signal and make a mess. But in theory, forgetting about that for a moment, yes, that would work. \$\endgroup\$
    – bobflux
    Feb 12, 2022 at 11:27
2
\$\begingroup\$

Can multiple bits exist on the wire at an instant of time? Or only a single bit can exist on the wire at an instant of time?

Talking about symbols rather than bits and a symbol can be one bit or multiple (higher order modulations), the now changed question is: can multiple symbols exist at the same time on the same wire.

And the answer is Yes!

common transmission lines, like Ethernet cable for example, transports the electromagnetic wave of your signal with roughly 65% of lightspeed.

This means a 10ns pulse travels about 2m per second. [1,94865m/s]

Lets take a 10m cable and send one 10ns symbol after another... and you see, there are 5 symbols fitting into that cable! And its true, the symbol travelling a transmission line is wandering along the path and does only occupy a limited space (We are not talking about crosstalk, reflections, etc here to not complicate things).

Lets take a modern industrial fieldbus with a logical ring made of two pair point to point sections with a baudrate of 250MSps = 4ns per symbol and 10 devices connected with 9 50m cables (each cable is travelled in both directions)...

In that scenario we have ~700 Symbols on the wires at the same time!

\$\endgroup\$
8
  • \$\begingroup\$ Which Ethernet has 10ns symbols? Or is this just a theorerical example? \$\endgroup\$
    – Justme
    Feb 12, 2022 at 9:59
  • \$\begingroup\$ @Justme it is just a theoretical example. The interesting fact ist the 65% of lightspeed which is a very common value \$\endgroup\$
    – schnedan
    Feb 12, 2022 at 10:01
  • \$\begingroup\$ @schnedan - the velocity factor is just a physical attribute of the cabe - nothing to do with it being ethernet. Most electrical cable will be similar. \$\endgroup\$ Feb 12, 2022 at 10:45
  • \$\begingroup\$ @KevinWhite "like Ethernet cable for example" It didn't say its limited to ethernet... its just a common thing most people know, right? \$\endgroup\$
    – schnedan
    Feb 12, 2022 at 10:52
  • \$\begingroup\$ 2m per nanosecond, I think \$\endgroup\$
    – Frog
    Feb 12, 2022 at 21:02
2
\$\begingroup\$

Data can be transmitted more than one bit at a time in one instant, if the thing being sent is a multi-bit symbol.

For example, PAM-5 encoding on Gbit Ethernet sends 2.5 bits per symbol. QAM-256 used for digital cable uses two quadrature signals with 16 levels each, which form a constellation of 16x16 points. Thus it has 8 bits per symbol.

More about QAM here: https://www.electronics-notes.com/articles/radio/modulation/quadrature-amplitude-modulation-types-8qam-16qam-32qam-64qam-128qam-256qam.php

RS-232 uses only one bit per baud (symbol) with NRZ coding as would be used by a UART. Multibit entities such as UART data are sent serially, one bit at at time, along with at least two overhead bits (start and stop) for padding.

\$\endgroup\$
1
  • 2
    \$\begingroup\$ My only critique is assuming that RS-232 uses UART protocol. RS-232 does not define how to transmit bits, it is undefined and up to application. However, almost all applications of RS-232 happen to use UART protocol. \$\endgroup\$
    – Justme
    Feb 12, 2022 at 9:52
1
\$\begingroup\$

I'll have my take on answering that as simply as possible. A little simplified, but will hopefully give you a general understanding of what's going on.

While in some cases it's possible to have more than 1 bit of data on a wire at a time, usually it's just 0 or 1. So when the data is transmitted over single wire (such as UART or I2C - I2C has only 1 data line), then the line is either 0 or 1, and the receiver basically asks periodically "what's on the line now? 0. And now? 1. And now? 1. And now? 0." This is called serial communication - there is a series of bits. Examples: I2C, SPI (Serial peripheral interface), USART/UART, USB. Characterized by low wire/pin count.

If you need more data transmitted at once, there exists parallel communication - simply multiple wires, each with 0 or 1. The receiver reads all of them at once and like "oh this is 0110. And now? 1100. And now? 1110." And so on. An example is DDR - you have many-many wires/pins and they all transmit info at the same time. For example, 64-bit at a time on 64 data connections.

When exactly the receiver "samples" the wire (that's the term) is defined by the specific hardware, protocol. It's usually tied with clock signal (if there is one, if not, such as UART, then sampling rate is determined from the signal itself).

\$\endgroup\$
5
  • \$\begingroup\$ Yes, it is indeed easier to consider that a receiver just periodically ask for the wire content. While ignoring all the complex details on the wire. It's a practical perspective. Thanks. \$\endgroup\$ Feb 12, 2022 at 9:51
  • \$\begingroup\$ UART sampling rate is not defined by signal itself. User must set correct baud rate to both devices for them to communicate. Oversampling makes sure the start bit is seen by the receiver with high enough precision to sample the data frame bits with local clock. \$\endgroup\$
    – Justme
    Feb 12, 2022 at 9:57
  • \$\begingroup\$ @Justme and then there exists autobaudrate on the receiver sometimes. While your correction is 100% on point tho, I was making a simplified generalized point. But yes, my answer is not a proper guide into different protocols. \$\endgroup\$
    – Ilya
    Feb 12, 2022 at 10:02
  • \$\begingroup\$ Auto baud detection must also know something about the data and protocol being sent. For example, using UART protocol, sending 0xFF at 57600 bps looks identical to sending 0xFE at 115200 bps. \$\endgroup\$
    – Justme
    Feb 12, 2022 at 10:20
  • \$\begingroup\$ I think we're going too far into specifics (which doesn't change the fact that you're right, but it's not really relevant to the question anymore) \$\endgroup\$
    – Ilya
    Feb 12, 2022 at 10:21
1
\$\begingroup\$

RS-232 is a specification for a physical electrical interface. It just defines the electrical levels, it so has nothing to do with how bits are sent over the wire. And high voltage is logic 0 and low voltage is logic 1. So with RS-232, you have only 2 logic levels, and it is the line protocol and encoding that defines how to send bits. As RS-232 specifications define communication speeds only up to 20 kilobits per second, and distances are typically limited to only few tens of meters, it means that bit rate is so slow that only a single bit travels along the wiring at once.

However, it is very common to use an UART to send data over RS-232, so the bits are sent with asynchronous start-stop protocol frame, and it uses NRZ line encoding.

But any other protocol to send bits or any other line coding can be used as RS-232 specification leaves that to the user.

Edit: Other interfaces that have higher bit rates can send bits or symbols over a wire so that the time that the bit/symbol takes to travel in the wire is longer than the bit/symbol duration. In fact that is the reason that in 10Base2 Ethernet the packet sent over the coaxial cable must have a minimum length so that it is long enough that a packet start travels to all nodes on the long bus before packet ends, so that no two nodes send short packets that are so short that they get corrupted when they travel simultaneously to a node in the middle. The bits are sent at 10 Mbps and maximum coaxial cable length is 185 meters. Since it takes approximately 1 microsecond for a pulse to travel 185 meters, about 10 bits can be sent to cable before they come out from the other end.

\$\endgroup\$
2
  • \$\begingroup\$ "...it means that bit rate is so slow that only a single bit travels along the wiring at once..." --- So if the bit rate is quick enough, multiple bits will exist on the wire. I think it just like the example in bobflux's anser. \$\endgroup\$ Feb 12, 2022 at 9:53
  • \$\begingroup\$ And thanks for pointing out the separation of duties between RS-232 and UART. \$\endgroup\$ Feb 12, 2022 at 9:54
1
\$\begingroup\$

Suppose I have a source and destination communicating over a wire.

Source wants to send bit stream 01101 to destination.

Suppose high voltage is used to represent 1 and low voltage is used to represent 0.

How are the bits transmitted over the wire?

the source makes a symbol for a 0 then a symbol for a 1 and again a 1 and then 0 then 1 and whatever symbols it may need to indicate the start anend end of a transmission.

Can multiple bits exist on the wire at an instant of time?

Absolutely, for example, Old-school 10-base-2 Ethernet signals at 10 million bits per second but the signals only travel down the wire at about 200 million meters per second so if you have a wire 100m long there can be 5 bits "in flight" on the wire at the same time.

Or only a single bit can exist on the wire at an instant of time?

At the receiving end the bits arrive in the same order that they were sent one by one. (there are also ways to put more than one bit in a symbol.)

And how to understand this in the context of RS-232 communication?

RS232 is usually slow enough that there is only one bit on the wire at a time

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.