Page 1 of 1

Esp32s2 internal USB issues

Posted: Tue Nov 03, 2020 9:26 pm
by jdwrmailcom
Hello all.
I have tried to use the internal USB in CDC mode with the TinyUsb library and I get occasional crashes in some task_wdt.c file.
Also i have problems sending packets with more than one byte size. After sending more than a couple of packets with more than one bytes the Esp32s2 stops sending any more data. It seems to receive correctly packets with more than one byte from PC.

Has anyone else used the internal USB? Maybe an Esp engineer can provide some insights?

Thanks!

Re: Esp32s2 internal USB issues

Posted: Wed Nov 04, 2020 1:59 am
by ESP_Sprite
Can you post the crash in question? Can you post your code that has issues sending only one byte? What OS do you use on the PC side?

Re: Esp32s2 internal USB issues

Posted: Wed Nov 04, 2020 6:40 pm
by chegewara

Re: Esp32s2 internal USB issues

Posted: Wed Nov 04, 2020 11:20 pm
by jdwrmailcom
The crash does not seem to reproduce now. It could be unrelated so I will report if it comes back.

The packet size issue however still bothers me.
I am actually using the example tusb_serial_device example code from the directory that chegewara mentioned. My test sends a packet of fixed data size from the PC to the Esp and then waits for the Esp to reply with the same packet. This is done in a loop.

What i found so far is that:
-sending packets of 1 and 32 bytes works.
-when sending packets of 30 bytes the Esp stops sending back the data after i receive 21 packets
-when sending packets of 15 bytes the Esp stops sending back the data after i receive 42 packets
-when sending packets of 50 bytes the Esp stops sending back the data after i receive 12 packets
-when sending packets of 64 bytes the Esp does not send back anything

Re: Esp32s2 internal USB issues

Posted: Thu Nov 05, 2020 12:29 am
by ESP_Sprite
What OS do you use on the PC side? What do you use to send these packets?

Re: Esp32s2 internal USB issues

Posted: Thu Nov 05, 2020 1:13 am
by chegewara
I am working a lot with USB device on S2 and Im not sure it is related to your issue.
I didnt try to track it down yet, but in my case tinyUSB stop working when i have some errors in handling data on host (PC). In my case i am using webusb.
When S2 stuck in USB code and i reconnect i get this message:
E (36274) TUSB:DCD: Complete but not empty: 0/64
After then S2 and USB works again.
Please try to change tinyUSB log level in menuconfig to 3:

Code: Select all

TinyUSB log level (0-3) (NEW)

Re: Esp32s2 internal USB issues

Posted: Thu Nov 05, 2020 5:56 pm
by jdwrmailcom
ESP_Sprite wrote: What OS do you use on the PC side? What do you use to send these packets?
I am using Windows 10 and a test app I made that uses the com port through the Qt5 framework.

@chegewara Thanks for the suggestion, I will try that in next tests

Re: Esp32s2 internal USB issues

Posted: Sun Nov 08, 2020 10:00 pm
by chegewara
Few months ago ive been doing some simple QT5 app that works with S2. IIRC i did tests with data size bigger than 64 without issue.
https://github.com/chegewara/QT-serial-terminal

Re: Esp32s2 internal USB issues

Posted: Tue Nov 10, 2020 9:25 pm
by jdwrmailcom
I suppose for the S2 you used the example code you mentioned previously, or some other test code?
Anyway thanks a lot! I will give it a go when I find some time

Re: Esp32s2 internal USB issues

Posted: Tue Nov 10, 2020 10:14 pm
by chegewara
jdwrmailcom wrote: I suppose for the S2 you used the example code you mentioned previously, or some other test code?
Actually i am using arduino library which i wrote, not the one from arduino-esp32.