DIY FPGA Programming
I’ve been thinking about building stuff with FPGA’s for a while, and usually get turned away because FPGA’s are considerably harder to implement than microcontrollers since they have no on-chip memory. It is necessary to re-program the gates every time they power up, which requires an external flash memory chip. There aren’t great references online for the DIY community, so I figured I’d post how to get this working. Not using dev boards opens a world of opportunities, so I’m a proponent of not using Arduino’s and their FPGA equivalent for too long (sure, they’re good to get started with, but don’t become dependent)
Not wanting to screw up an expensive complex board by being a first-timer at putting an FPGA into a circuit, I figured I’d build a little test board with the cheapest Spartan 6 you can get (about $10), which comes in a solderable TQFP144 package. Sadly, most high end FPGA’s are BGA and therefore quite hard to solder as a DIY project.
There are quite a few ways to program an FPGA. The most common would be direct programming, indirect programming, and processor programming. Direct programming is where there is a PROM chip which is programmed over JTAG, and the PROM chip programs the FPGA at boot. Indirect programming is where there is a PROM chip attached to the FPGA, and JTAG also connects to the FPGA. In this scenario, JTAG can either directly program the FPGA, or load a temporary PROM-programmer application onto the FPGA which programs the PROM and then restarts. The operational differences are subtle, but the circuit is quite different. Processor programming is where a microcontroller on the board performs the task of programming the FPGA, which would require custom code in the microcontroller as well as requiring you to have a micro at all. While substantially more advanced, this is way more powerful because the microcontroller can dynamically reprogram the FPGA on the fly for different tasks.
For this project, I’m going to use indirect programmimng, because it’s about $8 cheaper than direct programming, and processor programming is vastly overcomplicated for what I want to do.
The first task is to select a PROM chip. There are a number of series that are recognizable by the XILINX iMPACT tool. The M25P series is cheapest and very popular. You’ll need to read the datasheets to figure out how much memory your FPGA needs. I’m using the Spartan LX9 in my production board (although LX4 on this test board since it’s half the price), so I selected a 4M PROM. The M25P40 is only 67 cents on digikey in qty 1!
I’m using the Digilent JTAGHS1 programmer, since it’s the cheapest programmer that’s guaranteed compatible with Xilinx iMPACT (the programming application provided in ISE, the Xilinx IDE). At $55, it’s not the cheapest thing but you only have to buy it once and it’s way cheaper than the Xilinx brand programmers.
Read more: DIY FPGA Programming
This Post / Project can also be found using search terms:
- diy fpga board
- diy fpga
- programming an arduino FPGA
- fpga in arduino mega