Tool/software: TI-RTOS
Hi Forum
I have a problem with the SPI callback:
We have made a special sensor board, which will stream a lot of data from a sensor via SPI in a short time to an external FRAM. The sensor has an internal FIFO which will trigger a GPIO interrupt if it is full. Unfortunately, I need to read out the data from the sensor FIFO byte-wise, a complete SPI read command per byte because this is how the sensor was designed :( I have now some issues, how to design this properly.
To handle this transfer, I have designed a state machine. The states will be changed via interrupts, e.g. an interrupt of the external sensor FIFO or a callback if the SPI transaction was finished. I have now discovered, that the SPI transfer could be so fast, that the interrupt will be set even if the current program pointer is still in the SPI-finished callback (I also issue transfers from within the SPI finished callback to be as fast as possible to read the FIFO byte-wise). I think this is the problem, because the RTOS hangs, if a very short SPI command is sent within the SPI finish callback.
I could now re-write the code to handle the SPI via blocking transaction, but is was written, that this is only possible within a task environment: this means, I can't directly transfer data via SPI on a FIFO GPIO interrupt...
Is there a possibility to trigger a new SPI transfer directly after another transfer is finished? Within a interrupt context? Or do I need to handle something like this in a task function context, and work with events?
I hope you could see my problem. If not, don't hesitate to ask.
Thank you very much in advance
Best Regards,
Matthias