Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • RTL Foundations36
  • Combinational Design25
  • Sequential Design27
  • FSM & Control27
    • Controller and Datapath
    • Moore vs Mealy
    • State Encoding
    • Multi-Cycle Sequencers
    • UART Transmitter
      • Framing and Timing
      • The UART TX FSM
      • Cycle-by-Cycle Walkthrough
      • Verification and Integration
      • Mini Project: an SPI Master
    • Memory Controller
  • Timing & Clocking39
  • Reset & CDC34
  • Memory & Buses57
  • Advanced RTL28
  • Senior & Interview76
  • Glossary and Notation
Loading lesson

‹UART Transmitter
  1. Topics
  2. RTL Design
  3. FSM & Control
  4. UART Transmitter
  5. Framing and Timing

Part 4 · FSM & Control · Intermediate

Framing and Timing

The 8N1 frame and how to pick clocks per bit from clock and baud rate.

On this page

    Why this matters

    A UART has no clock on the wire. The receiver finds the falling edge of the start bit and samples mid-bit, so a few per cent of baud error corrupts the last bits of a frame.

    After this lesson you can: lay out an 8N1 frame, choose CLKS_PER_BIT for a given clock and baud rate, and compute the period and baud error.

    The 8N1 frame

    8N1 means 8 data bits, no parity, 1 stop bit. With the start bit, each byte takes 10 bit-times.

    Bit time

    Line value

    Purpose

    0

    0

    Start bit: the falling edge tells the receiver a frame begins and gives it a time reference

    1 to 8

    D0 … D7

    Data, least significant bit first

    9

    1

    Stop bit: returns the line to idle so the next start bit produces a falling edge

    There is no clock on the wire. The receiver finds the start edge and samples mid-bit, so both ends need closely matched baud rates.

    One 8N1 frame carrying 0xA5: the line idles high, drops for the start bit, shows D0 to D7 least significant bit first, then returns high for the stop bit

    Read the picture from left to right, one box per bit time. There is no clock lane because the wire carries none.

    • Start bit: the falling edge at the start of the shaded orange box is the only timing reference the receiver gets.

    • Data bits: 0xA5 is 1010 0101. The line shows D0 first, so the bits appear in the order 1, 0, 1, 0, 0, 1, 0, 1, which is the byte read from the right.

    • Stop bit: the shaded blue box returns the line to idle high, so the next start bit makes a falling edge.

    Choosing clocks per bit

    CLKS_PER_BIT=round(fclk​/B),eT​=CLKS_PER_BITB/fclk​−1,Bactual​=fclk​/CLKS_PER_BIT,eB​=Bactual​/B−1

    System clock

    Baud

    f/baud

    CLKS_PER_BIT

    Period error e_T

    Actual baud / baud error e_B

    12 MHz

    115200

    104.166667

    104

    −0.1600 %

    115384.615 / +0.160256 %

    25 MHz

    115200

    217.013889

    217

    −0.0064 %

    115207.373 / +0.0064004 %

    50 MHz

    115200

    434.027778

    434

    −0.0064 %

    115207.373 / +0.0064004 %

    100 MHz

    115200

    868.055556

    868

    −0.0064 %

    115207.373 / +0.0064004 %

    50 MHz

    9600

    5208.333333

    5208

    −0.0064 %

    9600.614 / +0.0064004 %

    Negative period error means shorter bits and positive baud error. Values use the unrounded clock/baud ratio. Receiver tolerance depends on start detection, oversampling, frame length and stop sampling; half-bit drift is only an idealized upper bound.

    Illustrative allocation: reserve 2% relative baud mismatch, with 0.5% oscillator error at each endpoint and up to 0.2% divider error at each endpoint. The conservative sum is 1.4%, leaving 0.6% of this allocation. Compare the actual ratio B_TX/B_RX - 1 at opposite oscillator corners; equal signed divider errors can cancel. This allocation is not a receiver guarantee: select and check the receiver's specified mode and frame size, for example Microchip's asynchronous operational range.

    Common mistakes

    Common pitfall

    At 8 MHz and 115200 baud, divisor 69 gives period error -0.64% and baud error +0.6441%. It consumes more budget; operation still depends on both clocks and the receiver. A fractional divider reduces average quantization error but introduces bit-length variation that also needs checking.

    Tip

    Make CLKS_PER_BIT a parameter. Simulating with 4 clocks per bit instead of 434 keeps tests short while exercising the identical RTL; only the counter width changes.

    Check yourself At 100 MHz and 115200 baud, how long is one bit in nanoseconds, and how long is a whole byte frame?

    One bit = 868 clocks × 10 ns = 8.68 µs. A 10-bit frame takes 86.8 µs.

    Remember

    • 8N1 is 10 bit-times per byte: start, 8 data bits (least significant first) and stop.

    • CLKS_PER_BIT is the clock divided by the baud rate, rounded. The rounding gives a period error and a baud error.

    • The TX and RX baud rates must match closely. Compare B_TX / B_RX - 1 at opposite oscillator corners.

    Rule of thumb: make CLKS_PER_BIT a parameter, so the same RTL runs at 4 clocks per bit in simulation and 434 on the board.

    Keep going

    • Code lab: Build a UART transmitter FSM

    • Interview: run a mock interview on this topic

    Related topics

    • The FSM

    Previous

    107 / 350

    Next: The UART TX FSM

    Up next

    Up nextThe UART TX FSM

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Cycle-by-Cycle Walkthrough
    • Verification and Integration
    • Mini Project: an SPI Master