Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note, the TX wires of one microcontroller are wired to the RX wires of the other microcontroller. A similar situation occurs on the RTS and CTS wires. Always verify that the TX and RX wires are swapped.

...

USART vs UART

Some connections called USART (Universal Synchronous/Asynchronous Receiver/Transmitter) add a clock signal to the signals seen above. The clock signal regulates the rate of data transmission and removes the need for both sides to agree on a baud rate.

The sending device or an external source will transmit a clock signal that will allow the devices to read specific bits. The clock signal will be labeled CLK or Clock.

Theory of Operation

  • Serial protocols can be characterized into 2 types, synchronous and asynchronous. As you may have guessed by the acronym, the asynchronous in UART refers to the fact that the protocol is asynchronous The synchronous version is called USART (see difference in USART vs. UART). It is outside the scope of this document to discuss the advantages and disadvantages of each type, it is discussed more fully here: Asynchronous vs Synchronous Protocols

  • The sample rate of the protocol is referred to as the baud rate. Standard baud rates include 9600, 38400, 115200, etc.

  • Typically, a data packet can be anywhere from 8-12 bits wide. The elements are typical as follows

    • Start & stop bits:

      • As discussed in the Async vs Sync protocol document, the line is pulled low to indicate the start of transmission. A single bit is appended to the start and end of the packet.

    • Data:

      • The data can be anywhere from 5-9 bits wide. The exact number varies per application, but typically 8.

    • Parity bit(s):

      • A parity bit may be appended to the end of the message to ensure accuracy of the message. A parity bit operates by setting the extra appended bit to either 0 or 1 to preserve the parity of the payload.

      • Consider a protocol that has a single ‘even’ parity bit that has a message of 10101010. Since there are 4 high bits (1’s) in the payload, the parity of 1’s is even as 4 is even, therefore the message with the appended parity bit is 101010100.

      • Consider a protocol that has a single ‘even’ parity bit that has a message of 10101011. Since there are 5 high bits (1’s) in the payload, the parity of 1’s is odd as 5 is odd, therefore the message with the appended parity bit is 101010111 to make the parity of 1’s even.

...