SPI Block

How this block appears in a Simulink model?

What can be configured?

Configuration Parameter Selectable Option/Value Description
SPI Module 2 – (HSPI)----3 – (HSPI) Specify SPI module for transmit or receive data.
SPI Mode 0--1--2--3 Select the SPI mode.
Clock Frequency (kHz) Transferring each byte takes eight times the clock period 8/fspi. If the clock frequency is too high, the use of some functions might be limited.
Data format (Rx and Tx) First bit MSB--First bit LSB Select data format
Chip select pin (CS) 1 to 15 Select pin for CS
Clock pin (SCLK) 0 to 14 Select pin for SCLK
Master read (MISO) Not used--0 to 13 Select pin for MISO
Master write (MOSI) Not used--0 to 13 Select pin for MOSI
Bytes write count Number of data bytes for write transaction (bytes sent via MOSI pin)
Bytes read count Number of data bytes for read transaction (bytes sent via MISO pin)
Sample time (sec) -1 (inherited) or specify Specify sample time for the block

SPI pin name and function ?
Pin name Alternative naming Function
SCLK SCK, CLK, CK Serial Clock. Oscillating signal generated by a Host that keeps the transmission of data bits in sync.
MOSI MDO, SDO, DO Master Out, Slave In, a.k.a. D. Data transmission from a Host to Device.
MISO MDI, SDI, DI Master In, Slave Out, a.k.a. Q. Data transmission from a Device to Host.
CS NSS, nCS Chip Select. Allows a Host to select individual Device(s) connected to the bus in order to send or receive data.


SPI demo

Previous : UART Rx Block
Next : I2C Block

Also available in: PDF HTML TXT