C2000 SPI How to transmit and receive more than 16 uint16

4 views (last 30 days)
Hello, Simulink, MATLAB 2024b
I would like to transmit constants between two F28379D MCUs via SPI. Everything works fine as long as I transmit fewer than 16 uint16 values (FIFO Interrupt level Rx).
My constants: [30.01, -15.01, 0.01, ... , 0.2] The output data type is single, and the vector size is [49x1].
During data integration, my vector is packed using Byte Pack and then cast to uint16, resulting in uint16(49). The next step is transmitting it via SPI with data bits set to 16.
Problems occur when I try to receive the entire vector. I set the output data length in the SPI Receive block to 49. After an interrupt, the SPI Receive block retrieves data in a different order every time the reception occurs. If I set the output data length to 16, my vector remains incomplete.
How can I ensure that I receive all of my data correctly?

Answers (1)

Harsh
Harsh on 4 Jun 2025
Hi @Banny,
I would recommend you to use the SPI transmit (Tx) interrupt on the Tx FIFO to send chunks of data within the ISR (Interrupt Service Routine). In the case above, 49 data values can be divided into 7 groups of 7. Configure the Tx FIFO with a depth of 7, and use a counter to track the number of transmissions. Each time the interrupt triggers, send 7 data values, repeating this process seven times.
You can find more detailed information provided by the Texas Instruments support team on the following forum:
Please note that in order to receive these 49 data values you would need to set up the Rx ISR as well to handle reading the Rx FIFO.
I hope this helps, thanks!

Categories

Find more on Simulink Functions in Help Center and File Exchange

Tags

Products


Release

R2024b

Community Treasure Hunt

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

Start Hunting!