-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Implement buffered RX for HardwareSerial #2237
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
Can you check if |
Yeah, I check this. You're right. Always returning 128. Any chance to bump up the buffer to 256 bytes? Can't find any #define in HardwareSerial.h.. |
UART FIFO is in hardware, and it's 128 bytes. It's not possible to bump it using defines... |
I have done some thinking recently about the UART RX scheme we currently use, and I kinda lean towards returning ONLY the RX data interrupt routine and use larger buffer to store incoming uart data. |
That's a good option. Another one is to implement |
Would be very cool to have a bigger buffer.. Any chance this will be implemented the next time? :D |
serialEvent runs from the loop, no? even if run in the system context, you can have enough time between calls to overflow the buffer. Only option I see is to use a buffer and fill it with the uart interrupt. I would opt out for all-c and in-ram isr to help with speed and not trigger exceptions |
you need less than 900 micro seconds to fill the 128 bytes at 115200 baud |
Sure, ISR has to go into RAM. |
I'll get on it. 1K default good? |
I would go with the old default of 256 bytes, and add |
In connection with: esp8266#2237 esp8266#2037 esp8266#1683
Playing with Arduino EasyTransfer (https://github.com/madsci1016/Arduino-EasyTransfer), I can not run in NodeMCU (Arduino to Arduino working fine). Maybe could be related? |
What do you mean by "I can not run in NodeMCU"? You get resets or what is happening exactly? |
Great Job guys.. I was struggling with my serial to WiFi bridge.
But with your new changes I was able to increase my buffer to 512 and 1024. It works so great. Thank you for you time and efforts. Really appreciate it. -Amar |
I have 2.3.0 loaded and I can not use Serial.setRxBufferSize(1024); I thought it had been added in #2239 ? |
2.3.0 came out after this fix. Is there anyway to release this yet? I'm in a complicated position where i can't run python, git, and ardunio on the same box, but could really use this "new" feature... |
Basic Infos
Hardware
Hardware: ESP-02 + Arduino Nano
Core Version: 2.3.0
Description
The ESP is working as a Serial<->TCP bridge. Code mostly like the Telnet example.
When sending data from the Arduino Nano over Serial to the ESP I'm losing data.
When I let the ESP Send the same String to the client, everyting comes to the client.
But receiving the same string over Serial and foreward it to the clients, sometimes bytes are missing, see following picture.

It looks like a buffer overflow, because always the last bytes are missing.. But the whole message is < 256 Bytes.
I tried different baud rates from 57600 up to 500000, but the problem is always the same.
Sketch
Arduino Nano
ESP
The text was updated successfully, but these errors were encountered: