esp32 s2 tinyUSB

chegewara
Posts: 1395
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: 1395
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 215 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: 1395
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

Who is online

Users browsing this forum: No registered users and 5 guests