-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Hardware USB JTAG/Serial creates lags when used. #8284
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
Comments
I've a few questions: What Arduino Core is used for measuring the FPS? Could you describe how to measure the FPS in order to allow me replicate this issue? |
@SuGlider thanks for the answer. I'm using Arduino v2.0.9. The FPS difference (between the PC pushing informations on Serial and the firmware delivering that infos to the led strip) happens when printing some info to serial with Serial.print() and no USB is connected, this cause a big lag. but the LEDs flickering when driving LEDs via USB with many Serial.read() remains... Hardware CDC should be more stable but with the Espressif implementation the TinyUSB software method seems much more stable to me. Do you have a LED strip to try it out? If yes, I can explain how to use Luciferin to reproduce the problem with easy. |
@SuGlider is there anything I can do to help you reproducing the issue? |
@sblantipodi - I have looked into the Project. I found the Congratulations for your project! It looks great and very well done!
JTAG/CDC is good whenever your device needs to upload firmware using the WEB USB LaunchPad platform. Not sure if this is the best performing interface when compared to UART or OTG (TinyUSB). The concept of ISR priority is not the right way to think an ESP32 application. I suggest using Task resources from FreeRTOS in order to make it more efficient and Real Time. Does the Flickering change if CDC/TinyUSB is used instead of CDC/JTAG? I'd suggest a few possible improvements:
|
@sblantipodi - Thinking about how to read the CDC/JTAG, an option is using This is valid for both JTAG/CDC and OTG/CDC (TinyUSB). But each one has its own event names (ARDUINO_HW_CDC_RX_EVENT / ARDUINO_USB_CDC_RX_EVENT). An example of how to use can be found at https://github.com/espressif/arduino-esp32/blob/master/libraries/USB/examples/USBSerial/USBSerial.ino Using |
Hi @SuGlider thanks for the very detailed answer, I really, really appreciate it.
Correct, setting the timeout to 0 improves the lag.
I created a dedicated high priority task, the strange thing is that it seems to create even more flickering.
If I use CDC/JTAG the flickering is crazy, I think that the answer to this can be found in the official TinyUSB site.
This improved the flickering by a very small margin, but it is a good improvement, thanks for pointing it out.
this improved the flickering a little bit more...
I implemented all the suggestions, the flickering has been reduced by a little margin but it's there and it's severe. The only things that solves the flickerin 100% is switching from CDC/JTAG to CDC/TinyUSB but this is more a workaround rather than a real solution to the problem. |
@sblantipodi please try Luciferin using the Arduino Core 3.0.0 from the master branch. It has the PR #9275 that shall fix issues with timeout while writing the USB JTAG/Serial when it is unplugged. Thanks! |
@SuGlider thanks for quoting me and for informing me about the progress on this issue. I appreciate it. |
@sblantipodi - diging into it, I found another potential issue related to delays. I think that the Luciferin test will work correctly after merging it. |
Board
Lolin ESP32-S3 mini
Device Description
Plain Lolin ESP32-S3 mini
Hardware Configuration
GPIO 16
Version
latest master (checkout manually)
IDE Name
CLION
Operating System
Windows 11
Flash frequency
80MHz
PSRAM enabled
yes
Upload speed
115200
Description
My firmware Luciferin is based on the NeoPixelBus library to control LEDs to act like an ambilight clone.
NeoPixelBus uses RMT to drive the LEDs.
When I set the board in
TinyUSB
mode I can drive the LEDs at 144 FPS without any flickering or lags.When I set the board in
USB JTAG/Serial
I can see heavy flickering even at 60FPS.The author of NeoPixelBus supposed that two things can cause this issue:
TinyUSB maybe at the same priority as the RMT ISR.
Is there anything to fix in the RMT API that can cause this flickering?
Isn't
USB JTAG/Serial
an hardware method and as such supposed to work better than the software TinyUSB method?Sketch
https://github.com/sblantipodi/glow_worm_luciferin
Debug Message
Other Steps to Reproduce
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: