esp32 s2 tinyUSB

chegewara
Posts: 2376
Joined: Wed Jun 14, 2017 9:00 pm

Re: esp32 s2 tinyUSB

Postby chegewara » Tue Feb 23, 2021 8:11 am

Its hard to say if its problem with cable or with OS. I am working on ubuntu, so sd card example works fine, pretty slow, but works. In other hand i tested yesterday on windows 10 virtualbox VM and there was issue in OS layer, which was resetting device every few seconds due to slow response (just guessing reason).

Stellershime
Posts: 10
Joined: Thu Feb 04, 2021 8:55 pm

Re: esp32 s2 tinyUSB

Postby Stellershime » Wed Mar 03, 2021 3:24 am

So I've played around with the code and noticed the following behavior(windows 10):

1. It really hates it when test.txt gets deleted.
a.The file doesn't delete properly. Deleting it makes it disappear until you return to the PC directory and click on the Drive directory
again, where you can see the test.txt file with a 0kb size instead of 1024 kb. Trying to open this will throw up corrupt file
messages. Subsequent runs of the code may or may not create a test.txt file that is corrupted.
b. Any subsequent connections with the usb will throw up error messages "There's a problem with this drive. Scan the drive now a fix
it." This happens when connecting to the microSD card using an SD adapter to the PC and through the USB. Before this there are
no error messages.
c. Connection through the USB becomes much more unreliable. It takes somewhat longer to connect, sometimes it doesn't.
d. these issues are seemingly fixed when reformatting the SD card through the PC interface.
e. The amount of space used as indicated in the serial monitor seems to increase with each subsequent reset. This also
results in the test.txt file being corrupt after a few resets despite the file not being deleted in the PC interface, and
this causes all the same problems above.
f. dragging a file onto the SD card and then deleting it seemed to not turn up any issues. dragging the test.txt file
onto the desktop, renaming it something else, then dragging it back on the SD card, then deleting it didn't
have any issues, so it's probably not the size or the format/syntax of test file.

2. I had issues with the USB connection dropping of it's own accord, but this only occured when I use the 5V pin of the esp32 s2 and the uart port connection as programming/power bus. Using an external 5v power source seemed to prevent this problem from happening. Using an voltmeter shows that the 5V pin produces an output below 5v. I vaguely remember in documentation that the 5v isnt really supposed to be used for power when the power is supplied through the programming port

edit: Sometimes when it doesn't connect, going into device properties reveal this message in events.

Code: Select all

Device USB\VID_303A&PID_0002\1234-5678 was not migrated due to partial or ambiguous match.

Last Device Instance Id: USB\VID_05AC&PID_12A8\00008020001344910C12002E
Class Guid: {88bae032-5a81-49f0-bc3d-a4ff138216d6}
Location Path: PCIROOT(0)#PCI(1400)#USBROOT(0)#USB(1)
Migration Rank: 0xF000FFFFFFFF0023
Present: false
Status: 0xC0000719

Code: Select all

Device USB\VID_303A&PID_0002\1234-5678 requires further installation.
edit 2: The Usb seems to almost always connect on the first connection after a reset, subsequent connections are less successful and often don't happen. If they do happen, they are much slower. The first connection is always very fast.

This is all the significant behavior i can notice so far. Will keep you posted on any more problems i run into.

chegewara
Posts: 2376
Joined: Wed Jun 14, 2017 9:00 pm

Re: esp32 s2 tinyUSB

Postby chegewara » Thu Mar 04, 2021 5:02 am

Sorry to hear you have so many issues with library and sd card example. There is for sure space to improve it.
I can only say that it works more or less, no problem to detect disc, no problem to read/write/modify files (tested on VM):
Screenshot from 2021-03-04 05-47-11.png
Screenshot from 2021-03-04 05-47-11.png (58.87 KiB) Viewed 25467 times
Stellershime wrote: "There's a problem with this drive. Scan the drive now a fix
it."
Yes, i do have it too and will try to fix it eventually.

There is couple difference between S2 and regular sd card adapters:
- it is very slow,
- there is no option to detect sd card inserted.

Stellershime
Posts: 10
Joined: Thu Feb 04, 2021 8:55 pm

Re: esp32 s2 tinyUSB

Postby Stellershime » Thu Mar 04, 2021 6:51 am

I think the problem with the test.txt file has nothing to do with your code, but rather how it's just writing several blocks of empty data, since it is just the default test example that came with the SD_test example. Maybe there's some incorrect memory handling in the function. Chances are if I just comment out that function your example would work mostly fine. It displayed the same behavior of the memory size increasing despite the test.txt file being over written in the SD_test example, and plugging in the SD adapter to PC only showed 1024kb, so something very funky is going on.

I think you are doing great work. Don't let me dampen the mood. Just wanted to share my experiences. Maybe some is relevant to you in my errors. I have very little experience and would not have a MSCSD to PC code piece otherwise.

chegewara
Posts: 2376
Joined: Wed Jun 14, 2017 9:00 pm

Re: esp32 s2 tinyUSB

Postby chegewara » Thu Mar 04, 2021 9:12 am

No problem. Can we continue on github with this issue?

Stellershime
Posts: 10
Joined: Thu Feb 04, 2021 8:55 pm

Re: esp32 s2 tinyUSB

Postby Stellershime » Thu Mar 04, 2021 6:25 pm

Will do

agt_mipt
Posts: 1
Joined: Sat Jul 23, 2022 3:30 pm

Re: esp32 s2 tinyUSB

Postby agt_mipt » Sat Jul 23, 2022 3:58 pm

Hi! thanks for developing this library. I hope to use it in my project, but I'm faced with 2 problems:
1. In ramdisk example from EspTinyUSB-master\examples\device\msc\ramdisk\:
1.1. I get USB drive with capacity 1 617 408 bytes regardless of BLOCK_COUNT size.
1.2. When I write any file it completes successfully at around 500kB/s, but reading the content back I get all 0 (nulls) in file contents. I get the same disk in SD example and the same nulls in file content.
1.3 The disk has FIRMWARE.BIN of around 300kB. It is not all NULLs, it seems to be really an executable code, you can find literal strings from executable code here like "This is tinyusb's MassStorage Class demo".
2. I've seen that the SD speed is around 500 kB/s, is there any chance for a higher throughput? ESP32 can read from SD at multiple MB/s, and USB shouldn't be a limiting factor.

I'm using S2 Mini V1.0.0 ESP32-S2 from Ali, Windows 10, Arduino IDE 1.8.14 and latest ESP board package v2.0.4.

ADBensi
Posts: 2
Joined: Tue Dec 06, 2022 7:27 pm

Re: esp32 s2 tinyUSB

Postby ADBensi » Tue Dec 06, 2022 7:54 pm

Stellershime wrote:
Thu Mar 04, 2021 6:51 am
I think the problem with the test.txt file has nothing to do with your code, but rather how it's just writing several blocks of empty data, since it is just the default test example that came with the SD_test example. Maybe there's some incorrect memory handling in the function. Chances are if I just comment out that function your example would work mostly fine. It displayed the same behavior of the memory size increasing despite the test.txt file being over written in the SD_test example, and plugging in the SD adapter to PC only showed 1024kb, so something very funky is going on.

I think you are doing great work. Don't let me dampen the mood. Just wanted to share my experiences. Maybe some is relevant to you in my errors. I have very little experience and would not have a MSCSD to PC code piece otherwise.
chegewara,
The new esp32-usb-v2 (esp32-s2 with tinyUSB V1 or V2) is able to generate a WAV file in the ramdisk and update it automatically? Also, is there an option to not show the FIRMWARE.BIN file in randisk when mounted?

Please, did You can show how to generate files in memory?

Thanks a lot for the V2 review, it's really an extensive work..

ADBensi
Posts: 2
Joined: Tue Dec 06, 2022 7:27 pm

Re: esp32 s2 tinyUSB

Postby ADBensi » Tue Dec 06, 2022 8:27 pm

agt_mipt wrote:
Sat Jul 23, 2022 3:58 pm
Hi! thanks for developing this library. I hope to use it in my project, but I'm faced with 2 problems:
1. In ramdisk example from EspTinyUSB-master\examples\device\msc\ramdisk\:
1.1. I get USB drive with capacity 1 617 408 bytes regardless of BLOCK_COUNT size.
1.2. When I write any file it completes successfully at around 500kB/s, but reading the content back I get all 0 (nulls) in file contents. I get the same disk in SD example and the same nulls in file content.
1.3 The disk has FIRMWARE.BIN of around 300kB. It is not all NULLs, it seems to be really an executable code, you can find literal strings from executable code here like "This is tinyusb's MassStorage Class demo".
2. I've seen that the SD speed is around 500 kB/s, is there any chance for a higher throughput? ESP32 can read from SD at multiple MB/s, and USB shouldn't be a limiting factor.

I'm using S2 Mini V1.0.0 ESP32-S2 from Ali, Windows 10, Arduino IDE 1.8.14 and latest ESP board package v2.0.4.
agt_mipt, I am trying ESP32-S2 with ramdisk too. A very low rate compared to the initial test of 4MB/s
Did You see this:

// MSC Buffer size of Device Mass storage
#define CFG_TUD_MSC_EP_BUFSIZE 4096

https://github.com/hathach/tinyusb/issues/488

Do you know how to generate a new file and update it through the loop?

Who is online

Users browsing this forum: No registered users and 7 guests