Mailbox Client with Avalon® Streaming Interface Intel® FPGA IP User Guide

ID 683510
Date 7/08/2024
Public

1.3.1. Operation Commands

Resetting Quad SPI Flash

Important: For Agilex™ 7 devices, you must connect the serial flash or quad SPI flash reset pin to the AS_nRST pin. The SDM must fully control the QSPI reset. Do not connect the quad SPI reset pin to any external host.
Table 8.  Command List and Description
Command Code (Hex) Command Length 1 Response Length 1 Description
NOOP 0 0 0 Sends an OK status response.
GET_IDCODE 10 0 1 The response contains one argument which is the JTAG IDCODE for the device
GET_CHIPID 12 0 2 The response contains 64-bit CHIPID value with the least significant word first. Refer to the Intel Agilex® 7 FPGA - Chip ID Reading using AVST Mailbox IP design example for more information.
GET_USERCODE 13 0 1 The response contains one argument which is the 32-bit JTAG USERCODE that the configuration bitstream writes to the device.
GET_VOLTAGE 18 1 n2 The GET_VOLTAGE command has a single argument which is a bitmask specifying the channels to read. Bit 0 specifies channel 0, bit 1 specifies channel 1, and so on.

The response includes a one-word argument for each bit set in the bitmask. The voltage returned is an unsigned fixed-point number with 16 bits below the binary point. For example, a voltage of 0.75V returns 0x0000C000. 3

Agilex™ 7 devices have a single voltage sensor. Consequently, the response is always one word.

GET_TEMPERATURE 19 1 n 4

The GET_TEMPERATURE command returns the temperature or temperatures of the core fabric or transceiver channel locations you specify.

For Agilex™ 7 devices, use the sensor_req argument to specify the locations. The sensor_req includes the following fields:
  • Bits[31:28]: Reserved.
  • Bits[27:16]: Sensor Location. Specifies the TSD location.
  • Bits[15:0]: Sensor mask. Specifies the sensors to read for the sensor location specified. The response contains one word for each temperature requested. If omitted, the command reads channel 0. The least significant bit (lsb) corresponds to sensor 0. The most significant bit (msb) corresponds to channel 15.

The temperature returned is a signed fixed value with 8 bits below the binary point. For example, a temperature of 10°C returns 0x00000A00. A of temperature -1.5°C returns 0xFFFFFE80.

If the bitmask specifies an invalid Location, the command returns an error code which is any value in the range 0x80000000 -0x800000FF.

For Agilex™ 7 devices, refer to the Agilex™ 7 Power Management User Guide for more information about local build-in temperature sensors.

GET_I2C_TELEMETRY 1B 3 N

This command is for VID-enabled devices and allows read of 1 byte and 2 byte register contents of I2C devices over the PMBus. Specify the device address and register address to read, as command parameters.

The FPGA supports I2C device address in 7-bit format. Two groups of eight addresses (0000 XXX and 1111 XXX) are reserved and not accessible via Mailbox command.

The PMBus* Specification has definitions for registers in the address range of 0x00 - 0xAE. Register definitions beyond this range are defined by the I2C device’s manufacturer.

Takes three arguments:
  • Address of the I2C device to query (Range 0x10 < address < 0xF0).
  • Register address to read (Range 0x00 - 0xFF).
  • Number of bytes to read (1 byte or 2 bytes) from the register.

When successful, returns OK followed by the read data from the device. A failure response returns an error code.

Note: Block Read and registers that use Block Read for access are not supported. Refer to the PMBus* Specification for a list of these registers.
Note: Reading 2 bytes from a 1 byte register results in unpredictable data being returned in the second byte. Reading 1 byte from a 2 byte register could leave unprocessed data in the VR’s output data buffer. Most VR’s would age-out this data after some timeout but this is not guaranteed behavior.
Note: This command is only supported on Agilex™ 7 devices.
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 following responses return Non-Error States:
  • 0x0 = IDLE
  • 0x1 = CONFIG
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 versions between 19.4 and 21.2, 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:16]: Value is '0'
Available in Quartus® Prime software version 21.3 or later, the Quartus version 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:16]: Major Quartus release number
  • Bit [15:8]: Minor Quartus release number
  • Bit [7:0]: Quartus update number
For example, in Quartus® Prime software version 21.3.1, the following values represent the major and minor Quartus release numbers, and the Quartus update number:
  • Bit [23:16] = 8'd21 = 8'h15
  • Bit [15:8] = 8'd3 = 8'h3
  • Bit [7:0] = 8'd1 = 8'h1
