2014-07-29 07:08 AM
'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?
#usb #stm322014-07-29 08:19 AM
Is it simply that I can't write to an SD card I am currently using as a USB device?
Well in as much as you're unlikely to resolve the coherency issues, yes. Your other issues seem to be related to how it's integrated, and you should perhaps push into the diskio.c to see what's actually locking you out, and how the IO layer is implemented below it.