Skip to content

Commit c527a76

Browse files
committed
Set the rx full fifo ISR to trigger a little sooner. This makes the uart rx isr more robust in cases where the ISR can't trigger very fast
1 parent e97a9fa commit c527a76

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cores/esp8266/uart.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,11 @@ void uart_start_isr(uart_t* uart)
172172
if(uart == NULL || !uart->rx_enabled) {
173173
return;
174174
}
175-
USC1(uart->uart_nr) = (127 << UCFFT) | (0x02 << UCTOT) | (1 <<UCTOE );
175+
// UCFFT value is when the RX fifo full interrupt triggers. A value of 1
176+
// triggers the IRS very often. A value of 127 would not leave much time
177+
// for ISR to clear fifo before the next byte is dropped. So pick a value
178+
// in the middle.
179+
USC1(uart->uart_nr) = (100 << UCFFT) | (0x02 << UCTOT) | (1 <<UCTOE );
176180
USIC(uart->uart_nr) = 0xffff;
177181
USIE(uart->uart_nr) = (1 << UIFF) | (1 << UIFR) | (1 << UITO);
178182
ETS_UART_INTR_ATTACH(uart_isr, (void *)uart);

0 commit comments

Comments
 (0)