This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/TMS320F28379D: Continuous Data Read by SPI Module

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Tool/software: Code Composer Studio

Hello,

I have a question about continuous data reading from SPI module on TMS320F28379D. I'm trying to get data from a sensor which uses SPI communication. 

Using F28379 as master and sensor as slave configuration, there are two options to get data from sensor as follows: 

1-) Send a request for data and get the requested data in the next transmission. I have been able to get data with this method but it adds undesirable waiting time for transmission.

2-) Send a request for burst data and get 10 words without stall time. I add data transmission diagram below:

 

I’ve been reviewing TRM for SPI module. As far as I know, to activate the Chip Select (CS) one must write data to the SPITXBUF register then CS and SCLK becomes active and while SPITXBUF sending data to slave, SPIRXBUF gets the data from slave. I have the following questions:

1) Is it possible the get the burst data (as shown in above figure) in F28379 SPI module? I might be missing some points but as I’ve observed, after writing the data, CS and SCLK always becomes inactive. I’ve tried to use CS as GPIO instead of SPISTE pin but couldn’t handle the SCLK.

2) Is it possible to read data without writing anything (not even dummy data) to SPI module?

3) In 1Mhz SCLK, this transmission gets 10*16 word = 160 us. Is it possible to this procedure without consuming any CPU time i.e. while doing something in CPU, SPI gets data to the FIFO without calling SPI functions.

4) Can DMA or CLA used for this data transmission? They both have access to SPI registers. I’ve been able to send data from CLA for method 1 (consecutive write and read) but couldn’t get the burst data (I think this issue connected to the question 1). Is DMA could be able to handle this data transmission without using CPU time?

Thanks in advance,

Oguzhan.

  • Hi Oguzhan,

    Let me address your questions 1 by 1.

    Oguzhan T said:
    1) Is it possible the get the burst data (as shown in above figure) in F28379 SPI module? I might be missing some points but as I’ve observed, after writing the data, CS and SCLK always becomes inactive. I’ve tried to use CS as GPIO instead of SPISTE pin but couldn’t handle the SCLK.

    Yes, it is possible by use of the SPI FIFO. With the FIFO enabled, you can load up to 16 characters at a time. The SPI will keep the SPISTE pin low until all 16 characters have been transmitted.

    Oguzhan T said:
    2) Is it possible to read data without writing anything (not even dummy data) to SPI module?

    No, this is not possible. You must write a character to the TX buffer to get a character in the RX buffer.

    Oguzhan T said:
    3) In 1Mhz SCLK, this transmission gets 10*16 word = 160 us. Is it possible to this procedure without consuming any CPU time i.e. while doing something in CPU, SPI gets data to the FIFO without calling SPI functions.

    Yes, this is possible with use of the DMA + SPI FIFO. You can program the DMA to write the control character + 10 dummy characters to receive the data from the sensor. The CPU would only need to program and trigger the DMA channel.

    Oguzhan T said:
    4) Can DMA or CLA used for this data transmission? They both have access to SPI registers. I’ve been able to send data from CLA for method 1 (consecutive write and read) but couldn’t get the burst data (I think this issue connected to the question 1). Is DMA could be able to handle this data transmission without using CPU time?

    Yes it can. I would point you to the spi_loopback_dma example in C2000ware. That should give you a good idea of how to get started.

    <C2000ware install path>\device_support\f2837xd\examples\cpu1\spi_loopback_dma