cancel
Showing results for 
Search instead for 
Did you mean: 

Can I combine FatFs and USB MSC functions for the same SD card application together?

laisan86
Associate II
Posted on November 11, 2015 at 04:36

Hello! Everyone,

I am rookie for STM32F103 series! Now, I programmed my STM32F103VE becomes a USB disk with SD card. But, I also want to access this SD card by STM32F103 to get the bitmap files stored in SD card, and display the bitmap files on my TFT.

However, when I turned function of USB disk with SD card on, I cannot access the same SD card by FatFs function to read bitmap files!

Is there anyone can help me?
3 REPLIES 3
Posted on November 11, 2015 at 05:08

You'd probably want to rebuild the SD Card access layer, so it can arbitrate and serialize access to the media. If you can use FatFs in a READ ONLY mode it will significantly reduce the coherency issues that would occur with two writers.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
laisan86
Associate II
Posted on November 11, 2015 at 07:25

I tried modify FS_READONLY becomes 1 in ffconf.h, but it dose not work.

laisan86
Associate II
Posted on November 11, 2015 at 10:48

I found a trade off!

Set_System();<br>Set_USBClock();<br>USB_Interrupts_Config();<br><br>
//Get BMP files saved in SD card here<br>Sd_fs_init();<br>Lcd_show_bmp( 100, 20,''/Dbmp'');<br><br>//Release FatFs<br>f_mount(0, NULL);<br><br>//USB disk<br>USB_Init();<br>while (bDeviceState != CONFIGURED);<span class=''Apple-tab-span'' style=''white-space:pre''> </span> //Wait until USB disk is ready

Thus, I avoided the collision.