Using MMC driver with other SPI devices
Posted: Sun Jul 14, 2019 6:05 pm
Hello,
I've got one of these TFT display breakout boards with SD card socket which shares same SPI interface with display. I already wrote driver which communicates with display and follows ChibiOS Hal communication with mutual exclusion:
The problem is that MMC driver encapsulates SPI calls and uses SPI without mutual exclusions and it doesn't follow calling sequence I described above (for example mmcConnect() just starts SPI driver, establishes connection with SD card and live driver in that state), which is a problem because I can't use same SPI for communication with different SPI devices at same bus. I can't use communication between mmcConnect() and mmcConnect() because I already have USB driver, which pulls data frequently and that will be performance penalty if I will connect and disconnect driver on every block reading and writing operation. Is there some workaround or fixes for my issue?
Best regards, Harry.
I've got one of these TFT display breakout boards with SD card socket which shares same SPI interface with display. I already wrote driver which communicates with display and follows ChibiOS Hal communication with mutual exclusion:
Code: Select all
spiAcquireBus()
spiStart()
spiSelect()
//spiSend(), spiReceive() and spiExchange() calls
spiUnselect();
spiReleaseBus();
The problem is that MMC driver encapsulates SPI calls and uses SPI without mutual exclusions and it doesn't follow calling sequence I described above (for example mmcConnect() just starts SPI driver, establishes connection with SD card and live driver in that state), which is a problem because I can't use same SPI for communication with different SPI devices at same bus. I can't use communication between mmcConnect() and mmcConnect() because I already have USB driver, which pulls data frequently and that will be performance penalty if I will connect and disconnect driver on every block reading and writing operation. Is there some workaround or fixes for my issue?
Best regards, Harry.