cancel
Showing results for 
Search instead for 
Did you mean: 

How do you read from USB CDC Mass Storage

Sam F
Associate II
Posted on October 15, 2016 at 00:45

I have  STM32L476G-DISCO that came pre-loaded with some demo firmware including a Mass Storage device that works when you plug it into a computer like a flash drive.  

How does one go about a reading in a file from this memory?  For example I put a file called name.txt on the mass storage bit and now I would like to read in that file as input from my application.

I have semihosting enabled and can read in from the UART just fine.  I've ported this program over from a 32-bit windows console application and am trying to get it going on the ARM platform.  So far it is compiling okay but I'm not sure how to proceed.  Before I used you read in command line arguments like so: ''< C:\file.txt'' but that obviously will be different on the ARM core.  

My current program is calling the mbed libraries and is using freeRTOS with FatFS.  Can anyone please point me in the right direction?

Thank you,

Sam

#msd #cdc #usb
1 REPLY 1
Posted on October 17, 2016 at 17:40

You'd provide the same sector access routines the MSD used to the diskio.c layer of FatFs, and perhaps something to provide the geometry/capacity if it needs to be formatted.

You'd f_open() ''file.txt''

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