Program Fipsy FPGA Breakout Board from ESP32

MocoMakers is creating Fipsy FPGA Breakout Board, a tiny circuit board offering a piece of Field-programmable gate array (FPGA). I worked with FPGA years ago in class projects, but didn't have access to a device after that. I backed the project, and received two Fipsy boards on Jul 20.

Fipsy is a very simple board: there is no power regulator or USB port. The official method to program the Fipsy is through the SPI port on a Raspberry Pi. It is easy to setup, and is a good use case for my Raspberry Pi Zero W, but there is one problem: It is good practice to power off the circuit when modifying hardware wiring. However, powering off a Raspberry Pi cleanly requires sending a shutdown command and waiting for a few seconds. If I just pull the power cord, I would risk corrupting the filesystem.

ESP32 microcontroller has SPI ports, and can be powered off and restarted very quickly. Can I program Fipsy from an ESP32?

Fipsy connected to Heltec WiFi\_Kit\_32

Hardware side is easy. ESP32 has two available SPI ports, HSPI and VSPI, and I connected Fipsy to the Heltec WiFi_Kit_32's HSPI port. All that remains is deciphering the spaghetti code of the official programmer. After a day of hard work, I got it working:

Code link: esp-fipsy library.

There are a few differences from the official programmers:

  • My code is clean. I'm obsessed with this.
  • I only write the fuse table to the MachXO2-256. By not writing Feature Row and FEABITS, there's less chance of mistakenly disabling slave SPI port and bricking the device.
  • JEDEC parsing and FPGA programming are separate.
  • Fuse checksum is verified.

References:

Tags: ESP32 FPGA Fipsy