Skip to content

Commit 6e6cb52

Browse files
committed
Enable UART RX timeout IRQ, as well as RX IRQ, so that individual characters can be received.
1 parent 5e05469 commit 6e6cb52

File tree

1 file changed

+7
-2
lines changed
  • src/rp2_common/hardware_uart/include/hardware

1 file changed

+7
-2
lines changed

src/rp2_common/hardware_uart/include/hardware/uart.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,17 @@ static inline void uart_set_format(uart_inst_t *uart, uint data_bits, uint stop_
205205
* this function.
206206
*
207207
* \param uart UART instance. \ref uart0 or \ref uart1
208-
* \param rx_has_data If true an interrupt will be fired when the RX FIFO contain data.
208+
* \param rx_has_data If true an interrupt will be fired when the RX FIFO contains data.
209209
* \param tx_needs_data If true an interrupt will be fired when the TX FIFO needs data.
210210
*/
211211
static inline void uart_set_irq_enables(uart_inst_t *uart, bool rx_has_data, bool tx_needs_data) {
212+
// Both UARTRXINTR (RX) and UARTRTINTR (RX timeout) interrupts are
213+
// required for rx_has_data. RX asserts when >=4 characters are in the RX
214+
// FIFO (for RXIFLSEL=0). RT asserts when there are >=1 characters and no
215+
// more have been received for 32 bit periods.
212216
uart_get_hw(uart)->imsc = (bool_to_bit(tx_needs_data) << UART_UARTIMSC_TXIM_LSB) |
213-
(bool_to_bit(rx_has_data) << UART_UARTIMSC_RXIM_LSB);
217+
(bool_to_bit(rx_has_data) << UART_UARTIMSC_RXIM_LSB) |
218+
(bool_to_bit(rx_has_data) << UART_UARTIMSC_RTIM_LSB);
214219
if (rx_has_data) {
215220
// Set minimum threshold
216221
hw_write_masked(&uart_get_hw(uart)->ifls, 0 << UART_UARTIFLS_RXIFLSEL_LSB,

0 commit comments

Comments
 (0)