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.

"Fast" sample rate using SPI...

Other Parts Discussed in Thread: CC2640

I'm attempting to obtain data from a sensor at a 4 KHz rate.   Specifically, I get a pulse every ~0.250 ms that indicates that data is ready to read.    To actually read the data I need to use the SPI (running at 4MHz) to read two values.

I'm using the pulse to activate an interrupt.   The interrupt handler simply sets a semaphore for the "reading" task (thinking that doing the actual SPI read in the interrupt handler would take too long.).    The "reading" task performs the SPI reads and sends the data.

I'm running this on a CC2640.    I see the data start to arrive, but after a very short time, the CC2640 starts to miss the data.    I'm guessing that the BLE services, running at a higher priority, are taking up too many CPU cycles.

I'm running the "reading" task at priority level 2.   My other tasks run at priority level 1.   All of the system level (and BLE) tasks run at higher levels.

I am using the highest level of optimization.

I thought that the sensor controller might be a good way to offload the data collection duties, but it appears from reading that the only SPI interface available to it is a software implemented SPI.    Is there "optimized"   SPI code for the sensor controller available?    Is there a way for the sensor controller to access the HW SPI module?

Any other ideas on how to achieve the 4 KHz sampling rate?

Thanks!

  • Hello Ed,

    If you do not use / activate the BLE Stack, do you miss data? Also, are you using teh TI-RTOS SPI driver or emulating a SPI on the Sensor Controller?

    Best wishes
  • Thanks for the response!
    I'm using the TI-RTOS SPI driver. Things work fine with a slower sampling rate, but at the higher rate, I can see (via a logic analyzer) the interrupts coming in and being serviced (appropriate SPI activity for each), but then a number of them go without service before servicing starts again. I'm assuming that the missed interrupts are due to higher priority activity.

    I plan on looking into the Sensor Controller as a solution to this. The only documentation I could find was inside Sensor Studio. Are there other sources of documentation on the Sensor Controller, etc.?
    Thanks!
  • In some modes, when an interrupt occurs, I need to access two different peripherals. They each have their own MISO signal. Using SensorStudio, pins appear to be statically assigned using the graphical user interface (I'm just learning this tool!). Is there a way to do this programmatically, so I can "switch" between MISO signals?
    Thanks!