Recently, I learned about the IceStorm project, which is an effort to reverse engineer the Lattice iCE40-series of FPGAs. I had run across FPGAs in my time before, but never really got to understand them. This is for a few reasons:
- The tools tended to be proprietary, with highly (unnecessarily?) restrictive licensing
- FPGA boards were hellishly expensive
I wasn’t interested in doing the proprietary toolchain dance, did enough of that with some TI stuff years ago. There, it was the MSP430, and one of their DSPs. The former I could use gcc, but still needed a proprietary build of gdbproxy to program and debug the device, and that needed Windows. The latter could only be programmed using TI’s Code Composer studio.
FPGAs were ten times worse. Not only was the toolchain huge, occupying gigabytes, but the license was locked to the hardware. The one project with anything FPGA-related, it was an Altera FPGA, and getting Quartus II to work was nothing short of a nightmare. I gave up, and vowed never to touch FPGAs.
Fast forward 6 years, and things have changed. We now have a Verilog synthesiser. We now have a place-and-route tool. We have tools for generating a bitstream for the iCE40 FPGAs. We can now buy FPGA boards for well under the $100. Heck, you can buy them for $5.
Lattice can do one of three things at this point:
- They can actively try to stomp it out (discontinuing the iCE40 family, filing law suits, …etc)
- They can pretend it doesn’t exist
- They can partner with us and help build a hobby market for their FPGAs
Time will tell as to what they choose. I’m hoping it’s the latter, but ignoring us is workable too.
So recently I bought an iCE40-HX8K breakout board. This $80 board is pretty minimal, you get 8 LEDs, a FTDI serial-USB controller (which serves as programmer), a small serial flash EEPROM (for configuration), a linear regulator, a 12MHz oscillator and 4 40-pin headers for GPIOs.
The FPGA on this board is the iCE40HX8K-CT256. At the time of writing, that’s the top of that particular series with 7680 look-up tables, two PLLs, and some integrated SPI/I²C smarts.
There’s not a lot in the way of tutorials for this particular board, most focus on the iCEStick, which uses the lesser iCE40HX1K-TQ144, has only a small handful of GPIOs exposed and has no configuration EEPROM (it’s one-time programmable).
Pretty much everything works on this board, even PLLs and block RAM. There’s an example using the PLL on the iCEstick in this VGA demo project.
Some things I’ve learned:
- If you open jumper J7, and rotate the jumpers on J6 to run horizontally (strapping pins 1-2 and 3-4), specifying -S to iceprog will program the CRAM without touching the SPI flash chip.
- The PLL ceases to lock in when REFCLK/(1+DIV_R) drops to 10MHz or below.
FILTER_RANGE is a mystery though. Haven’t figured out what the values correspond to.
It’s likely this particular board is destined to become a DRAM/Interrupt/DMA controller for my upcoming 386, but we’ll see. In the meantime, I’m playing with a new toy. 🙂