cancel
Showing results for 
Search instead for 
Did you mean: 

How to Share SD Card Between FileX and USB MSC in Azure RTOS

vaibhavivele
Associate

I am working on an STM32 + Azure RTOS project where I need to access the same SD card in two different modes:

  1. When the microcontroller accesses the SD card directly, I use FileX with an SDIO/SPI driver.

  2. When the SD card is connected to a PC via USB, I use USB MSC (Mass Storage Class) so that the PC can read/write the card.

Individually, both functions work perfectly:

 FileX can read/write SD card when MCU is accessing it
USB MSC works when PC is connected

However, when I try to support both modes simultaneously, the SD card fails to work correctly.
There is no reference example from ST or Microsoft showing how to share the SD card between FileX and USB MSC at runtime.

My main question:

How can I properly share the same SD card between FileX (MCU access) and USB MSC (PC access) in Azure RTOS, ensuring that both do not access the file system at the same time? Is there an official method, mutex mechanism, media lock, or recommended design pattern for this scenario?

0 REPLIES 0