Main Content

QSPI Peripheral

Write data to and read data from an SPI peripheral device

Since R2024a

  • QSPI peripheral block

Libraries:
Embedded Coder Support Package for Infineon AURIX TC3x Microcontrollers / AURIX TC3x

Description

Write data to and read data from an SPI peripheral device

The Queued Synchronous Peripheral Interface (QSPI) Peripheral block accepts 1-D array of data type int8, uint8, int16, uint16, int32, and uint32. The block outputs an array of the same size and data type as the input values.

Ports

Input

expand all

The port inputs the data to be communicated with peripheral device. The datatype is based on the block mask configuration.

Dependencies

To enable this port, set the Transfer mode parameter to SPI Transmit.

Data Types: int8 | uint8 | int16 | uint16 | int32 | uint32

If the Transfer mode is set to SPI Receive, the QSPI block converts the SoC Blockset™ message SDImsg into output data at the SDI output port during simulation.

Dependencies

To enable this port, select the Enable simulation port parameter.

Output

expand all

The port outputs the data received from the peripheral device. The output datatype is based on the block mask configuration.

Dependencies

To enable this port, set the Transfer mode parameter to SPI Receive.

Data Types: int8 | uint8 | int16 | uint16 | int32 | uint32

The block outputs the status of the data that was received, or the errors that occurred during the data transmission and reception, as a unit16 scalar value

Bit Status
Bit 0Transaction successful
Bit 1Busy
Bit 2Parity Error
Bit 3Configuration Error
Bit 4Baud Rate Error
Bit 5Transmit buffer (Tx FIFO) Overflow Error
Bit 6Tx FIFO Underflow Error
Bit 7Receive buffer (Rx FIFO) Overflow Error
Bit 8Rx FIFO Underflow Error
Bit 9Timeout Error
Bit 10SLSI Misplaced Inactivation

For example, the status of 17 (sets 4th and 0th bit) represents successful transaction with baud rate error.

Dependencies

To enable this port, select the Enable status port parameter.

Data Types: uint16

If the Transfer mode is set to SPI Transmit, this port outputs the data received at SDO port in message form during simulation.

Dependencies

To enable this port, select the Enable simulation port parameter.

Parameters

expand all

Basic

Select the QSPI transfer mode.

  • SPI Transmit - In this transfer mode, you can transmit the data without waiting to receive. Before initiating the data transfer, ensure the status is 1 i.e. not in progress from the QSPI Receive block.

    When you select this transfer mode, the block configures an input port, SDO.

    Note

    QSPI Receive block is responsible to handle the receive data from the peripheral device. In other words both QSPI Transmit block and QSPI Receive block must be used to complete the data transfer.

  • SPI Receive - In this transfer mode, you can receive the data from peripheral device.

    When you select this transfer mode, the block configures an output port, SDI.

    Note

    The data should be transmitted using QSPI Transmit block before receiving the data. In other words, both QSPI Transmit and QSPI Receive block must be used to complete the data transfer.

Data bits parameter provides the frame length of each data element in the QSPI communication. If the selected data bits is in the range:

  • 2 to 8 - the valid data types are int8 or unit8.

  • 9 to 16 - the valid data types are int16 or unit16.

  • 17 to 32 - the valid data types are int32 or unit32.

Select this parameter to output status of data transfer.

When you select the output Status parameter, the block configures an output port, Status.

Specify in seconds how often the block should read the input data.

When you specify this parameter as -1, Simulink® determines the best sample time for the block based on the block context within the model.

Dependencies

To enable this parameter, set the Transfer mode to the SPI Receive

Select this parameter to enable peripheral simulation capability.

Note

If you do not have a SoC Blockset license, the Enable simulation port parameter is visible but you cannot enable it.

Advanced

Specify the data length to be received from the peripheral device.

Note

The data length specified must match the data transmitted using QSPI Transmit block.

Dependencies

To enable this parameter, set the Transfer mode to the SPI Receive

Select the supported data types based on the data bits selected.

Dependencies

To enable this parameter, set the Transfer mode to SPI Receive.

Version History

Introduced in R2024a