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/MSP432P401R: Clarification about SPI_transfer() from a HWI context.

Part Number: MSP432P401R

Tool/software: TI-RTOS

Hi,

I have been developing a product using the TI MSP432P401R, TI ADS1298 analog-to-digital converter, and TI-RTOS with TI Drivers (SPI in my case). I'm using the SPI Driver and TI-RTOS from the last version of SimpleLink MSP432 SDK. In few words, my application configures the ADS1298 and put in CONTINUOUS conversion mode. The ADS1298 has a pin that generates an interrupt when a conversion is done. I have opened the SPI Driver in blocking mode. In my first application, the interrupt pin callback post a semaphore and unblock a task that read the data from ADS calling SPI_trasfer() function, but the interrupt frequency (related with sample rate from ASD1298) is faster than system tick (1 ms), and the task will always run and not allowing others to run. So, I change my program, opening SPI driver in callback mode. Then, the interrupt pin callback calls SPI_transfer() in the Hwi context and SPI callback store the data in a buffer. When the buffer is completely filled, the SPI callback posts a semaphore and the task is unblocked and process the chunk of data.

I have read the TI-RTOS 2.20 user guide and is not clear to me if SPI_transfer can be called from callback context (Hwi). I have searched for a clarification in the e2e forum but no e2e thread answers my question. The closest e2e thread that I have read https://e2e.ti.com/support/embedded/tirtos/f/355/t/513722 In some e2e posts, the people say that is possible call SPI_transfer() from callback. In another say that is not possible. I'm really confused.

There is a better way to do what I have been trying?

Can someone help me?

Thanks in advance!

  • Otavio,

    Maybe you can help clarify a little bit of your application scenario here, are you missing SPI data from the ADS1298 or are you starving other threads when you start reading the ADS1298?

    Just a thought from my end, you could use a semaphore post based on the generated interrupt from the ADC1298 first from the HWI context. And since you are the master on the SPI, you could then use a thread to call SPI_transfer() with the callback function version so that you are not blocking your other threads. The key thing is that you don't want to starve your other threads just to be polling to be receiving SPI data.

    William
  • Hi Otavio,

    Do you still need some help with this? Please let us know.

    Thanks,

    David
  • Hi David

    Thanks for your attention! Give me a few more days to make sure that this problem is solved.

    Otavio Gomes

**Attention** This is a public forum