C2000 SPI How to transmit and receive more than 16 uint16

조회 수: 6 (최근 30일)
Banny
Banny 2025년 4월 28일
답변: Harsh 2025년 6월 4일
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?

답변 (1개)

Harsh
Harsh 2025년 6월 4일
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!

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

태그

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by