SPI WriteRead

Write data to and read data from an SPI device

  • Library:
  • Simulink Support Package for Arduino Hardware / Common

Description

Write data to and read data from an SPI device connected to your Arduino board. Using this block, you can access an SPI device to measure quantities such as temperature, and pressure. You can also access an SPI device to support WiFi connectivity, and to access an SD card to store data.

To know the Arduino® boards that support this block, see Pin Mapping on Arduino Blocks

Limitations

This limitation is not applicable when using Arduino MKR1000, Arduino MKR WIFI 1010, and Arduino MKR ZERO boards.

In a Simulink®model, the SPI WriteRead block is supported only if:

  • No blocks from the Ethernet shield library or the WiFi library are already present in the model.

  • External mode is over serial.

Ports

Input

expand all

The input port through which the block accepts a single dimensional array of values to write to the slave device.

Data Types: uint8 | uint16 | uint32

Output

expand all

Output port from which the block receives data from SPI slave device.

Data Types: uint8 | uint16 | uint32

Parameters

expand all

Enter the pin number on the Arduino board to which the SPI slave device is connected. The SPI master pulls the SS pin of the selected slave to a low (0) value to start the communication. See Pin Mapping on Arduino Blocks to know the SS pin restriction with different Arduino boards.

Introduced in R2016b