cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L053R8 as USB mass storage

mocnikg
Associate II
Posted on March 19, 2016 at 20:50

Hello,

I am newbie in STM microcotrollers family.

Other HelloWorld project work's fine.

Now I have new project, I would like show data from memory on microcontroller on my PC. I created project in STMCubeMX then build and load on flash from KEIL, Connect my NUCLEO 64 board on PC over USB and in my computer show USB Flash drive, but I cannot open this because is in RAW format. I don't know how to view my data on MCU. 

Please help me. :D Thank you for answering. 

#massstorage #usb
7 REPLIES 7
re.wolff9
Senior
Posted on March 20, 2016 at 20:19

The flash drive is an emulated device that you can copy a firmware image on and the programmer on your board will then program that firmware image into the target chip. 

Beyond that I can't help you because I don't understand what you want to do. 

mocnikg
Associate II
Posted on March 23, 2016 at 15:34

I wish to access my data  on the flash. How can I do it? 

Can I create a txt file on MCU and then show this file on my PC, over USB. 

Posted on March 23, 2016 at 16:40

The MSC here is provided by the ST-LINK, not your target chip. The ST-LINK also provides a VCP, you could use that to transmit a stream of data via one of the USART on you target.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
mocnikg
Associate II
Posted on March 23, 2016 at 19:18

I ran an example, which was generated in STM32Cube. I connected the USB with the PA11 and PA12. I set the jumper on E5V and the device showed on my PC (Raw file system). I can see the memory map with HEX Editor.

I wish to save data fron the GPS module and access them through the USB connection.

Is there a way to access the memory on a SD card if it is connected to the MCU?

0690X00000605F1QAI.png0690X00000605NTQAY.png

dthedens
Associate II
Posted on March 23, 2016 at 20:46

I wish to access my data  on the flash. How can I do it? 

Can I create a txt file on MCU and then show this file on my PC, over USB. 

Only if the file exists in the media before you connect the MSD to the PC.

The controller firmware cannot create the file or modify the file while the MSD is connected to the PC.

The PC owns the media.   There is one master, and it is the PC.

if your data is dynamic, then choose another transport such as CDC or HID.
tsuneo
Senior
Posted on March 24, 2016 at 15:15

> the device showed on my PC (Raw file system).

 

> I wish to access my data  on the flash. How can I do it?

You may directly read the drive sectors from the MSC device to your PC, like your 010 editor / drive editor mode.

For Linux application, just open() the drive device, like this post,

http://stackoverflow.com/questions/7289453/reading-hard-disk-sectors-in-c-on-linux

For Windows, SPTI (SCSI Pass Through Interface) is available.

Send READ10 SCSI command over SPTI.

https://msdn.microsoft.com/en-us/library/ff560519%28VS.85%29.aspx

https://github.com/Microsoft/Windows-driver-samples/tree/master/storage/tools/spti

Tsuneo

mocnikg
Associate II
Posted on March 29, 2016 at 16:54

Is there a way to access the memory (over usb) on a SD card if it is connected to the MCU?