Indirect Programming of SPI Flash via FPGA

ZTEX Series 2 FPGA Board have SPI Flash memory that can be used to store the Bitstream. Most comfortable way to write data to Flash is to use the SDK (DeviceServer, FWLoader or the API). Nevertheless, on EZ-USB FX2 based FPGA Boards the SPI Flash can also be programmed indirectly through JTAG and FPGA using the Xilinx tools.

The method described here does not work with EZ-USB FX3 based boards because they completely handle the FPGA configuration process per Firmware.

The brand of SPI Flash which is used on ZTEX FPGA Boards may vary (mostly Spansion S25FL127S or S25FL216K) but all types support a set of basic commands which make them compatible (and usable with the same EZ-USB Firmware).

For some reason current Xilinx Impact versions ignore this fact and perform an ID check against a device that has to be selected in the software. If Impact does not list the Flash chip which is used on the FPGA Board this senseless behavior can be overwritten by setting the environment variable XIL_IMPACT_SKIPIDCODECHECK to 1:

export XIL_IMPACT_SKIPIDCODECHECK=1

Then, a standard device can be selected in Impact, e.g. M25P128 for 128MBit chips or M25P16 for 16MBit chips.

By default firmware only attempts to configure the FPGA from Flash if the bitstream size value in the settings memory (MAC-EEPROM) is larger than 0. This mechanism saves a lot of time if not bitstream is present, but only works if bitstream is written through the firmware. This behavior can be overwritten by specifying the firmware macro ENABLE_FLASH_BITSTREAM_FORCE;.

Indirect programming of SPI Flash requires Flash access form FPGA, see Flash access from FPGA.