Stratix® 10 Configuration User Guide

ID 683762
Date 4/05/2024
Public
Document Table of Contents

5.3.1. Operation Commands

Resetting Quad SPI Flash

Important: For Stratix® 10 devices, do not reset the quad SPI flash when used as the configuration device and data storage device with FPGA. Resetting the quad SPI flash during the FPGA configuration and reconfiguration, or in the QSPI's READ/WRITE/ERASE operations, causes undefined behavior for quad SPI flash and the FPGA. To recover from the unresponsive behavior, you must power cycle your device. To reset the quad SPI flash via the external host, you must first complete the FPGA configuration and reconfiguration, or a quad SPI operation, and only then toggle the reset. The quad SPI operation is complete when the exclusive access to the quad SPI flash is closed by issuing the QSPI_CLOSE command via the Mailbox Client Intel® FPGA IP or CLOSE command via the Serial Flash Mailbox Client Intel® FPGA IP.

RSU SDM Command Use Case

Important: All RSU-related SDM commands (RSU_IMAGE_UPDATE, RSU_GET_SPT, RSU_STATUS, and RSU_NOTIFY) are only valid when the SDM loads the RSU image from QSPI flash using AS x4 configuration mode.
Table 41.  Command List and Description
Command Code (Hex) Command Length 18 Response Length 18 Description
RSU_IMAGE_UPDATE 5C 2 0

Triggers reconfiguration from the data source that can be either the factory or an application image.

This command takes an optional 64-bit argument that specifies the reconfiguration data address in the flash. When sending the argument to the IP, you first send bits [31:0] followed by bits [63:32]. If you do not provide this argument its value is assumed to be 0.

  • Bit [31:0]: The start address of an application image.
  • Bit [63:32]: Reserved (write as 0).

Once the device processes this command, it returns the response header to response FIFO before it proceeds to reconfigure the device. Ensure the host PC or host controller stops servicing other interrupts and focuses on reading the response header data to indicate the command completed successfully. Otherwise, the host PC or host controller may not be able to receive the response once the reconfiguration process started.

Once the device proceeds with reconfiguration, the link between the external host and FPGA is lost. If you use PCIe in your design, you need to re-enumerate the PCIe link.

Important: When resetting quad SPI, you must follow instructions specified in Resetting Quad SPI Flash.
RSU_GET_SPT 5A 0 4

RSU_GET_SPT retrieves the quad SPI flash location for the two sub-partition tables that the RSU uses: SPT0 and SPT1.

The 4-word response contains the following information:

Word Name Description
0 SPT0[63:32] SPT0 address in quad SPI flash.
1 SPT0[31:0]
2 SPT1[63:32] SPT1 address in quad SPI flash.
3 SPT1[31:0]
CONFIG_STATUS 4 0 6

Reports the status of the last reconfiguration. You can use this command to check the configuration status during and after configuration. The response contains the following information:

Word Summary Description
0 State Describes the most recent configuration related error. Returns 0 when there are no configuration errors.
The error field has 2 fields:
  • Upper 16 bits: Major error code.
  • Lower 16 bits: Minor error code.

Refer to Appendix: CONFIG_STATUS and RSU_STATUS Error Code Descriptions in the Mailbox Client Intel® FPGA IP User Guide for more information.

1 Quartus Version
Available in Quartus® Prime software version 19.4 or later, the field displays:
  • Bit [31:28]: Index of the firmware or decision firmware copy that was used the most recently. Possible values are 0, 1, 2, and 3.
  • Bit [27:24]: Reserved
  • Bit [23:0]: 24'd0
2 Pin status
  • Bit [31]: Current nSTATUS output value (active low)
  • Bit [30]: Detected nCONFIG input value (active low)
  • Bit [29:3]: Reserved
  • Bit [2:0]: The MSEL value at power up
3 Soft function status Contains the value of each of the soft functions, even if you have not assigned the function to an SDM pin.
  • Bit [31:6]: Reserved
  • Bit [5]: HPS_WARMRESET
  • Bit [4]: HPS_COLDRESET
  • Bit [3]: SEU_ERROR
  • Bit [2]: CVP_DONE
  • Bit [1]: INIT_DONE
  • Bit [0]: CONF_DONE
4 Error location Contains the error location. Returns 0 if there are no errors.
5 Error details Contains the error details. Returns 0 if there are no errors.
RSU_STATUS 5B 0 9 Reports the current remote system upgrade status. You can use this command to check the configuration status during configuration and after it has completed. This command returns the following responses:
Word Summary Description
0-1 Current image Flash offset of the currently running application image.
2-3 Failing image