2 Pin status
  • Bit [31]: Current nSTATUS output value (active low)
  • Bit [30]: Detected nCONFIG input value (active low)
  • Bit [29:8]: Reserved
  • Bit [7:6]: Configuration clock source
    • 01 = Internal oscillator
    • 10 = OSC_CLK_1
  • Bit [5: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 ASx4, does not clear this field. Information about failing image only updates when the Mailbox Client 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. Upon receiving the OK response, issue the QSPI_SET_CS command to select the flash devices.

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 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.

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. Refer to information below for the value that corresponds to the nCSO[0:3] 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: Agilex™ 7 or Stratix® 10 devices support one AS x4 flash memory device for AS configuration from quad SPI device connected to nCSO[0]. Once the device entered user mode, you can use up to four AS x4 flash memories for use with Mailbox Client IP or HPS as data storage. TheMailbox Client IP or HPS can use nCSO[3:0] to access quad SPI devices.

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.

During AS x4 configuration scheme in Agilex™ 7 devices, this command is required after every QSPI_OPEN command.

During JTAG configuration scheme, this command is required after every QSPI_OPEN command.

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.
QSPI_READ_SHA 6E 2 16/12/8 Instructs the firmware to read data from the flash controller and calculate its hash value using one of three Secure Hashing Algorithms (SHA). The returned hash value can be compared to a previously calculated hash value using the same algorithm to determine the integrity of the flash contents.

This command takes two 32-bit words as arguments.

Word 0:

  • Bits [1:0]: SHA Variant. This parameter determines the type of SHA algorithm used. It can take the following values:
    • 00: SHA512
    • 01: SHA384
    • 10: SHA256
  • Bits[31:2]: Start Address. This is the address in flash to start verifying from. The address must be 4 bytes aligned.

Word 1:

  • Bits [31:0]: NumBytes. This represents the number of bytes to be used in the SHA read. Must be a multiple of 64.
The response length varies depending on the SHA variant chosen in the command.
  • SHA512: Returns 16 words
  • SHA384: Returns 12 words
  • SHA256: Returns 8 words
Note: This command is only supported on Agilex™ 7 devices.
GET_CONFIGURATION_TIME 65 0 2 Returns the 64-bit cycle count of the configuration network control clock, with the least significant word first. Dividing the count value by the configuration network control clock frequency provides an estimate of the configuration time. The operating frequency of the configuration network clock depends on the clock source settings configuration in Quartus® Prime. This command can be used with any of the supported configuration schemes.

Typically, configuration cycle count is captured in the lower 32 bits. It is unlikely that the firmware returns a 64-bit cycle count. If this happens, you must concatenate the two 32-bit words to obtain the total cycle count value.

Example:

Returned response: 0x007C27EE = 8136686 cycles

Configuration control clock frequency: 200 MHz

Configuration time: (8136686/200000000) × 1000 = 40.68 ms

Note: This command is only supported on Agilex™ 7 devices.
Configuration Clock Source Configuration Network Control Clock Frequency
External Oscillator (OSC_CLK_1) 250 MHz
Internal Oscillator 170 MHz to 230 MHz
READ_SEU_ERROR 3C 0
  • 1 if Error Message Queue is empty; else
  • Length +2, up to FIFO size[17]

When an SEU error is detected, the error information is stored in the error message queue. This command provides a way to inspect the queue and remove entries from it.

When you set the SEU_ERROR pin in the Device and Pin Options window, you may observe that the SEU_ERROR signal remains high when there is one or more errors in the error message queue. The signal goes low when the error message queue is empty.

The response is one word long when there are no errors in the error message queue.

When there is one or more errors in the queue, the first error from the queue is removed and returned in the subsequent words. This command returns one element from the queue at a time.

Note: Do not use this mailbox command if your design contains the Advanced SEU Detection Intel® FPGA IP.
Word Name Description
0 Error Count Bit[31:0]:Total error count in the Error Message Queue.
1 Sector Address Refer to the respective SEU Mitigation User Guide for the bit description.
2 Error Data
STATUS_VR 713 1 1

Provides an interface for Power Management Firmware (PMF) and Voltage Regulator (VR) data. This command is for VID-enabled devices with both VR polling and PMF also enabled.

Takes one of the following input arguments described below:
  • 0x0: Returns the PMF State as an integer which corresponds to one of the following values.
    • 0x0 = DISABLED
    • 0x1 = INIT
    • 0x2 = MONITOR
    • 0x3 = PAUSED
    • 0x4 = ERROR
  • 0x1: Returns the VID Target Voltage value in millivolts (mV)
  • 0x2: Returns the VR Error Status
    • A successful command returns a value of 0x0, indicating normal execution or no error.
    • For any return values other than 0x0, refer to the Status Register Map figure in the PMBus* Specification Part II Rev. 1.2 or later for relevant STATUS_WORD register error mappings.

This command is available in the Quartus® Prime Pro Edition software version 23.3 or later.

Note: This command is only supported on Agilex™ 7 devices.

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 .

1 This number does not include the command or response header.
2 For Agilex™ 7 devices that support reading multiple devices, index n matches the number of channels you enable on your device.
3 Refer to the Agilex™ 7 Power Management User Guide for more information about temperature sensor channels and locations.
4 Index n depends on the number of sensor masks.