= WARP v3: SPI Flash = == Programming the SPI Flash == The SPI flash is programmed via iMPACT. Programming the SPI flash requires two steps- generating the PROM file and writing the PROM file to the flash. The PROM programming file (.mcs file) can be generated via the iMPACT GUI or with the promgen command. '''To generate the PROM programming file via the iMPACT GUI:''' 1. Open iMPACT and start the '''Create PROM File''' flow 1. In the PROM File Formatter window: 1. Set '''Storage Target''' to '''SPI Flash -> Configure Single FPGA''' 1. Click the first green arrow 1. Set '''Storage Device''' to '''128M''' 1. Click '''Add Storage Device''', then click the second green arrow 1. Change the '''Output File Name''' and '''Output File Location''' to your preferred path 1. Set '''File Format''' to '''MCS''' and '''Add Non-Configuration Data Files''' to '''No''' 1. Click '''OK''' 1. Click '''OK''' in the Add Device dialog box 1. Select your desired FPGA configuration .bit file 1. Click '''No''' when prompted to add another device file, then click '''OK''' to continue 1. Right-click in the iMPACT window and choose '''Generate File''' '''To generate the PROM programming file via promgen:''' 1. Launch a Xilinx command prompt 1. Navigate to the folder with your .bit file 1. Run: {{{ promgen -spi -p mcs -c FF -s 131072 -u 0 -o }}} '''To write the .mcs file to the SPI flash:''' 1. Connect a programming cable to the FPGA JTAG connector (J14) 1. Run iMPACT (if not already open) and start the '''Boundary Scan''' flow 1. Right-click and choose '''Initialize Chain''' 1. Click '''OK''' in the Device Programming Properties window 1. Right-click on the FPGA icon and select '''Add BPI/SPI Flash''' 1. Select your .mcs file 1. The Select Attached SPI/BPI window will show. Choose '''SPI PROM''' model '''M25P128''', data width 1. 1. Right-click on the Flash icon (''not'' the FPGA icon) and choose '''Program''' 1. Confirm '''Design-Specific Erase Before Programming''' is checked 1. Optionally un-check '''Verify'''; verification increases the programming time, and we've never seen a verification error 1. Click '''OK''' iMPACT will now begin writing your .mcs file to the SPI flash. This process is slow, typically requiring 3+ minutes. Watch the iMPACT GUI and console for status and error messages. When the programming process completes the FPGA will initiate a configuration cycle from the flash. You will see the green '''STAT''' LED glow at half intensity as the FPGA reads the configuration file. The LED will illuminate fully when configuration completes. === Configuration Clock Frequency === The FPGA uses Master SPI mode when loading a bitstream from the SPI flash. In this mode the FPGA generates the configuration clock signal and drives it to the CCLK pin. The CCLK pin is routed to the SPI serial clock input. A faster CCLK will result in a faster configuration process. The CCLK frequency is specified in the .bit file and is preserved when generating the .mcs file (as described above). You can change the CCLK frequency via the {{{-g ConfigRate}}} bitgen option. We have successfully tested CCLK frequencies up to 33MHz. Higher frequencies will sometimes work. However the FPGA-generated CCLK frequency is specified as ±55%, so higher nominal frequencies may violate the SPI flash max frequency of 54MHz. To set the CCLK frequency to 33MHz: * ISE: open the Generate Programming File properties and change Configuration Options -> ConfigRate to 33. * XPS: edit Project -> bitgen.ut, add a line: {{{ -g ConfigRate:33 }}} You will need to re-generate the .mcs file and re-program the SPI flash if you change the CCLK frequency.