Description
Board
ESP32 dev module
Device Description
Board capable of 2Mb serial speed (CH9102x)
Hardware Configuration
nothing is connected
Version
v2.0.5
IDE Name
Arduino IDE, PlatformIO
Operating System
Windows, Linux
Flash frequency
default
PSRAM enabled
no
Upload speed
default
Description
As of version 2.x I observe possible performance regression compared to version 1.x when high-speed communication is used (2 000 000 baud). We verify the integrity of the frame data to make sure the frame is complete and undamaged.
Simplified sketch and python test client provided as an attachment. 'Esp32 dev module' with CH9102x
With version 1.0.6 was working fine.
Sending 900 bytes frames without any problem to ESP32 board. The reception is confirmed.
Since version 2.x the same sketch does not work anymore, which was first reported by our users and then confirmed by us after testing. We are unable to maintain such communication, all 900 byte frames are damaged or incomplete:
None of 900 byte frames is receive undamaged and completed.
It starts to work for ~600 byte frame but with high error rate:
Sketch
Test client and sketch provided as an attachment in the description section.
Debug Message
not applicable since it's not a bug
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
- I confirm I have checked existing issues, online documentation and Troubleshooting guide.
Activity
VojtechBartoska commentedon Nov 25, 2022
Hello @awawa-dev, thanks for the issue.
I'm tagging @SuGlider who did bunch of improvements to Serial recently.
SuGlider commentedon Nov 26, 2022
@awawa-dev - Please turn on Log messages (Core Debug Level: "Verbose") in the Arduino IDE.
You shall see this message:
RX Buffer can't be resized when Serial is already running.
Change your
setup()
to:awawa-dev commentedon Nov 26, 2022
So 2.x caused that breaking change? Still it doesn't resolve the issue.

It's better for 900 byte frame but still experience degraded performance and very high error rate:
For comparison 1.0.6 could handle even 1800 byte frames:
SuGlider commentedon Nov 26, 2022
For 900, the solution is to replace
Stream::readBytes()
withHardwareSerial::read()
SuGlider commentedon Nov 26, 2022
Anyway, it doesn't work well with 1800. Let me analyze it further.
awawa-dev commentedon Nov 26, 2022
Thank you for your time and effort. I can confirm that it works for 1200 bytes frames now with usually no errors. Then it gets worse quickly if the frame is only slightly bigger.
SuGlider commentedon Nov 27, 2022
@awawa-dev
PR #7525 allows the sketch presented in this issue to run perfectly fine with no errors.
I tested it with 5000 as packet size.
awawa-dev commentedon Nov 27, 2022
Great! I will test it right away.
awawa-dev commentedon Nov 27, 2022
@SuGlider Great job 😄 I've tested your PR not only using test sketch but also my main project: I confirm everything works now perfectly. Hope this PR will be merged soon. And that along with the changes you recommended here will finally allow me to upgrade my ESP32 LED driver to Arduino ESP32 ver. 2. Because of that performance issue, it was on hold for almost a year (I'm aware that it could be difficult to detect due specific serial chip capability and large frame/speed transmission configuration)
SuGlider commentedon Nov 27, 2022
Excellent!
14 remaining items