0

I think "async/sync" and "serial/parallel" are orthogonal concepts. There can be 4 combinations of communication types:

  1. async serial
  2. sync serial
  3. async parallel
  4. sync parallel

From the book "Serial Port Complete", I read this:

In common use, the term “serial port” refers to ports that use a particular asynchronous protocol.

It seems it is referring to the type 1 above - or it is treating serial and async as synonyms of each other?

Do the other 3 combinations exist? Any examples?

smwikipedia
  • 1,102
  • 2
  • 16
  • 34
  • There's even Wikipedia articles about these concepts, have you found them? – Justme Feb 12 '22 at 11:35
  • 1
    Yes. I am reading them. And I also post question here in case I am lost in too many concepts... – smwikipedia Feb 12 '22 at 11:54
  • 1
    If you talk about a "serial port" without qualification, it's reasonable to assume RS232 simply from its ubiquity. You can now search RS232 and find its characteristics which will answer the main question. The other question : Yes, lots. –  Feb 12 '22 at 13:52
  • Related https://electronics.stackexchange.com/questions/486687/what-is-the-exact-difference-between-synchronous-and-asynchronous-serial-transmi – Bruce Abbott Feb 12 '22 at 17:27
  • If you want to know more about what the book refers to when it talks about "serial port", here is the author web page for the book, including a freely downloadable index and first chapter which defines what the book is about : http://janaxelson.com/spc.htm – Justme Feb 13 '22 at 13:46
  • RS232 is not a protocol it is a pinout/connector/voltage standard, other than others making the same mistake you should find nothing related to protocol. The protocol predates the current desire to name things. Looking for uart will give you much better and more accurate results than rs232 – old_timer Feb 13 '22 at 19:20

4 Answers4

3

Yes, a "serial port" traditonally means the so called COM ports on PCs and other devices, which are serial communication ports that use the RS-232 electrical signaling with an UART to handle the serial communication, and an UART uses the asynchronous start-stop framing protocol for data transmission.

So no, the serial and asynchronous are by no means synonymous.

There many are other kinds of ports that are serial too, but they are just not called as the "serial port".

The other examples exist too.

  1. Synchronous serial is used by USART, which is an UART with a clock. SPI is also synchronous serial, and I2C.

  2. Asynchronous parallel means something happens asynchronously without a clock or data strobe. Sure, you can for example just make a R2R DAC and put it on 8 parallel data lines. There is no clock or strobe signal needed, the resistors will convert the 8-bit value to analog voltage output whenever there is a change on data bus. This is only an example and bad one too.

  3. A lot of devices and chips have synchronous parallel buses. For example synchronous memory modules have parallel bus and a clock for determining when something should happen on the parallel communication bus.

Justme
  • 127,425
  • 3
  • 97
  • 261
2

Justme and Andy raised an interesting point in the comments, about the meaning of "synchronous" and "asynchronous".

I first went with a strict meaning of "Synchronous means transmitter and receiver run on the same clock, so there is no need to for clock recovery in the receiver." That covers "source synchronous" if the source transmits the clock on a dedicated clock trace/wire alongside the data, but there are other options, for example both transmitter and receiver could be clocked by something else.

With an UART, characters are sent... when they're sent. Even in a "continuous" stream of data there can be random pauses between characters which are not integer multiples of the bit duration. So the receiver must synchronize on the start bit of each character and then sample the subsequent bits according to the preset baud rate.

Now when the clock is not explicitly transmitted but instead embedded in the signal (Manchester, SPDIF, USB, etc) and has to be recovered by the receiver, I called this "asynchronous" by mistake, but it's in fact synchronous.

To add a layer of confusion, it is absolutely possible to decode slow synchronous protocols like SPDIF, USB1, Manchester, etc with an asynchronous receiver which samples the signal at a much higher frequency. This gets several bits per actual signal bit, then looks at the duration of one and zero levels and/or transition times, and decides what the data should be without having to recover any clock.