Flash offset of the highest priority failing application image. If multiple images are available in flash memory, stores the value of the first image that failed. A value of all 0s indicates no failing images. If there are no failing images, the remainder of the remaining words of the status information do not store valid information.

Note: A rising edge on nCONFIG to reconfigure from AS x4, does not clear this field. Information about failing image only updates when the Mailbox Client Intel® FPGA IP receives a new RSU_IMAGE_UPDATE command and successfully configures from the update image.
4 State Failure code of the failing image.
The error field has two parts:
  • Bit [31:16]: Major error code
  • Bit [15:0]: Minor error code

Returns 0 for no failures. Refer to Appendix: CONFIG_STATUS and RSU_STATUS Error Code Descriptions in the Mailbox Client Intel® FPGA IP User Guide for more information.

5 Version

RSU interface version and error source.

For more information, refer to RSU Status and Error Codes section in the Hard Processor System Remote System Update User Guide.

6 Error location Stores the error location of the failing image. Returns 0 for no errors.
7 Error details Stores the error details for the failing image. Returns 0 if there are no errors.
8 Current image retry counter

Count of the number of retries that have been attempted for the current image. The counter is 0 initially. The counter is set to 1 after the first retry, then 2 after a second retry.

Specify the maximum number of retries in your Quartus® Prime Settings File (.qsf). The command is: set_global_assignment -name RSU_MAX_RETRY_COUNT 3. Valid values for the MAX_RETRY counter are 1-3. The actual number of available retries is MAX_RETRY -1

This field was added in version 19.3 of the Quartus® Prime Pro Edition software.

RSU_NOTIFY 5D 1 0
Clears all error information in the RSU_STATUS response and resets the retry counter. The one-word argument has the following fields:
  • 0x00050000: Clear current reset retry counter. Resetting the current retry counter sets the counter back to zero, as if the current image was successfully loaded for the first time.
  • 0x00060000: Clear error status information.
  • All other values are reserved.

This command is not available before version 19.3 of the Quartus® Prime Pro Edition software.

QSPI_OPEN 32 0 0

Requests exclusive access to the quad SPI. You issue this request before any other QSPI requests. The SDM accepts the request if the quad SPI is not in use and the SDM is not configuring the device. Returns OK if the SDM grants access.

The SDM grants exclusive access to the client using this mailbox. Other clients cannot access the quad SPI until the active client relinquishes access using the QSPI_CLOSE command.

Access to the quad SPI flash memory devices via any mailbox client IP is not available by default in designs that include the HPS, unless you disable the QSPI in HPS software configuration.

Important: When resetting quad SPI, you must follow instructions specified in Resetting Quad SPI Flash.
QSPI_CLOSE 33 0 0 Closes the exclusive access to the quad SPI interface.
Important: When resetting quad SPI, you must follow instructions specified in Resetting Quad SPI Flash.
QSPI_SET_CS 34 1 0 Specifies one of the attached quad SPI devices via the chip select lines. Takes a one-word argument as described below:
  • Bits[31:28]: Flash device to select. Below values correspond to the respective nCSO[3:0] pins.
    • Value 4'h0000 selects the flash that corresponds to nCSO[0].
    • Value 4'h0001 selects the flash that corresponds to nCSO[1].
    • Value 4'h0002 selects the flash that corresponds to nCSO[2].
    • Value 4'h0003 selects the flash that corresponds to nCSO[3].
  • Bits[27:0]: Reserved (write as 0).
Note: Stratix® 10 devices support one AS x4 flash memory device for AS configuration from quad SPI device connected to nCSO[0]. Once the device enters user mode, you can then use up to four AS x4 flash memories with Mailbox Client Intel® FPGA IP or HPS as data storage. The Mailbox Client Intel® FPGA IP or HPS can use nCSO[3:0] to access quad SPI devices.

This command is optional for the AS x4 configuration scheme, the chip select line follows the last executed QSPI_SET_CS command or defaults to nCSO[0] after the AS x4 configuration. The JTAG configuration scheme requires executing this command to access the QSPI flash that connects the SDM_IO pins.

Access to the QSPI flash memory devices using SDM_IO pins is only available for the AS x4 configuration scheme, JTAG configuration, and a design compiled for AS x4 configuration. For the Avalon® streaming interface ( Avalon® ST) configuration scheme, you must connect QSPI flash memories to GPIO pins.

