AnsweredAssumed Answered

Using SD card and USB Mass Storage Simulataneously

Question asked by gold.julian on Jul 29, 2014
Latest reply on Jul 29, 2014 by Clive One

'm currently developing an application for an ST32 (STM32F103xC) using Micrium OS-II. So far it's all gone smoothly, but I've hit a block now and can't proceed.

The board is configured to act as a USB storage device using the SD card so that the host PC can copy files saved out on the device. This works fine, inasmuch as can see the files currently on the SD card in a Windows Explorer.

However, when I try to use FATFS to create a file in my program, f_open() returns FR_NOT_READY. In order to investigate further, I built some sample code that writes files to SD and it works fine. So I moved the writing code around in my program, and I found that if I called f_open before I started the OS multitasking tick, it worked correctly - I could open a file and write to it. Putting the code immediately after the enabling of the tick (but before tasks have been created) goes back to getting FR_NOT_READY.

I am not sure I know what this means. Are there limitations on where I can write to files? Do I have to disable multitasking when writing? (Ouch, surely not?) Is it simply that I can't write to an SD card I am currently using as a USB device?