tillitis-key/hw/application_fpga/core/uart
Daniel Jobson 395d241ed3 uart: add framing error handling
- Checks the stop bit, if it is not valid the data is discarded and
  enters a error state. Only checks first stop bit.
- Adds an error state to the RX FSM. The core starts in this state to
  not assume a valid idle rx line on start up. Prevents accepting
  frames on a constant low rx line and filling the fifo.
- bugfix: always reset bitrate_ctr when leaving state ERX_BITS and
  remove unused bitrate_ctr counter in ERX_STOP
2025-10-27 08:54:31 +01:00
..
rtl uart: add framing error handling 2025-10-27 08:54:31 +01:00
tb tb: Make uart selftesting 2024-12-09 13:55:43 +01:00
toolruns Update Verilog version to 2005 for linting 2024-04-24 08:44:08 +02:00
LICENSE Make initial public release 2022-09-19 08:51:11 +02:00
README.md fpga: remove the API for configuring the UART core 2024-11-26 15:24:12 +01:00

uart

A simple universal asynchronous receiver/transmitter (UART) core implemented in Verilog. The core is completed and has been used in several FPGA designs.

Introduction

The UART core is used as main communication channel between the TKey device System on Chip (SoC) and the TKey client. The UART contains a 512 byte receive buffer, allowing the SW running on the SoC to not have to wait for bytes and poll them as soon as they are received. The number of bytes in the FIFO is also exposed to the SW through the ADDR_RX_BYTES address.

The number of data and stop bits can be configured prior to building the core.

The bit rate can also be configured prior to building the core. It should be based on the target clock frequency divided by the bit rate in order to hit the center of the bits. For example, a clock of 18 MHz and a target bit rate of 62500 bps yields: Divisor = 18E6 / 62500 = 288

API

ADDR_RX_STATUS: 0x20
ADDR_RX_DATA:   0x21
ADDR_RX_BYTES:  0x22

ADDR_TX_STATUS: 0x40
ADDR_TX_DATA:   0x41

Implementation notes.

The FIFO allocates a single block RAM (EBR).