During AS x4 configuration scheme in Stratix® 10 devices, this command is optional. The chip select line follows the last executed QSPI_SET_CS command or defaults to nCSO[0] after the AS x4 configuration.

Important: When resetting quad SPI, you must follow instructions specified in Resetting Quad SPI Flash.
QSPI_READ 3A 2 N

Reads the attached quad SPI device. The maximum transfer size is 4 kilobytes (KB) or 1024 words.

Takes two arguments:
  • The quad SPI flash address (one word). The address must be word aligned. The device returns the 0x1 error code for non-aligned addresses.
  • Number of words to read (one word).
When successful, returns OK followed by the read data from the quad SPI device. A failure response returns an error code.

For a partially successful read, QSPI_READ may erroneously return the OK status.

Note: You cannot run the QSPI_READ command while device configuration is in progress.
Important: When resetting quad SPI, you must follow instructions specified in Resetting Quad SPI Flash.
QSPI_WRITE 39 2+N 0

Writes data to the quad SPI device. The maximum transfer size is 4 kilobytes (KB) or 1024 words.

Takes three arguments:
  • The flash address offset (one word). The write address must be word aligned.
  • The number of words to write (one word).
  • The data to be written (one or more words).
A successful write returns the OK response code.

To prepare memory for writes, use the QSPI_ERASE command before issuing this command.

Note: You cannot run the QSPI_WRITE command while device configuration is in progress.
Important: When resetting quad SPI, you must follow instructions specified in Resetting Quad SPI Flash.
QSPI_ERASE 38 2 0 Erases a 4/32/64 KB sector of the quad SPI device. Takes two arguments:
  • The flash address offset to start the erase (one word). Depending on the number of words to erase, the start address must be:
    • 4 KB aligned if number words to erase is 0x400
    • 32 KB aligned if number words to erase is 0x2000
    • 64 KB aligned if number words to erase is 0x4000
    Returns an error for non-4/32/64 KB aligned addresses.
  • The number of words to erase is specified in multiples of:
    • 0x400 to erase 4 KB (100 words) of data. This option is the minimum erase size.
    • 0x2000 to erase 32 KB (500 words) of data
    • 0x4000 to erase 64 KB (1000 words) of data
A successful erase returns the OK response code.
Important: When resetting quad SPI, you must follow instructions specified in Resetting Quad SPI Flash.
QSPI_READ_DEVICE_REG 35 2 N Reads registers from the quad SPI device. The maximum read is 8 bytes. Takes two arguments:
  • The opcode for the read command.
  • The number of bytes to read.

A successful read returns the OK response code followed by the data read from the device. The read data return is in multiple of 4 bytes. If the bytes to read is not an exact multiple of 4 bytes, it is padded with multiple of 4 bytes until the next word boundary and the padded bit value is zero.

Important: When resetting quad SPI, you must follow instructions specified in Resetting Quad SPI Flash.
QSPI_WRITE_DEVICE_REG 36 2+N 0 Writes to registers of the quad SPI. The maximum write is 8 bytes. Takes three arguments:
  • The opcode for the write command.
  • The number of bytes to write.
  • The data to write.

To perform a sector erase or sub-sector erase, you must specify the serial flash address in most significant byte (MSB) to least significant byte (LSB) order as the following example illustrates.

To erase a sector of a Micron 2 gigabit (Gb) flash at address 0x04FF0000 using the QSPI_WRITE_DEVICE_REG command, write the flash address in MSB to LSB order as shown here:

Header: 0x00003036

Opcode: 0x000000DC

Number of bytes to write: 0x00000004

Flash address: 0x0000FF04

A successful write returns the OK response code. This command pads data that is not a multiple of 4 bytes to the next word boundary. The command pads the data with zero.

Important: When resetting quad SPI, you must follow instructions specified in Resetting Quad SPI Flash.
QSPI_SEND_DEVICE_OP 37 1 0 Sends a command opcode to the quad SPI. Takes one argument:
  • The opcode to send the quad SPI device.

A successful command returns the OK response code.

Important: When resetting quad SPI, you must follow instructions specified in Resetting Quad SPI Flash.

For CONFIG_STATUS and RSU_STATUS major and minor error code descriptions, refer to Appendix: CONFIG_STATUS and RSU_STATUS Error Code Descriptions in the Mailbox Client Intel® FPGA IP User Guide .

18 This number does not include the command or response header.