Esp32s2 internal USB issues

jdwrmailcom
Posts: 8
Joined: Fri Oct 23, 2020 6:47 pm

Esp32s2 internal USB issues

Postby jdwrmailcom » Tue Nov 03, 2020 9:26 pm

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!

ESP_Sprite
Posts: 4266
Joined: Thu Nov 26, 2015 4:08 am

Re: Esp32s2 internal USB issues

Postby ESP_Sprite » Wed Nov 04, 2020 1:59 am

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?


jdwrmailcom
Posts: 8
Joined: Fri Oct 23, 2020 6:47 pm

Re: Esp32s2 internal USB issues

Postby jdwrmailcom » Wed Nov 04, 2020 11:20 pm

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

ESP_Sprite
Posts: 4266
Joined: Thu Nov 26, 2015 4:08 am

Re: Esp32s2 internal USB issues

Postby ESP_Sprite » Thu Nov 05, 2020 12:29 am

What OS do you use on the PC side? What do you use to send these packets?

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

Re: Esp32s2 internal USB issues

Postby chegewara » Thu Nov 05, 2020 1:13 am

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)

jdwrmailcom
Posts: 8
Joined: Fri Oct 23, 2020 6:47 pm

Re: Esp32s2 internal USB issues

Postby jdwrmailcom » Thu Nov 05, 2020 5:56 pm

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

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

Re: Esp32s2 internal USB issues

Postby chegewara » Sun Nov 08, 2020 10:00 pm

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

jdwrmailcom
Posts: 8
Joined: Fri Oct 23, 2020 6:47 pm

Re: Esp32s2 internal USB issues

Postby jdwrmailcom » Tue Nov 10, 2020 9:25 pm

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

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

Re: Esp32s2 internal USB issues

Postby chegewara » Tue Nov 10, 2020 10:14 pm

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.

Who is online

Users browsing this forum: axellin, Baidu [Spider] and 69 guests