New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Native USB CDC hangs up on ESP32-S2 after about 320 characters #6221
Comments
@technoblogy Could you test it with the complete latest Arduino Core Version? Please let me know. Results with ESP-ROM version information - using 115200 baud for reading the boot messages
|
@SuGlider I'm not quite sure how to do this. If I download arduino-esp32-master it's not in a form that I can put in |
@technoblogy This is how it will look like: You shall see |
I installed from the development link:
Is that correct? It still seems to be version 2.0.2. |
@technoblogy These are the commands for Linux:
After cloning the master branch into To update the GitHub in you computer, just go to the |
Thanks - I'll try it. |
@SuGlider I followed your instructions which worked without error, but when I try to compile I get: fork/exec /Users/david/Documents/Arduino/hardware/espressif/esp32/tools/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++: no such file or directory I can see that file, but it's in the path: /Users/david/Documents/Arduino/hardware/espressif/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++ |
Did you also run |
Yes, and it ran without errors. |
ha! could you post a log from get.py? |
Log from get.py:
|
Ok. It seems fine. |
Complete log:
|
Try reinstall Arduino Core 2.0.2. I hope it may make it work. |
I haven't got Arduino Core 2.0.2, I'm on 1.8.13. |
I think that 1.8.13 is the version of the Arduino IDE. ESP Arduino Core 2.0.2 is the version of the Espressif Arduino Framework. You will see it when installing ESP board in the IDE. |
OK, I had deleted my ESP32 2.0.2 installation. I've reinstalled it and then got an error about esptool. I added an esptool folder containing esptool and it now compiles from ESP32 Arduino (in sketchbook). However I still get the same behaviour with the UM featherS2 board. In other words the Serial Monitor prints: 64 ie it hangs up after 320 characters and doesn't reach 512. Sorry :( |
Did you select the ESO board from |
No, I selected UM FeatherS2. I don't have an entry for ESO. What's ESO? |
Sorry, I meant ESP. You must select your board or at least the |
I'm sorry I don't yet have an ESP32-S2 Devkit board (I've got one on order). I tried with an UM Feather S2 board: I tried with an Adafruit QT Py ESP32-S2 board: I tried with an Adafruit ESP32 Feather board: So the complete latest Arduino Core Version behaves just like the 2.0.2 release version: it works on ESP32 but has Serial problems for me on ESP32-S2. |
Ok. My suggestion is to hold up to we launch Arduino 2.0.3 which will include all those fixes. Then you can try the example again and test it. In case the issue still occurs, please reopen this issue and mention my login, so I can look at it. I'll close it in this meantime. |
@SuGlider - I was going to suggest the same. Thanks - I'll report back! |
OK, good news! This morning I just received the ESP32-S2 Dev Kit I ordered (ESP32-S2 Saola 1R Dev Kit featuring ESP32-S2 WROVER), and tried this as follows: Selected ESP32 Arduino (in sketchbook) -> ESP32S2 Dev Module I also went back and checked the 2.0.2 Release version with the ESP32-S2 Dev Kit board and same settings, and this fails. Have you made changes to the Serial in 2.0.3 that might only be affecting the ESP32-S2 Dev Kit? The other thing that occurs to me is that all the ESP32-S2 boards that failed the test have a USB-C connector, whereas the ESP32-S2 Dev Kit has a USB Micro connector. Could that be significant? |
No. All changes are in the PR that I mentioned earlier. This PR applies to all the Chips.
I don't see a relationship with the type of USB connector. Maybe it has to do with the Serial-USB conversor chipset of the board. Usually the Dev Kit board comes with the CP2102 chip. I'm not sure about the board with USB-C. You can check it out in the USB log (lsusb or dmesg on Linux). |
Let me take a look at it again. |
@SuGlider I've seen that you've released version However, the problem is exactly the same as before. Sending a string of more than about 255 characters via Serial using the USB CDC causes characters to be dropped from the end. Tested on ESP32-S3 using the Shall I open a new issue for this? |
I've done some more testing, and I've found that if I insert a delay of 0.5 secs every few characters, so that I don't transmit a continuous sequence of more than about 250 characters, I can send a long file successfully without errors. So it seems that something is pausing processing every 250 or so characters, causing characters on the serial input to be lost. |
@SuGlider Can this ticket be closed as solved? Or at least we need to delete "solved" label. |
Yes, please delete "solved" label - as far as I'm concerned it's not solved. |
It works better? But is still flaky I think. Not really sure how to quantify it as I have not had time to test more. |
I need to test it again using the process described in #6221 (comment) |
I will be happy to test it again. Which version of the ESP32 core should I use? The ESP32 package in Boards Manager now only seems to offer these versions:
I'm not sure why there are no earlier versions, and why 2.0.12 and 2.0.14 have been removed from the list? |
@technoblogy you see only those because you did not add the package json in your IDE config. The packages you see are the ones which are released by Arduino.cc and have only their Nano32 board listed. |
@pillo79 I see this question asked often. Any ideas how we can improve it? |
@me-no-dev sorry about this! We are indeed currently working on simplifying the management of the official package JSON, including improving third-party package integration. |
@pillo79 I guess 2.0.15 would be a nice target to try before 3.0.0 |
@me-no-dev I have:
Sorry - I see it should now be:
|
Oh, I still only get;
|
@technoblogy the file you mentioned is a development index that only defines
(old address works as well!) |
@pillo79 OK, thanks, now I can see them all. I haven't changed that URL for at least a couple of years, and recently they all disappeared, so the policy must have been changed. Other people may have been confused by this. @me-no-dev I can't see 2.0.15 on the list. |
I see that I've already tested with 2.0.12; see: and with 3.0.0-alpha2; see: and I also reported a workaround that made the problem go away, which may help tracking down the issue: Is anything likely to have changed in 3.0.0-alpha3, so should I test that too? |
I'll investigate it again... I'll get back with some answer in a couple days. |
That would be great. Let me know if I can help. |
Issue is (re)confirmed for the USB OTG using ESP32-S2 and ESP32-S3. |
@technoblogy - I've found the root cause of this issue: as soon as the RX Buffer is full, with 256 bytes, the remaining bytes from the 512 are discarted by Buffer Overflow. This happens because the USB HOST (the PC) sends all the 512 bytes at once and the ESP32 executes the TinyUSB CDC ISR continuosly not giving FreeRTOS Scheduler time to execute the Arduino Task for the When all the 512 bytes are finally sent by the HOST, the A sollution, that depends on how the CDC data exchange is done, would be to increase the RX Buffer size with the maximum space that the USB HOST would send at once. In this case, the RX Buffer can be set to 1024 and this would solve this specific issue with the LISP code uploading sletch. A broader solution that doesn't depend on the size of the RX Buffer is to change the This broader solution is under investigation for implementation. |
@SuGlider that's great news! Unfortunately there's no size of RX Buffer that would be sufficient for every Lisp upload, so I remain hopeful that you succeed in finding the broader solution. |
Board
Adafruit QT-Py ESP32-S2
Device Description
Plain board.
Hardware Configuration
No.
Version
v2.0.2
IDE Name
Arduino IDE
Operating System
macOS 10.13.6
Flash frequency
80MHz
PSRAM enabled
yes
Upload speed
921600
Description
Entering text into the Serial Monitor causes the Serial to hang up after about 320 characters. Run the following sketch, then cut and paste all the following text (total 512 characters) into the Serial Monitor input field, and press Return:
$0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
$0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
$0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
$0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
$0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
$0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
$0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
$0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
The Serial Monitor prints:
64
128
192
256
320
ie it hangs up after 320 characters and doesn't reach 512.
NB I've implemented the patch suggested by @SuGlider from PR #6133 in Issue #6205.
Sketch
Debug Message
Other Steps to Reproduce
Also tested on UM FeatherS2 - hangs up in the same way.
Works fine on ESP32-C3 DevKit and Adafruit ESP32 Feather.
I've tried adding
Serial.setRxBufferSize(1024)
but has no effect.I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: