Data truncation to 4 word lengths when using the SPI Transmit block in the TI C2000 support package for Embedded Coder

7 visualizzazioni (ultimi 30 giorni)
When sending 4 words of data (64 bits) using the SPI transmit block, I observe the transfer to be successful. However, if I'm sending more than 4 words, the data gets truncated to 4 words and the remaining bits don't seem to get transmitted. 
The SPI Transmit block also outputs a status error message of 1 indicating that a timeout occurred. However, the truncated bitstream of 4 words seems to get transmitted over and over again. 
Why is the data restricted to 4 words?

Risposta accettata

MathWorks Support Team
MathWorks Support Team il 10 Ago 2017
 It seems like you are using the SPI Transmit block in *_non-blocking_* mode. In this mode, the input data is copied into the SPI FIFO transmit buffer until the buffer is full. Since copying happens in one flow, if there are bytes that could not find a place in the FIFO buffer (FIFO full), those bytes get discarded. This seems to be the cause for the behavior you observed. Moreover, this is typical to non-blocking mode wherein the SPI Transmit block does not wait for the FIFO buffer to open up an empty space to hold the additional byte (5th byte)
That being said, as a workaround, I would suggest using the SPI Transmit block in _*blocking mode*_. In blocking mode, data transfer is blocked until a free slot is available in the FIFO buffer. Therefore, as soon as the FIFO buffer becomes empty, the remaining bytes that are blocked get copied into the buffer and get transmitted. 
Please note that the depth of the FIFO buffer for F28069 is only 4 bytes (word lengths).Therefore, when transmitting data greater than 4 bytes, the FIFO buffer gets filled up with data and in *_non-blocking _*mode, the remaining bytes get discarded. Therefore, the workaround would be to use the SPI Transmit block in _*blocking *_mode.

Più risposte (0)

Prodotti


Release

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by