Hello - does anyone have experience using the MQX SPI driver where Chip Select toggling is required? I'm just wondering how this is accomplished (if possible) maybe using ioctl? I need to have the ability to switch between toggling and not, as I have two devices on the bus - one requires toggle and the other not. I'm able to do it with PE (SPI2_SelectConfiguration), but I need to use only MQX SPI driver.
Using K70 with CW10.6, MQX 4.1.
Best regards,
Louie
Hi Louie:
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. The parameter of the command is SPI_CS_CALLBACK_STRUCT which contains a pointer to the callback function and a pointer to the arbitrary context data for the callback function.
SPI driver then 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)
Have a great day,
Daniel
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct or helpful button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thanks, Daniel. I have started down the path of registering the callback. I wasn't sure if there was a way to have hardware do the toggling/strobing since the SPI port can be configured to handle the /CS line, but apparently it's required in software. I will look into controlling the /CS line manually.