From c5931d19469013ceb5e91f2fd445b73c7bac1f30 Mon Sep 17 00:00:00 2001 From: smartinick Date: Wed, 25 Jul 2018 11:30:52 +0200 Subject: [PATCH] fix for "realtime uart" in esp32-hal-uart.c if you are doing uart stuff that depends on timing, the original code will leave you in the "blind" (Serial.availabe() reads ZERO) until 112 bytes have been received. Setting this value to 1 will cause 112 times more interrupts, but still use the buffer and not leave your code blind in regards of timing. --- cores/esp32/esp32-hal-uart.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cores/esp32/esp32-hal-uart.c b/cores/esp32/esp32-hal-uart.c index d8d132950bb..1e789144c3a 100644 --- a/cores/esp32/esp32-hal-uart.c +++ b/cores/esp32/esp32-hal-uart.c @@ -96,7 +96,8 @@ static void IRAM_ATTR _uart_isr(void *arg) void uartEnableInterrupt(uart_t* uart) { UART_MUTEX_LOCK(); - uart->dev->conf1.rxfifo_full_thrhd = 112; + //uart->dev->conf1.rxfifo_full_thrhd = 112; //original + uart->dev->conf1.rxfifo_full_thrhd = 1; //fix for "realtime" uart uart->dev->conf1.rx_tout_thrhd = 2; uart->dev->conf1.rx_tout_en = 1; uart->dev->int_ena.rxfifo_full = 1;