I recently came across the “Sipeed Tang Primer 20k”, an entry-level FPGA. The internet claims that it can be programmed and used with an all-open-source tool chain.

During my studies, I dabbled a bit with FPGAs, nothing serious, but enough to make me curious. I recall the problems with the decidedly not open-source software required to program the boards, and the significant price of the boards. And here I was looking at an offer of less than 50 Euro for the board, with shipping and a few peripherals to toy around with still below a hundred.

Long story short, I am now the proud owner of such a device. But I have to say that “open source toolchain is supported” is technically true, but leaves out quite a bit about user friendliness, or the lack thereof. The tools are in the Debian repositories (or at least mostly are) but fail silently. Only the newest versions work correctly and you have to compile the toolchain from source to get everything working. For easy installation, I have assembled a Docker container that includes the necessary software and wrapper scripts for ease-of-use.

The official examples and demo projects for the Tang Primer 20k live here, but for a beginner like me, these are not well suited. If you are looking for examples that get you started and are maybe a bit more basic, look here: https://github.com/twied/TangPrimer-20K-example

Examples in this repository:

  • LEDs: The ext board comes with six orange LEDS located at the right side of the board. They are labeled “5” to “0” from top to bottom. The example displays a simple static pattern.

  • Clock: A simple example that flashes the LEDs once per second, in an alternating pattern.

  • Switches: This example demonstrates how to read the status of the 5 switches located at the right side of the board. The LEDs display the result of some boolean functions.

  • Buttons: This example shows how to read the status of the 5 buttons located at the left side of the board. Pushing S0 will turn LED 0 on, pushing S1 will turn the LED off.

  • RGB LED: This example shows how to drive the RGB LED on the top left of the board by turning it yellow at medium intensity.

  • Sound: This example shows how to use the audio jack on the top right of the board by playing a short sound file in a loop.