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.

RTOS/LAUNCHXL-CC2650: How to accelerate SPI driver

Part Number: LAUNCHXL-CC2650
Other Parts Discussed in Thread: ADS127L01

Tool/software: TI-RTOS

Hi All,

Please let me know your idea about my problem.

My application need to get 65 535 samples from an ADC (TI ADS127L01) with a sampling frequency of 100 kHz to do an FFT afterwards.

I have set the SPI bitrate at 4MHz with the SPI driver and then I used the SPI_transfer function to get my data from the ADC.

During a transfer, I get one data from the ADC which represent four 8 bits words.

My problem is that I can only get a data every 100us (which means 10 kHz of sampling frequency).

Do you know why there is a 100 us delay between each SPI_transfer ?

How could I removed it ?

Thank you for helping me.

Mickael

  • I forgot to mention that I would like to do all my measures in one shot, so I don't need to shut down the SSI module after each measure. I don't have any other task, I just need open the SPI communication, take my 65 535 samples, and then switch off the communication and the ADC.
  • Hi Mickael,

    I presume that you might be using the SPI driver in blocking mode.

    The 100us is probabaly the tick period that you have configured for TI-RTOS. In blocking mode, the driver pends on a semaphore and therefore switches tasks while waiting for the transfer to complete. Once the SPI transfer completes the Hwi posts to that semaphore and if another task with the same priority is currently running, TI-RTOS will wait until the end of the tick before switching back to your SPI task.

    You could potentially decrease your tick period in the .cfg file, howver, I do not know how fast you can go without making the system unstable.

    Have you tried the callback mode? You would call SPI_transfer from inside the callback to launch another transfer as soon as the previous  one ends.

    Regards,

    Michel

  • Hi Michel,

    Thank you for responding so quickly. I think I will try both options.
    I already tried the callback mode but not with the SPI_transfer from inside the callback.

    Where in the .cfg file can I change the tick period ?
    I try with the callback and then I will tell you the result.

    Regards,
    Mickael
  • Hi Mickael,

    I don't know where to find the configuration using the GUI in CCS, but if you open the .cfg file as text, you should have this variable somewhere:
    Clock.tickPeriod

    Units are in microseconds.

    Regards,
    Michel
  • Hi Michel,

    Thanks for your answer. My Clock.tickPeriod was already at 10 us so it does not improve the speed if I modify it.
    I also tried to do the transfer in the callback as you suggest, but I still have the same problem>

    It seems that somebody else has the same issue on this post :
    e2e.ti.com/.../454770

    This person found that the issue come from the SPI_transferCancel function which takes to many time, but it seems that it's impossible to improve it.

    I finally tried another solution. I designed my own driver compatible with my ADC and it works now.

    Thank you very much for help.

    Regards,
    Mickael