SPI master transfer

Block to perform a byte exchange between the SPI master and a SPI slave.

Description

The block transmits a byte from the SPI master and reads the response from the slave. Additionally, the usage of the slave select output pin can be configured.

Parameters
Channel
Select the SPI channel
Use slave select output pin
Configure if a slave select output pin should be controlled during the transfer to select a specific slave.
Slave select output pin
Select the digital output that should be used as slave select.
Enable slave select before transfer
If checked, will drive the slave select output pin low to select the slave before the transfer.
Disable slave select after transfer
If checked, will drive the slave select output pin high to deselect the slave after the transfer.
Delay cycles between slave select enable and transfer
Allows a number of CPU cycles to be waited after the slave select was driven low and the actual transfer. Note that the time of a cycle is system dependent. On a STM32F10x running at 72 MHz, 80 cycles are approximately 10 µs. On a STM32F40x running at 168 Mhz, 240 cycles are approximately 10 µs.
Sample time
Sample time of the block. The Sample time (in seconds) defines the rate at which the block is visited by the real-time scheduler of the target. The value of the Sample time has to be an integer multiple of the base sample time of the model.

Remarks

To transfer multiple bytes without deselecting the slave between the bytes, only check off 'Enable slave select before transfer' for the first byte and only check off 'Disable slave select after transfer' for the last byte