Soo... "synchronous" would in fact be a property of the transmitted signal, meaning it is synchronized with a clock of constant frequency (no possibility of random duration pauses between characters like for a UART).

async serial: UART

sync serial with separate clock line: SPI, I2C, I2S, HDMI...

sync serial with embedded clock: SATA, USB, SPDIF...

sync parallel: all synchronous RAM interfaces, DDR, most buses (PCI...), PATA, SCSI...

Having a separate clock line avoids the need for clock recovery, but clock and data must arrive at the receiver with proper timing. Synchronous parallel systems usually require all data bits to arrive at about the same time too.

The difference in arrival time between all these signals is "skew", and if there is too much skew, some of the btis will be early, some will be late, some will be in transition when they should be steady, and it makes a mess. So you get wiggly traces on your motherboard between CPU and RAM to make sure all the lines have the same length. PCI bus was the same story, but in hard mode: adding cards in your PC adds capacitance to the bus along with reflections and signal integrity issues due to tapping a transmission line, which means maximum possible skew increases the further away from the bus master you are, and on top of that it depends on what's plugged. That's why PCI never reached high clock speeds, and PATA required those special snowflake cables to run at high speeds.

In addition, if it's a bus, it'll be half-duplex, only one master is transmitting at a time. If it's RAM, either it reads, or it writes, but not both. And if it's synchronous, then you have another problem: if the length of clock and data are matched, then when the CPU sends data and clock to the RAM, it will all arrive in sync. But when the RAM sends data to the CPU, then it won't be in sync with the clock sent from the CPU due to roundtrip delay. So you get rather complex systems with PLLs and propagation delay compensation, etc. If it's parallel, the higher the bitrate, the more headache, including per-pin skew compensation, etc.

That explains the popularity of serial stuff: PCI-e can use many lanes but they're all independent, there is no main clock, it's all fully asynchronous, and skew requirements between lanes are much less of a problem.

async parallel: hmmm...

That could mean "lots of serial links like PCI-e" but that's not really "parallel".

It's a bit of a paradox to define this last one. If you're controlling a bunch of stuff with GPIOs, it could be argued this is "asynchronous parallel", with each bit having some special meaning to the receiver. However, if it's really a parallel port and the bits are transmitted asynchronously, it means going from "00" to "11" will go through a "10" or "01" state if one signal switches faster than the other. That's only usable if you don't care what happens during the transitions.

bobflux
  • 70,433
  • 3
  • 83
  • 203
  • 2
    Your extended definition of synchronous is incorrect. Manchester encoding and data scrambling require clock recovery and these are both regarded as synchronous transmissions. – Andy aka Feb 12 '22 at 12:22
  • You're right, it was unclear, I replaced "should" with "must" – bobflux Feb 13 '22 at 18:56
-2

Here's your quote (all I have to go on): -

In common use, the term “serial port” refers to ports that use a particular asynchronous protocol.

And, it is incorrect because serial data can be synchronous or asynchronous.

All four types you mention exist: -

  • Manchester encoding of serial data is a good example of synchronous serial data. So are serial transmissions that scramble the data to ensure the bits are toggling quite often thus allowing a clock to be extracted.

  • A UART transmission is a good example of asynchronous serial data.

  • Just a plain ordinary parallel byte can be regarded as asynchronous if the succeeding logic does not have a clock input.

  • If the parallel byte is presented with a clock signal, then this can be regarded as synchronous. The good old fashioned Centronics printer port falls into this category.


For the objectors and downvoters, this is the book's front page and note that it contains the word USB and, USB is a synchronous data transmission: -

enter image description here

Also note that I was very clear in my opening phrase that the quote was "all I had to go on" hence, without any other context, I was correct in saying that the quote was incorrect. The term "serial port" (in a book called "Serial Port complete") that covers USB has to mean any serial port and, that includes asynchronous as well as synchronous serial ports.

