Skip to content

Commit c5931d1

Browse files
authored
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.
1 parent f9a382a commit c5931d1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cores/esp32/esp32-hal-uart.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ static void IRAM_ATTR _uart_isr(void *arg)
9696
void uartEnableInterrupt(uart_t* uart)
9797
{
9898
UART_MUTEX_LOCK();
99-
uart->dev->conf1.rxfifo_full_thrhd = 112;
99+
//uart->dev->conf1.rxfifo_full_thrhd = 112; //original
100+
uart->dev->conf1.rxfifo_full_thrhd = 1; //fix for "realtime" uart
100101
uart->dev->conf1.rx_tout_thrhd = 2;
101102
uart->dev->conf1.rx_tout_en = 1;
102103
uart->dev->int_ena.rxfifo_full = 1;

0 commit comments

Comments
 (0)