AN 936: Executing SDM Commands via JTAG Interface

ID 683313
Date 3/29/2021
Public

1.4.4. Execute Command

The exec_command procedure allows you to execute any SDM command.
Use the following syntax to execute an SDM command specified in the sdm_command.tcl file in the Hex format.
%exec_command <sdm_command> {list_of_arguments} <device_index>
where
  • {list_of_arguments}: Optional argument that specifies arguments list. By default, list of arguments is an empty list.
  • <device_index>: Optional argument that provides the specific device number. By default, the device index is set to 1.
Note: If the device index is not 1 and you have 0 argument, you must provide an empty list of arguments in the command. The Executing GET_USERCODE Command example uses scenario with an empty list of arguments.

The following examples show various usage of the execute command.

Executing GET_USERCODE Command

Executing the GET_USERCODE command (0x13) with empty list of arguments and the device index set to 2.

%exec_command 0x13 {} 2

The command returns the response header along with the response returned from the SDM after executing the SDM command.

Reading Data from QSPI Flash

To read the data from the Quad SPI flash memory, you must execute a sequence of SDM commands:

  1. QSPI_OPEN
  2. QSPI_SET_CS 1
  3. QSPI_READ
  4. QSPI_CLOSE

To perform any additional QSPI operations such as write or erase, refer to the QSPI_WRITE and QSPI_ERASE commands described in the Mailbox Client Intel® FPGA IP User Guide.

Table 1.  QSPI Command Codes and Length The table displays the SDM commands and their hexadecimal code with appropriate command and response length. The command length description is the QSPI flash memory address location from where the data is read.
SDM Command Code (Hex)

Command Length

Command Length Description

Response Length
QSPI_OPEN 0x32 0 0
QSOI_SET_CS 0x34 1 0
QSPI_READ 0x3A

2

{QSPI flash address, number of words to read from QSPI flash}

N
QSPI_CLOSE 0x33 0 0
  1. Executing the QSPI_OPEN command (0x32), command returns the response header value of 0x00000000 indicating the successful command execution.
    %exec_command 0x32
  2. Executing the QSPI_SET_CS command (0x34), command returns the response header value of 0x00000000 indicating the successful command execution.
    %exec_command 0x34 {0}
  3. Executing the QSPI_READ command (0x3A), requires two arguments:
    • argument 1: Represents the QSPI flash address
    • argument 2: Represents total number of words requested to read from QSPI flash, up to the maximum allowed number per read.
      %exec_command 0x3A {0 5}
      0x00005000 0x62294895 0x00000010 0x00000400 0x00000000 0x00000000

    The command reads the SDM device #1 QSPI at location 0 for 5 words. The first word, 0x00005000 of the response is the response header. Bits[22:12] represent the response length and is set to 5. Bits [10:0] represent error code for the response and is 0. The subsequent five words are the data read out from the QSPI flash.

    A single read operation can read up to 1024 words, or 4096 bytes. If you need to read more than the maximum allowed words per operation, you must execute another QSPI_READ command with the appropriate offset address.
    Note: If the argument list specifies more than one argument, you must specify all arguments within the curly brackets argument list.
  4. Executing the QSPI_CLOSE command (0x33).
    %exec_command 0x33
1 This command is optional for the AS x4 configuration scheme and required for all other configuration schemes.