AnsweredAssumed Answered

Does a task "own" the SPI interface?

Question asked by David Pfaltzgraff on Jul 6, 2015
Latest reply on Jul 10, 2015 by soledad

The background is that I'm writing code for the FRDM-K22F under KDS with KSDK and MQX. I used the example found in C:\Freescale\KSDK_1.2.0\rtos\mqx\mqx\examples\dspi\build\kds and wrote a task that initializes the SPI1 interface. By itself, the code works as expected.

 

However, I have another task that attempts to write to the SPI interface, it always returns the busy status (error code 4). While the original task seems to be able to write anything, I have tried various combinations in the second task and always get the same result.

 

This leads me to ask: Is the SPI interface "owned" by the task that initializes it? This would make sense in that it would appear busy to all other tasks, but I am not sure of the inner workings of MQX.

 

If this is the case, what is the easiest (laziest) way to share the interface? In this design, the SPI interface is used to output two bytes to a set of shift registers that drive the LEDs on a front panel. It is output only from the processor.

 

Thanks

Outcomes