-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
Arduino Ring Buffer is not suitable for serial interface #154
Comments
Please consider the work of @KurtE for a possible solution: hn/ginlong-solis#4 (comment) and hn/ginlong-solis#4 (comment) I'm using hn/ginlong-solis@76d81ce as a temporary workaround. |
It seems that using the SafeRingBuffer would be a viable option, since it's only a small wrapper around the RingBuffer from Arduino API. On that note, it's pretty disappointing that the API is so much different from most actual official Arduino cores (even things like Serial.printf(), which makes Arduino devs very angry when mentioned). If the wrapper adds too much overhead by using the synchronized blocks, it could be rewritten to use FreeRTOS' mutexes or semaphores instead. |
If I understand correctly, ESP32 uses this:
|
https://github.com/hn/ginlong-solis/blob/master/libretiny-ringbuffer-workaround.diff This workaround is necessary until libretiny-eu/libretiny#154 is fixed.
Libretiny uses the Arduino Ring Buffer for serial port i/o. However, the implementation is not interrupt-safe and there are no plans to change this.
This causes hard to debug problems with serial i/o. One pain point is that the Arduino Ring buffer is very error prone when used in such a situation (it uses a redundant way to store its state). And if it breaks, it will never be good again (no self-healing). You have to (in most cases) reboot the device or restart the component in question.
As far as I can (quickly) see the ESP8266 and ESP32 serial port components do not use the Arduino Ring Buffer, but implement some own 'magic' for the buffer.
I suggest replacing the Arduino Ring Buffer within the serial component with a better option (at least it should not break permanently).
The text was updated successfully, but these errors were encountered: