I am using the QSPI driver provided with MQX. I dont know if this drivers provide protection in order to
avoid different tasks using the qspi resource.
Before I use a mutex to protect this case, I would like to know if there is already a protection.
Thanks
Hello,
in the next release, the QSPI driver will be merged into universal SPI driver.
The driver will not open twice, there will be an exclusive access to SPI.
If you try to use same SPI file descriptor in multiple tasks, you have to provide additional protection.
Regards,
PetrM
Well, the best idea would be to create one communication task, which would be the only task accessing QSPI bus and which would be used by other tasks through messages.
In you scenario, you have to take care of exclusive QSPI access using mutexes or semaphores either way.
Hi
To clarify, I am right in thinking that we can have a maximum of one device 'fopen'ed against spi0 at a time? And to access multiple devices on the SPI, we have to ioctl each device's SPI definition (if they differ) for the phyical device we were going to talk to each time we're about to talk?
I'd erroneously expected the ability to allow multiple fopens, each with a different CS number... and the handling of multi-device read/write clashes using a mutex internal to the driver.
Could you let me know whether I'm now looking at the driver the right way up?
Thanks
Joe
Yes, only one SPI device can be opened at a time now.
If you're communicating with several devices and their physical communication settings differ, you have to switch the settings using IOCTLs everytime you switch between devices.
Think of it as generic low level driver upon which you can create any "protocol layers".
PetrM
Thanks, PetrM.
I think I understand it properly now.
Joe
As far as I know MQX functions are all thread & re entrant safe unless otherwise stated.