-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Fixes ESP32-S2 CDC Debug Logging #7284
Conversation
The good news: After applying this change, on my ESP32-S2 dev board, redirecting debug output to the USB CDC does not hang the sketch anymore. The sketch keeps running without interruption. The (tolerably) bad news: It appears that some messages are not completely flushed to the opened serial terminal, so that the strings appear truncated. However, when more data is written with the log_X functions, the rest of the apparently-truncated string is emitted before the next message appears. |
I guess that this happens only because the example has 2 tasks, writing to the CDC at the same time and one may interrupt the other while still writing the log, character by character, truncating the previous message by another task. Maybe the best way to solve it is by creating a Message Queue within the sketch and a task that consumes this queue, printing one log message at a time, in order to make sure that it will not get truncated. In this case the tasks shall enqueue the messages using a specific API, which could also sort them by some critical ordering method, for instance. |
PR Update: Investigate why function |
@SuGlider @VojtechBartoska I am experiencing a similar lockup on the latest BSP (due to What is the status of this PR in general, and the status of it making it into the next release? |
@brentru - I'll take a look and check it. But in general, I'd say that the PR is ready for review. |
I can confirm too that this helps with ESP32-S2! When is it planned to be merged? |
@SuGlider what about this PR, can it be reviewed or more work is supposed to be done on this? |
👋 Hello SuGlider, we appreciate your contribution to this project! Click to see more instructions ...
Review and merge process you can expect ...
|
@me-no-dev - Retested. The PR is necessary to use USB OTG CDC logging in ESP32-S2. |
@me-no-dev - This PR should be applied to branch master and to release/v2.x to make sure it goes to a future 2.0.15 |
Description of Change
When using ESP32-S2 with USB CDC and debug output is set also to go to the CDC (
Serial.setDebugOutput(true)
), the S2 freezes after a few line of logging.This issue only occurs with the ESP32-S2. It works fine with ESP32-S3 and CDC.
Tests scenarios
Tested with this sketch on the ESP32-S2 and ESP32-S3. IDE must set
USB CDC On Boot: "Enabled"
Related links
Fixes #6766