Programming the SPI Flash In-System

Using SPI Flash with 7 Series FPGAs (XAPP586)

Document ID
XAPP586
Release Date
2022-12-09
Revision
1.5 English

The iMPACT programming tool offers the ability to program the SPI flash in-system utilizing the existing connections between the SPI flash and the FPGA. This is referred to as indirect programming because the SPI flash is programmed through the FPGA, not directly from iMPACT. Also needed to perform indirect programming is access to the JTAG pins of the FPGA, a JTAG programming cable such as the Xilinx Platform Cable USB II, and a computer that has the iMPACT programming tool installed. Using this setup, the SPI flash can be reprogrammed without removing it from the board, which is extremely useful for debugging in a lab environment.

Note:   The indirect programming solution is not intended for high-volume production. For production programming, consider solutions from BP Microsystems or Data I/O.

The first step to programming the SPI flash in-system requires that the 7 series FPGAs be first loaded with an interface design that bridges the programming cable to the SPI flash. This step clears the contents of the FPGA. This SPI interface design leaves the unused FPGA pins floating. The user should be aware of this and ensure that this does not have any undesired effects on other devices attached to the FPGA. For example, certain I/O pins might need to remain Low or High during SPI flash programming, and these pins would normally be pulled Low or High by the final FPGA design. In such cases, the designer might need to add external pull-down or pull-up resistors on these pins to ensure correct behavior during SPI programming.

The following demonstration targets the Kintex-7 XC7K325T FPGA and the Micron N25Q128A13 SPI flash present on the KC705 Kintex-7 FPGA evaluation board.

Ensure the board is powered and the USB cable is attached. In the case of the KC705 board, a standard USB-to-micro-USB cable is used instead of a Platform Cable USB II. In most cases, there is no specialized hardware on the board to handle the PC-to-JTAG interface, therefore a Platform Cable USB II is required.

This Figure shows the GUI interface for the boundary-scan mode.

1.Start iMPACT by double clicking the Configure Target Device process and then select Boundary Scan in the upper left box (This Figure).

2.Select the Initialize Chain icon to identify JTAG devices on the board.

3.The JTAG chain populates on the screen. The designer can choose to assign a bitstream to the FPGA because it does not matter for purposes of programming the SPI flash. In the example below the file toplevel.bit is assigned to the Kintex-7 FPGA.

Note:   A box with SPI/BPI? appears above the FPGA. This indicates that no PROM file is currently assigned to any attached flash device to this FPGA.

Figure 17:      iMPACT JTAG Chain

X-Ref Target - Figure 17

x586_09.jpg

4.Right-click SPI/BPI and select Add SPI/BPI flash (This Figure). This step brings up an Explorer window. Navigate to the MCS file and select it.

5.iMPACT then asks which type of flash device is the target. Select the appropriate device in the pull-down menus.

Figure 18:      iMPACT SPI Flash Selection

X-Ref Target - Figure 18

x586_10.jpg

The image on the right side of the window now changes from a dotted box labeled SPI/BPI? to a flash device image, indicating that a SPI flash device has been attached (This Figure).

Figure 19:      iMPACT JTAG Chain with the SPI Flash Assigned

X-Ref Target - Figure 19

x586_11.jpg

6.Right-click Flash and select Set Programming Properties (Figure 20).

From here, operations such as Erase and Verify are enabled by default. This step executes all operations Erase > Program > Verify when the designer programs the SPI flash. These instructions can be done individually, if desired.

x586_12.jpg

 

Figure 19:      iMPACT SPI Flash Programming Properties