fpga implementation of universal asynchronous receiver and

13
1-1 ECE 428 Programmable ASIC Design Haibo Wang ECE Department Southern Illinois University Carbondale, IL 62901 FPGA Implementation of Universal Asynchronous Receiver and Transmitter (UART)

Upload: others

Post on 30-Jan-2022

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: FPGA Implementation of Universal Asynchronous Receiver and

1-1

ECE 428 Programmable ASIC Design

Haibo WangECE Department

Southern Illinois UniversityCarbondale, IL 62901

FPGA Implementation of Universal Asynchronous Receiver and Transmitter (UART)

Page 2: FPGA Implementation of Universal Asynchronous Receiver and

1-2

Serial Data Transfer

11-2

Asynchronous v.s. Synchronous— Asynchronous transfer does not require clock signal. However, it transfers extra bits

(start bits and stop bits) during data communication — Synchronous transfer does not transfer extra bits. However, it requires clock signal

Frame

Startbit B0 B1 B2 B3 B4 B5 B6

ParityStop bits

AsynchronousData transfer

SynchronousData transfer

clk

dataB0 B1 B2 B3 B4 B5

data

Page 3: FPGA Implementation of Universal Asynchronous Receiver and

1-3

Overview of UART and RS-232

Most materials presented here are from “FPGA Prototyping by Verilog Examples” by Pong Chu.You can download the UART chapter of the book at: http://academic.csuohio.edu/chu_p/rtl/fpga_vlog.html

D[7:0]

TxD

RxD

UARTRS232

shiftTrans. Shift Reg.

Rec. Shift Reg.

Interface Baud rate ckt.

Standard logic level

Signal swing +10V, -10V

DB9 connector (front view)

Ground

Page 4: FPGA Implementation of Universal Asynchronous Receiver and

1-4

UART Parameters

Signal is 1 (high voltage) when the system is idleStart bit is placed before the data and, optionally, stop bits are placed at the end of dataStart bit is 0 and stop bits are 1LSB is first transmitted or receivedBaud rate: number of bits per second; frequently used baud rate: 9600, 19,200Number of Data bits Stop bitsWhether parity check is enabled?Multiplication factor for clock, e.g. x8 clk (means baud rate x 8 = system clock freq.)

Page 5: FPGA Implementation of Universal Asynchronous Receiver and

1-5

How to Assign UART Parameters

Fix the parameters at the design stage (this example)

Make it programmable with using configuration (mode) registerExample: 8251 chip

7 6 5 4 3 2 1 0 Mode register

Number of Stop bits

00: invalid01: 1 bit10: 1.5 bits11: 2 bits

Parity0: odd1: even

Parity enable0: disable1: enable

Character length

00: 5 bits01: 6 bits10: 7 bits11: 8 bits

Baud Rate

00: Syn. Mode01: x1 clock10: x16 clock11: x64 clock

Page 6: FPGA Implementation of Universal Asynchronous Receiver and

1-6

Block Diagram of UART Receiving Subsystem

Assume N data bits, M stop bits and fCLK=16*baud rate

Page 7: FPGA Implementation of Universal Asynchronous Receiver and

1-7

ASMD of UART Receiving Subsystem

FSM (Finite State Machine)

ASM Chart (Algorithmic State Machine)

FSMD (Finite State Machine with Data Path)

ASMD (ASM with data path)

Page 8: FPGA Implementation of Universal Asynchronous Receiver and

1-8

HDL Coding for UART Receiving Subsystem

The ASMD chart contains four states: idle, start, data, stop

Page 9: FPGA Implementation of Universal Asynchronous Receiver and

1-9

HDL Coding for UART Receiving Subsystem

Coding for operations within one state

Page 10: FPGA Implementation of Universal Asynchronous Receiver and

1-10

Clocking Issue of Receiver Design

Should we use s_tick as clock signal or clock enable signal?

Better Functionally OK

Page 11: FPGA Implementation of Universal Asynchronous Receiver and

1-11

Interface Circuit of UART Receiving Subsystem

Page 12: FPGA Implementation of Universal Asynchronous Receiver and

1-12

Complete UART Circuit

Page 13: FPGA Implementation of Universal Asynchronous Receiver and

1-13

Configure HyperTerminal to test UART Circuit