Practice

UART, SPI and I2C interface problems

Every chip talks to something. These problems build the pieces of the common serial interfaces: the UART frame with its start bit, parity and oversampling, the SPI clock polarity and phase, and the I2C start, stop, acknowledge and arbitration.

118 problems8 free to solve15 easy, 61 medium, 42 hard

Around them sit the small circuits every interface needs: edge detectors, pulse stretchers, debouncers, period and duty cycle measurement, and the valid ready handshake.

What these problems cover

  • UART framing, parity, baud rate and oversampling receivers
  • SPI masters with configurable polarity and phase
  • I2C start and stop detection, read and write bits, clock stretching and arbitration
  • Valid ready handshakes and pipeline stages
  • Edge detectors, debouncers and pulse stretchers

Free to start

Solve these with a free account. Every other statement on this page is free to read.

Problems by track

Interfaces and Protocols19

7 more in the Interfaces and Protocols track

Interface and Communication Circuits79

67 more in the Interface and Communication Circuits track

Shift Registers12

Finite State Machines1

Clocking and Synchronization2

FSM Coding2

SystemVerilog RTL1

More problems2

How your answer is checked

Circuit problems run on the circuit simulator against the problem's test vectors, clocked cycle by cycle when they are sequential. Verilog problems are compiled with Icarus Verilog and run against a testbench, with the waveform and the Yosys schematic beside the result. Analysis questions are checked against their answer key.

Questions

Do I write a whole UART at once?
No. The problems split each interface into parts you can test alone, such as start bit detection or the parity generator, and later ones put them together into a full transmit and receive.
Are these useful for FPGA projects?
Yes. A UART or SPI block written and tested here is the same RTL you would put on a board.