You can use the same SPI to interface 2 or more slaves. You need to use IO_IOCTL_SPI_SET_CS command, you can refer to the
MQX I/O drivers users guide that can be found at this path C:\Program Files\Freescale\Freescale MQX 3.8\doc\mqx.
A single callback function for CS handling may be registered per SPI device. The callback function registration is performed by the IO_IOCTL_SPI_SET_CS_CALLBACK IOCTL command. SPI driver than calls the function any time when a change of the CS signals state is necessary. Besides the context data, the function is also passed a desired state of the CS signals. The callback function is then responsible for changing the state of the CS by any method (e.g. using LWGPIO).
Please note that setting the callback function possibly affects all file handles associated with the same SPI device since the function is called for any change to the state of CS signals, regardless of the file handle used for operation which is causing the CS state change.
For more information, please check the MQXIOUG (chapter 9)
Have a great day,
Sol
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------