Home / Learn Verilog / Project 5: UART Echo and Hello Printer
Project 5: UART Echo and Hello Printer
Send text to a PC terminal and echo what you type.
Theory in plain words
Definition
The FPGA receives characters from a terminal program, sends them back (echo) and prints "Hello" on a button press.
Why you need this
Projects turn knowledge into skill: you design, simulate, debug and finally see real hardware react.
How it works
Simulate in the browser, then build for your board following the steps.
Where you'll see this
- Portfolio
- Interviews
- Learning by doing
What you will build
The FPGA receives characters from a terminal program, sends them back (echo) and prints "Hello" on a button press.
| Level | Time | Works in simulation only? |
|---|---|---|
| Intermediate | 4 hours | No: simulate first, then run on the board |
What you need (equipment and tools)
Read this table once and you will know exactly what to buy or prepare. You can do the simulation part with only a computer and the free tools.
| Item | What it is (in simple words) | Why you need it | Approx. cost |
|---|---|---|---|
| Computer (Windows, Linux or macOS) | Your normal laptop or desktop. You write Verilog here and run the free tools. | Simulator, synthesis and programmer all run on it. | you have it |
| Free software: Icarus Verilog + GTKWave (simulation), Yosys + nextpnr or the vendor IDE (build), openFPGALoader (program) | The programs that compile and simulate your design. | Everything in this course can be simulated with only these free tools. | free |
| FPGA development board (e.g. Tang Nano 9K, Basys 3, iCEBreaker, Arty A7) | A small circuit board with an FPGA chip, an oscillator (clock), LEDs, buttons and a USB port. The FPGA is the "blank hardware" that your Verilog turns into a real circuit. | This is where your design actually runs. Without it you can only simulate. | about $15 (Tang Nano 9K) to $150 (Arty A7) |
| USB cable (data type, not charge-only) | Cable between the board and the computer. Some cheap cables carry only power and no data. | Programs the FPGA and powers it. If the board is not found, try another cable first. | $2 |
| USB-to-serial adapter (CP2102, CH340 or FT232, 3.3 V level) | A small dongle that turns USB into TX/RX pins that a UART design can talk to. | Lets the PC send/receive bytes with your design in a terminal program. | $3 |
| Breadboard + jumper wires | A plastic board with holes connected in rows; wires plug in without soldering. | Connect the FPGA pins to buttons, LEDs and modules quickly and safely. | $5 |
| Logic analyzer (8-channel USB, e.g. Saleae-clone) - optional but very useful | A tool that records digital signals over time and shows them as waveforms on the PC, like the simulator but for the real board. | Lets you check what the pins really do (UART bits, SPI clock, VGA sync). | $10 for a clone, use with PulseView (free) |
| Terminal program (PuTTY, minicom, screen, or the Arduino serial monitor) | A program on the PC that shows received characters and sends typed ones. | The "other end" of your UART. | free |
Connections
| Signal | Direction | Goes to | Note |
|---|---|---|---|
| rx | input | TX pin of the USB-serial adapter | cross-over: adapter TX to FPGA RX |
| tx | output | RX pin of the adapter | adapter RX from FPGA TX |
| GND | - | adapter GND | must be shared |
Step 1: simulate the design
The receiver gets H and i and the transmitter starts sending them back.
Step by step
- Set your terminal to the same baud rate as the design (115200 8N1).
- DIV = clock frequency / baud rate: 27 MHz / 115200 = 234.
- Check tx with a logic analyzer: idle high, start bit low.
- Echo: connect the receiver output to the transmitter input through a one-byte register.
- Add a button that sends "Hello\r\n" using a small ROM and counter.
Step 2: top-level for the board
module top(input clk, rx, output tx);
// instantiate uart_rx and uart_tx with DIV = 234 and connect them as an echo
endmoduleIf it does not work
| Symptom | Likely cause | Fix |
|---|---|---|
| Board not detected by the PC | Charge-only USB cable or missing driver | Try another data cable; install the vendor/FTDI driver; check dmesg or Device Manager |
| Nothing happens after programming | Wrong clock pin or wrong pin constraints | Compare every pin with the board schematic; first test with a blinking LED |
| Garbage characters | Baud rate mismatch | Compute DIV again and set the terminal to 115200 |
| Nothing received | TX and RX swapped or no common ground | Cross TX/RX and connect GND |
| Works at first then errors | Clock tolerance | Sample in the middle of each bit |
Test what you just read
1. Baud divider for 27 MHz and 115200 baud?
27e6 / 115200 = 234.