How do I Transmit to Multiple SPI Devices on the Same Module in Simulink on a C2000?

2 views (last 30 days)

I have a Simulink model that I will be deploying to a TI C2000 board. One of the board's SPI modules (also known as controllers) will be connected to two or more external SPI sub devices (also known as peripherals). I am sending data using the SPI Transmit block.

The appropriate device is chosen by the chip select pin (CS) option in Block Parameters, which must change depending on which device I would like to communicate with. While I can assign the chip select pin to a variable, when I change the variable's value, the block does not update to use the new value.

How do I select which SPI device to transmit data to?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 31 Jul 2024
Each SPI Transmit block is only for use with one peripheral device. Not being able to change the chip select pin during use is intentional. You will need one SPI Transmit block for each peripheral SPI device. Note that multiple SPI Transmit blocks can share a single SPI module.
To control when to send data, you can place an SPI Transmit block inside an enabled subsystem. Whenever the subsystem is disabled, no new data will be queued for transmission.
We have detailed documentation available for enabled subsystems, with examples:
For more information about the SPI Transmit block, please reference this page:

More Answers (0)

Products


Release

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!