Walkthrough

By default, the programmer on the board programs the external flash chip. However, it is more convenient and faster to use the SRAM inside the FPGA. Moreover, the programming configuration below assumes that you’re programming the SRAM.

To enable SRAM programming, you need to change a few links on the board:

Testing

If you have a frequency counter to hand, measure the frequency on test point A: it should be exactly 6MHz. If you prefer something slower, you should find a frequency of exactly 1Hz, with a duty cycle of 1/16 on test point B.

Hardware Notes

Full schematics of the board are available in the user manual8. Here are some highlights, relevant to our simple project.

FPGA

The FPGA is a iCE40HX-8K in a 256-pin LFBGA.

Clock and PLL

A 12MHz clock from a ceramic resonator is provided on pin J3.

This FPGA has a PLL which lets us scale the incoming clock. Arbitrarily, we will try to get a 96MHz system clock, and to do this we need some magic numbers with which we can configure the PLL. Enter icepll:

LEDs

Test points

As befits the name breakout board, many spare IO pins exist, and we use two as test points: B1 and B2.

Programming

The board has a FTDI 2232H USB interface which can be used to program both external flash and internal SRAM with iceprog from the IceStorm Tools. You must supply the -S flag to iceprog when programming the SRAM.

Note: jumpers J6 and J7 on the board govern whether the flash or SRAM is programmed. As shipped they are set for flash, but the walkthrough above moves them to SRAM mode.

Software Notes

There are only four small files: a couple of bits of verilog, the pin definitions, and a Makefile.

The main source code

The code is much as you’d expect, though it takes slightly more care than its counterpart for the iCEstick10.

In particular, we use the PLL’s locked signal to reset things on power-up. Rather than a free-running binary counter, we also generate a precise 16Hz clock so that the 16-cycle animation should take exactly one second (modulo the accuracy of the master oscillator).