Andy aka
  • 434,556
  • 28
  • 351
  • 777
  • 2
    I don't see how you can claim the quote is incorrect - it's not saying that all serial data transfer is asynchronous, IMHO it's effectively saying something along the lines of 'What most people call a serial port is a UART' – NMF Feb 12 '22 at 12:39
  • 1
    It is incorrect - there; I said it again. In engineering, we strive for precision and exactitude. – Andy aka Feb 12 '22 at 12:44
  • 2
    The book is about PC serial communication ports, or COM ports, so in that context a serial port specifically means just that specific type of port. Later on the book was extended with USB when it came to PCs. – Justme Feb 12 '22 at 12:52
  • In the 21st century most PC serial ports are USB and are therefore synchronous. It's all about context and which century you brain is locked into. – Andy aka Feb 12 '22 at 12:55
  • 2
    The serial port is still very much relevant everywhere, so I bet most people would describe "serial port" as the 25-pin or the IBM-specific 9-pin serial interface which uses RS-232 electrical signaling with UART for data framing. It is rare to see other ports being called as serial ports, even if they did use UART for serial comms, such as some RS-422 interfaces, MIDI or DMX512. – Justme Feb 12 '22 at 13:08
  • 1
    @Andy aka - 'It is incorrect - there; I said it again. In engineering, we strive for precision and exactitude.' - but sometimes we just come across as pedantic? I think the meaning of the quote is clear, and even now the UART is very widely used and is (rightly or wrongly) synonymous with 'serial port' in 'common use', so I respectfully disagree with you! – NMF Feb 12 '22 at 13:13
  • @NMF please feel free to make your own answer to this question rather than continue this public disagreement about how much of a pedant I am. I am a pedant and I don't dispute that. In fact it's because I'm a pedant I pay a whole lot of attention to detail. The devil is in the detail and that's why I'm an OCD pedant = makes me good at my job actually. – Andy aka Feb 12 '22 at 13:35
  • 1
    But I think you ignored the important words "in common use". The question was not about the technical definition of a "serial port" but about the common use of that term by non-engineers. You are not being a pedant if you answer a different question then the one that was asked. – Elliot Alderson Feb 12 '22 at 13:42
  • 2
    @All - *Please be nice* - see the site's [Code of Conduct](/help/conduct). As a mod it's impossible to keep everyone happy, but some comments were deleted after things became *too* personal. [Polite constructive criticism](https://meta.stackexchange.com/questions/19756) is allowed in comments (with the emphasis on *polite* & *constructive*) but *ad hominem* attacks are not. And while I take *great* care not to be heavy-handed as a mod, these situations happen *much* too often. If you can't "be nice" in a reply, then **don't reply**. See [here](https://meta.stackexchange.com/questions/311737). – SamGibson Feb 12 '22 at 15:20
  • @Justme the book is about serial ports and, as shown in the picture of the book in my answer addition, this includes USB and USB is not asynchronous. I don't care what earlier additions didn't have - I can only go on what the OP puts in his or her question. I'm really not sure that your comment is bringing anything to the party. – Andy aka Feb 12 '22 at 17:22
  • 1
    @SamGibson as far as I'm concerned you should remove all the comments below my answer because clearly I have demonstrated why my original answer is what it is. A clean sheet so to speak. – Andy aka Feb 12 '22 at 17:58
  • @Andyaka - "*you should remove all the comments below my answer*" Having taken advice - those comments serve to explain what has already been said, to indicate disagreements with your answer. You don't have to change your answer, but removing comments could mean future readers spend time writing similar comments again highlighting concerns with your answer i.e. removing those comments would waste other people's time. Also, people are allowed to constructively disagree in comments (within limits), so I see no valid justification for removing them. | Please use Meta for any further discussion. – SamGibson Feb 14 '22 at 02:50
-2

tl; dr: async/sync and serial/parallel are orthogonal concepts. But further, perhaps in the interests of simplicity, the authors chose to overlook the bigger picture: clock coherence.

Synchronous vs. Asynchronous

Asynchronous in the author's context means that the transmitter sends no clocking information to the receiver. The receiver must infer clocking based on other information.

The authors say ‘asynchronous’ but really they mean non-self-clocking. Their naïve misunderstanding does a disservice to both the interface-level and system-level understanding of clocks.

Bear with me here, I'll explain below.

Link partners using a bit-serial digital interfaces can synchronize bit timing in three ways:

  • non-self-clocked: bit clock is inferred from format. Example: UART.
  • in-band self-clocked: bit clock is encoded in the bit stream. Example: SPDIF
  • out-of-band clocked: bit clock is sent separately. Example: I2S

UART serial data format includes start/stop bits that provide information to identify frames. UART data isn't self-clocking, only the data bits are sent (plus start/stop, and parity if enabled.) Instead, UART bit boundaries and sample points are understood by shared agreement between the link partners on the sample (baud) rate and format, with timing specified from the start bit.

So when we say a UART link is ‘9600-N-1’: we are specifying this agreement; the UART receiver synthesizes a bit clock based on it. This locally-created bit clock is a facsimile of the sender's bit clock, and is roughly synchronized with it.

Faster serial interfaces don’t tolerate the relatively imprecise bit timing used for UART. Instead, the transmitter provides a clock. There’s two ways it can do that: by a separate wire (out-of-band) or by encoding it with the data (in-band).

SPDIF, used for digital audio, is an example of a self-clocked interface with an in-band clock. It uses biphase-mark (differential Manchester) encoding that guarantees a signal transition on every bit. This allows the receiver to extract the bit clock with less jitter (important for digital audio work) than frame-based methods. For framing, SPDIF uses reserved patterns called preambles to identify blocks of data.

I2S, also used for digital audio, is a example that uses an out-of-band bit clock. I2S data frames are aligned with an out-of-band 'word select’ signal.

Here's the thing. Regardless of the origin of the bit clock, whether it is sent out-of-band, in-band or synthesized (as in a UART), this clock is synchronous to the sender's timebase. It has to be to recover the data, which is also in the sender's clock domain. All three methods arrive at the same place: serial data, clocked in by a bit clock at the receiver.

However, this receive-side version of the bit clock isn't necessarily synchronized to the receiver's timebase. That is, the link partner timebases are not guaranteed to be coherent with each other. They could be in different clock domains. In system terms, this is an asynchronous clock domain crossing. This turns out to be far more important than the details of how the receiver clocks in bits.

Sometimes timebase coherence doesn't matter. Sometimes it matters a lot. A UART transferring a text file doesn't care about coherence, but there is still a clock domain cross internally that might be resolved by a FIFO for example. An audio DAC playing SPDIF absolutely cares about it: missed samples mean clicks and pops in the audio.


Parallel vs. Serial

When we think about multi-bit parallel, there’s a tendency to assume that these are synchronous interfaces, because how else can you deal with the inter-bit skew otherwise? Asynchronous parallel just doesn’t seem possible at first glance.

But it is: by embedding clock timing in each parallel data bit, each can be self-timed and clocked by the receiver.

And that’s exactly what’s done in PCI Express. Each bit - or lane - carries timing information along with data, which the receiver recovers per lane.

The PCIe lanes of course share a common transmit clock, and inter-lane skew is controlled so that the receiver can assemble them into bytes, but nonetheless each lane is self-timed.

PCIe also has the system-level clock coherence issue. It does however support both a coherent timebase (like most PCs do) by providing an out-of-band clock, or a source-synchronous timebase where the receiver recovers the timebase from the stream.

hacktastical
  • 49,832
  • 2
  • 47
  • 138
  • 3
    In UART data, the receiver's clock **isn't** recovered from the data being sent; the receiver's clock is fixed and free-running but, it also has to be no more than a few percent different to the transmitter's clock frequency hence, both ends "agree" on the nominal baud rate before hand. In summary: asynchronous data reception **does not** recover the clock from the transmitted data. Synchronous data reception **does** recover the clock (or uses a clock transmitted separately by the transmitter as in a USART or SPI). – Andy aka Feb 12 '22 at 16:18
  • 1
    It does actually: a UART receiver samples the start bit to determine the bit cell timing. So it synthesizes (recovers) a local bit clock from that in-band information. Think of it as a crude digital PLL that gets re-synced every frame. SPI doesn’t synthesize a local clock, it is sent out-of-band alongside the data. – hacktastical Feb 12 '22 at 16:40
  • That functionality isn't what defines the meaning of asynchronous in this context. The receiver clock is still running asynchronously and is unaffected by detecting the start bit edge. Extra hardware that performs counting is reset to that edge in order to determine the mid-point of the bit. The receiver's clock (in a UART) is not recovered from the transmitted data. – Andy aka Feb 12 '22 at 16:46
  • A UART receiver clock is recovered *over the extent of a frame*, 10 bits for an 8n1 setup. Like I said, it’s a crude kind of digital PLL (DLL really), and it assumes some gross agreement between the frequencies, although auto-baud works around that, too. USART sync mode implies either sending a clock separately (out of band), or sending frames continuously, formatted in such a way that a continuous clock can be recovered (in-band). But only the former method actually shares a clock reference. – hacktastical Feb 12 '22 at 17:14
  • A UART receiver clock is free running and asynchronous period. – Andy aka Feb 12 '22 at 17:19
  • 2
    _" a UART receiver samples the start bit **to determine the bit cell timing**."_ - No, it doesn't. It _assumes_ the bit cell timing, which is why the baud rates at transmitter and receiver have to be very close for reliable communications (<+-5% difference for 8 bits). – Bruce Abbott Feb 12 '22 at 17:44
  • 2
    @Andyaka You confuse the receiver’s master clock with the synthesized bit clock. A designer, in theory, could create a circuit to analyze a UART stream and make a pretty accurate representation of the transmitter’s clock. This isn’t necessary to receive UART data since it re-syncs on frame boundaries, but if it were to do so then in theory higher rates could be supported, since framing would be synchronous. – hacktastical Feb 12 '22 at 17:46
  • @Bruce Abbott The receiver absolutely uses the start bit to establish bit cell timing, usually by oversampling the edge and counting clocks from that edge. It’s essentially a DLL. – hacktastical Feb 12 '22 at 17:50
  • 1
    @hacktastical the "synthesized bit clock" is entirely synchronous with the receiver master clock but, the master clock IS NOT synchronous with the data nor does it make any attempt to do so. It's a sampling system that, due to knowledge of the baud rate, is reliable but not synchronous. – Andy aka Feb 12 '22 at 17:54
  • 1
    @Andyaka you seem to keep getting hung up on the notion of master clock. If I were to add a frac-N PLL and analyze the UART steam, I could reliably recreate that master clock with high accuracy. UART doesn’t require that, it creates a bit clock that, while it isn’t perfectly synced and phase-aligned to the transmit master clock, is accurate enough to time the bits over the duration of a frame. The recovered bit clock will resemble the master clock divided by some factor, and have some cycle skew, but it will be grossly synchronous to the master. – hacktastical Feb 12 '22 at 18:10
  • 1
    That's the point - it isn't synchronous with the transmission. That is what synchronous or asynchronous means in this context. In asynchronous comms the receiver clock makes no attempt to synchronize. That is why UART uses a start bit and a stop period; it cannot handle a long sequence of data because, it is not synchronous. – Andy aka Feb 12 '22 at 18:19
  • A USART using an in-band clock has exactly the same issue as a UART: no perfect-sync clock reference. The method of solving it depends on the protocol in use, but it boils down to providing an embedded timing reference from which the receiver derives the bit clock. Even at that, an out-of-band reference clock can also have skew and thus require local recovery to optimize bit timing (like PCIe with common master for example.) My point is to break that false ‘sync’ / ‘async’ dichotomy and think about clocks and data more at the system level. – hacktastical Feb 12 '22 at 18:35
  • 2
    _"...no perfect-sync clock reference. The method of solving it depends on the protocol in use"_ - It is not possible to reliably extract a clock from asynchronous serial. Each frame is self contained and has no relationship to any other. A stop bit will begin some time after the start bit begins, but unless you _know_ the bit time you can't tell if the next '1' is a data bit or the stop bit. You _have_ to know the exact bit rate. Not to say you can't do 'synchronous over async' by putting clock info in the data (eg. sending a particular character to 'train' the receiver). – Bruce Abbott Feb 12 '22 at 18:56
  • 3
    The 'A' in UART is for asynchronous. The receiver free-runs at local clock, and thus can only receive with some tolerance due to the oversampling usually involved. The transmit clock is never regenerated at the receiver as it is not needed. The clocks just need to be close enough for a duration of a frame and the receiver begins frame reception only after detecting a start bit. So it easily allows transmit and receive clocks to free-run and have approximately 2% difference in speed. – Justme Feb 12 '22 at 19:47
  • To decode a digital stream, you need to know the bit times, and where the frames are if the data have a higher significance than just 0 and 1. You can send that information out-of-band, like SPI, or in-band, like UART, but ultimately you need the same information regardless of the clocking arrangement. The argument over whether the receive master clock is synchronous to transmit or not is completely irrelevant to that basic requirement. Regardless of how it’s created, the data sampling clock *will* be the same rate as transmit data clock, or close enough to it, to reliably sample the data. – hacktastical Feb 12 '22 at 20:34
  • 1
    `close enough to it` does not mean synchronous. – Andy aka Feb 12 '22 at 20:57
  • 1
    Even a clock sent out-of-band has some jitter and skew. The only difference between that and one that uses a crash-locked state machine like a UART is the *amount* of jitter and skew. ‘Close enough to it’ means that the synthesized sample clock uncertainty - jitter and skew - is small enough and positioned well enough to reliably sample the data. It is nonetheless synchronous to the transmit clock, even if it’s only for one frame. It is ‘close enough’ for UART speeds. – hacktastical Feb 12 '22 at 21:09
  • 1
    Sorry, I have to agree with Andy, Justme, and Bruce. The receiver in a UART **does not** attempt to synthesize a clock based on the timing of incoming data. If that were the case then we wouldn't require tight tolerances on the matching of the transmitter and receiver baud rate clocks in the first place. – Elliot Alderson Feb 14 '22 at 11:31
  • 1
    @Elliot Alderson I explained this. UART data doesn't embed bit timing.. It's implied by shared agreement between the link partners. The receiver bases its sample clock synthesis on that, and the start bit. – hacktastical Feb 14 '22 at 15:50
  • 1
    You said the rcvr "synthesizes (recovers) a local bit clock **from that in-band information**". That is not the case. It uses the same baud rate clock that it uses for transmission. That is why oversampling is required. How could the receiver synthesize and use a new clock if all of the bits are zero? There are no transitions that can be used. and by the time the receiver got the stop bit it would be too late. – Elliot Alderson Feb 14 '22 at 17:09
  • 1
    I do not say this in the answer. Because this has become such an s-show, I refined and clarified the point about non self clocking. Here’s the answer text: “ Based on this ‘shared agreement’ the UART receiver synthesizes a data sampling clock, aligned to the start bit plus a half-bit offset, and uses this clock to the sample remaining bits in the frame.” Note that word ‘recover’ isn’t there anymore. – hacktastical Feb 14 '22 at 19:06