SPI Receive after Transmit Peripheral Block Description
This block handles the SPI peripheral interface in Receive after Transmit mode. It is used to transmit data to and subsequently receive data from an SPI Slave device. This block is useful in situations where the Slave device requires data to be sent by the Master before it can return a specific command or data response. In this mode, the block first transmits data to the Slave device, then waits for the response, which it receives and outputs.

Table of Contents
Inputs
| Input Name | Type | Description |
|---|---|---|
| TX data[ ] | uint8 | Data to be transmitted. The amount of data depends on the Transmit size parameter. |
Outputs
| Output Name | Type | Description |
|---|---|---|
| Status | uint8 | Transmission status. Returns:1 transmission succeeded0 transmission failed |
| RX data[ ] | uint8 | Data received from the SPI device. The amount of data depends on the Receive size parameter. |
Block Parameters
| Parameter | Description |
|---|---|
| SPI Number | SPI module number |
| Chip Select | Option to enable the Chip Select pin selection. If disabled, the CS pin will not be available or the Hardware NSS Signal must be used. |
| Chip Select Port | Conditional Parameter GPIO port for the Chip Select pin. This parameter is available if the Chip Select option is enabled. |
| Chip Select Pin | Conditional Parameter GPIO pin for the Chip Select pin. This parameter is available if the Chip Select option is enabled. |
| Mode | SPI block operating mode:Transmit only - transmission modeReceive only - reception modeTransmit and receive - simultaneous transmission and reception modeReceive after transmit - sequential transmission and subsequent reception mode |
| Transmit size | Data transfer size in bytes. This parameter determines the amount of data that will be transmitted in one transmission cycle. |
| Receive size | Data transfer size in bytes. This parameter determines the amount of data that will be received in one transmission cycle. |
| Timeout | The time to wait for the transmission to complete. If the transmission does not finish within this period, the block returns an error status. |
| Sample time [s] | Function refresh period |

CubeMX Configuration for a Given MCU Model
Configuration of CubeMX for the SPI interface can be found in the CubeMX Configuration for a Given MCU Model section.
See Also
Last updated on