USB Mass Storage Class example doesn't create files

urasinov
Posts: 1
Joined: Fri Aug 25, 2023 5:57 am

USB Mass Storage Class example doesn't create files

Postby urasinov » Fri Aug 25, 2023 6:34 am

I'm trying to write files into usb flash drive attached to ESP32S2 chip.
I used this example https://github.com/espressif/esp-idf/tr ... b/host/msc
USB stick formatted to FAT32 and succesfully detected by ESP32.
Below logs from chip:

Code: Select all

Device info:
         Capacity: 3700 MB
         Sector size: 512
         Sector count: 7579007
         PID: 0x4100
         VID: 0x13FE
         iProduct: Silicon-Power4G
         iManufacturer: UFD 2.0
         iSerialNumber: 12071453019E60027B7B402CB83
I also see logs with text "Read from file: 'Hello World!'" That means file /usb/esp/test.txt was succesfully create.
But when I check content of flash drive on PC it's empty. No any files on flash drive.

I'm little bit confused about example description:
"Upon connection of USB stick, storage is mounted to Virtual filesystem." What it means. maybe something wrong with examples and writes file in internal flash of ESP?
How correctly write files to usb flash stick?

User avatar
fasani
Posts: 197
Joined: Wed Jan 30, 2019 12:00 pm
Location: Barcelona
Contact:

Re: USB Mass Storage Class example doesn't create files

Postby fasani » Tue Oct 17, 2023 1:39 pm

Try this example:

https://github.com/espressif/esp-idf/tr ... e/tusb_msc

It does create files.
But using Flash SPI I still could not copy a 48Kb image successfully.
Program source: https://github.com/vroland/epdiy/tree/s ... ice/msc-sd

copied image to USB-MSC
Image
Result after copying is finished in the Mass Storage ESP32S3
Image

Anyone has an idea about why it can happen?
epdiy collaborator | http://fasani.de Fan of Espressif MCUs and electronic design

Who is online

Users browsing this forum: Baidu [Spider], Majestic-12 [Bot] and 244 guests