I'm studying computer architecture at my university and I've been recently asked a question: what is CLK used for in UART/USART? The first obvious thing is that it is used for dividing frequency when passing it through BAUD generator. But I've been told that there are some more cases where CLK is necessary. The other obvious thing is that it's used for synchronization ,but what exact synchronization? I guess it is used for some sync with the externals(and internals) of SuperIO.

I'm not attaching to some specific chip and speak about UART and SuperIO IC in general.

So the question is: where clk, connected to UART/USART inside SuperIO, is used disregarding its usage in BAUD generator?

  • 1
    \$\begingroup\$ Can you specify the microcontroller you are referring to? I've worked with pics and st arms, but I've never heard of this "SuperIO". Maybe we call the same thing in different ways... \$\endgroup\$ – Vladimir Cravero Dec 17 '12 at 21:44
  • \$\begingroup\$ @Vladimir Cravero SuperIO is an integrated circuit on personal computer mother board which combines interfaces for a variety of low-bandwidth devices \$\endgroup\$ – roman Dec 17 '12 at 21:53
  • 3
    \$\begingroup\$ Ok I'm getting it now. What you say is correct, the clock is needed to generate the baud and to synchronize the U(S)ART registers with the rest of the computer. I think that the answer expected is something like "uart communication is asynchronous so we absolutely need the system clock inside the peripheral that handles it because the data input must be synchronized with system clock". You do not really need sysclk to generate the baud, since baud can be, and actually is, asynchronous, but you need sysclk to let SIO and USART talk together. \$\endgroup\$ – Vladimir Cravero Dec 17 '12 at 22:34
  • \$\begingroup\$ It's not used. Maybe it was used once upon a time, but that must be >25 years ago. \$\endgroup\$ – starblue Dec 19 '12 at 12:12

The term UART is an acronym for Universal Asynchronous Receiver/Transmitter. The term Asynchronous means something like, "not at the same rate", or not synchronized. In digital communications, asynchronous usually refers to two systems which are not sharing a common clock. The type of communication that a UART does is generically referred to as "asynchronous serial communication". UART is the device, async serial communication is what it does.

Digital logic requires a clock to function. More correctly, most digital logic of any interesting complexity requires a clock to function. And a UART is no different, and requires a clock to drive the internal logic. UARTs also have to connect to a controlling device, usually a CPU of some sort, and that connection usually requires a clock (the bus clock). Sometimes the internal clock and the bus clock are the same clock, but usually not.

Now let's talk about how the async communication works. Lets say that you and a friend are on the pier and you synchronize your watches. You agree that once a minute you will use a flashlight to send a binary 1 or 0 to your friend. You then get on a boat and go out into the water. The once a minute thing works great for a while, but your watch is a little fast compared to your friends watch, and soon you two are not communicating correctly. As more and more time goes on, the two watches become more out of sync.

The next time you try that with your friend you modify your "communication protocol". Instead of syncing your watches on the pier, you say that the next flashlight pulse will happen one minute after the previous pulse, plus or minus 10 seconds. So as long as your watches are not out of sync by more than 10 seconds every minute, your communications will happen without error. Each flashlight pulse provides the synchronization for the next pulse. The timing errors between the two watches is not allowed to accumulate, but gets "zeroed out" every time there is a flashlight pulse.

A UART does the same thing. But in this case the "watches" are synchronized at the beginning of each byte (at the "start bit"), and not re-synchronized for the remainder of the byte.

The clock that is used for the UARTs internal logic is used to drive the logic, but also to keep time during the byte. The UART detects the start of the byte and reset a digital timer to help it keep track of time until the end of the byte.

A UART also has something called a "baud rate generator", which is essentially like a stopwatch used to keep track of the elapsed time for each bit. It is this stopwatch, or digital timer, that gets reset at the start of each byte. Most UARTs have a register setting that configures the communication speed, and thus the speed of this stopwatch.

The difference between a UART and a USART is that the S stands for Synchronous. These devices also support a synchronous communications method. In other words, they can be configured to communicate asynchronously or synchronously. When in sync mode, the communications cable has a clock signal on it which is shared by both the receiver and transmitter. The use of the sync mode of a USART is largely obsolete these days.

UARTs/USARTs also have to communicate with the CPU (or something similar). This is normally done using a bus. Not all buses are synchronous, but most of the modern ones are. For this to work, both the CPU and the UART use the same clock for communications, and so there is no need to sense the start of a byte (or word or whatever) and time things like what is done for async communications.

  • \$\begingroup\$ "The use of the sync mode of a USART is largely obsolete these days." I must disagree, when microcontrollers need to communicate with high-speed equipment using serial connections sync mode is not only invaluable but required, and many devices that are interfaced with embedded systems and the like still use such older standards because companies don't want to spend the money to upgrade (they may not even be able to upgrade, if versions supporting current high-speed data transmission standards aren't available). \$\endgroup\$ – JAB Jan 30 '13 at 15:22
  • \$\begingroup\$ @JAB I don't doubt that there are devices that use the synchronous mode-- I just haven't seen one in the past 20 years. Even then, the only devices that I did see were stuff to communicate with T1/E1 lines-- certainly a niche use. Can you provide some links to real-world equipment that requires sync mode? \$\endgroup\$ – user3624 Jan 30 '13 at 15:27
  • \$\begingroup\$ Actually, I'm currently working on a project involving data over an RS-422 line, which can have an up to 10Mbps data rate. The processor involved has a frequency of 84 MHz, and the UART only supports asynchronous communication up to master clock / 16, which means the maximum baud rate we'd be able to use with that is 5.25e6. The processor also has several USARTs, and while those apparently could support up to about 10e6 baud with a limited oversampling mode, normal oversampling still requires the external clock signal to be used, and of course a slower processor would need it either way. \$\endgroup\$ – JAB Jan 30 '13 at 18:17
  • \$\begingroup\$ (Anyway, it's more of an "obsolescent" or "deprecated" rather than "obsolete" situation, from my point of view.) \$\endgroup\$ – JAB Jan 30 '13 at 18:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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