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.

TMS320F28379D:

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Hi,

I am working with TMS320F28379D LaunchPad to program SPI for UCC5870Q EVM.

I have to measure the time for sending some SPI commands, but I have a problem because I cannot have the same “delay” between every two messages.

I am using SPI_writeDataBlockingNonFIFO to write the data and after it DEVICE_DELAY_US(2) to make the delay between them.

I also tried to write with SPI_writeDataBlockingNonFIFO and after it SPI_readDataBlockingNonFIFO(SPIB_BASE) instead of the delay.

But when I see the SPI signals on the oscilloscope, I cannot see the same delay between each message although I programmed it to be the same.


Could you please help me with this?

Thank you very much and kind regards,
Ivana

  • Hi Ivana,

    I am not sure how your code is structured, but that may have an impact on the delay time between transfers. For example, a for() loop will require some branch & compare instructions each time through the loop which will affect the timing of the calls to the SPI write and read instructions. If you have other code running simultaneously, that can also pre-empt your SPI code from running on time. The function SPI_readBlocking also checks for status flags which makes the execution of code that follows somewhat variable.

    For tighter control on the execution of your SPI write commands, I would recommend you enable a timer interrupt specially programmed to force the CPU to execute a SPI transaction at the exact interval you need. This interrupt should be high priority so that other other interrupts do not pre-empt it from running. You can leverage the timer examples on C2000ware.

    I would also ask that you reconsider if SPI is the best peripheral if very specific timing control is required.