cancel
Showing results for 
Search instead for 
Did you mean: 

USB Mass Storage vs Internal Filesystem

Eugene Solo
Senior
Posted on April 10, 2015 at 13:56

I'm developing code for custom STM32F103-based board. I'm using code from USB Mass Storage demo from STM32_USB-FS-Device_Driver library 4.0.0 (yes, it may look pretty old, but it works), storage media is SPI flash chip. After successful implementation of simple caching algorithm, write speed raised to ~65kB/s, read speed is limited by USB FS itself, this is very good result for me.

Now I need some information about how to control future filesystem consistency - I mean, how do I STOP USB MSC from functioning and re-start it again when needed? Is there specific API for it, or some SCSI command needs to be implemented or I can just turn off USB peripheral? And I need to ''catch'' moment of initialization, when device is successfully enumerated and recognized, just to prevent possible conflicts and filesystem corruption from actions of internal software.

I don't want to change this particular library to something else, but some ''patchworking'' is fine.

Just to clarify situation: ''unplug the connector''  is not a solution here, because I want to have working HID to control this device, I need just to stop MSC part.

#stm32-usb-msc
1 REPLY 1
Posted on April 11, 2015 at 13:51

Have it report that it's a removable media device, and use the sense mechanism return Not Ready, or No Media Present type responses.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..