-
Notifications
You must be signed in to change notification settings - Fork 13.3k
uart: fix wdt input overrun #4536
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
Conversation
cores/esp8266/uart.c
Outdated
@@ -45,6 +45,7 @@ | |||
#include "esp8266_peri.h" | |||
#include "user_interface.h" | |||
|
|||
uint8_t uart_overrun = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would be better to put this flag inside the uart struct. Given that the uart struct is opaque, also add an api to check/clear it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
the example I provided works now, still I get
when I run ESPEasy with serial data incoming and core >2.3.0 |
|
||
// a choice has to be made here, | ||
// do we discard newest or oldest data? | ||
#if 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok with either option here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok with either action to take
I prefer discard newest data, because it keeps the data stream contiguous, but I'm ok with either option. |
HardwareSerial needs a method to expose uart_has_overrun to the user |
I will intentionally leave the old/new discard #if option choice for further reference. |
@s0170071 thanks for your feedback! |
@d-a-v The WD is triggered in WiFi.softAP(). |
@s0170071 please open a new issue with MCVE |
* uart: fix wdt on uart input overrun, expose in HardwareSerial::hasOverrun() (cherry picked from commit 6580bf3)
WDT is triggerred when uart is flooded but not read (quickly enough) by user.
Here's a fix with a message on debug console (generally same uart though).
MCVE:
A choice has to be made when receive buffer is full:
discard oldest data, or newest data ?
Current master tries to discard newest data (with the wdt bug)
This PR has the two (fixed) ways, I personally prefer discarding the oldest
(with this scheme, I may not be the last leaving among you :)
newest discarded (input is '1234567890'):
oldest discarded (input is '1234567890'):