Skip to content

Commit 5206add

Browse files
c1728p9pan-
authored andcommitted
Fix intermittent lockup in echo test
The NRF5x driver transmits a byte by writing it to the uart data register and then waiting for the TXRDY event indicating that this byte was sent. If another UART interrupt comes in at the right time the the UART ISR handler will process and clear the TXRDY event, even though this interrupt is not enabled. This causes serial_putc to get stuck waiting on an already cleared TXRDY. This patch fixing the lockup by preventing the UART ISR from handling the TXRDY event if this interrupt is not enabled.
1 parent 1f53752 commit 5206add

File tree

1 file changed

+2
-1
lines changed
  • hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/sdk/drivers_nrf/uart

1 file changed

+2
-1
lines changed

hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/sdk/drivers_nrf/uart/nrf_drv_uart.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,8 @@ __STATIC_INLINE void uart_irq_handler()
765765
}
766766
}
767767

768-
if (nrf_uart_event_check(NRF_UART0, NRF_UART_EVENT_TXDRDY))
768+
if (nrf_uart_int_enable_check(NRF_UART0, NRF_UART_INT_MASK_TXDRDY) &&
769+
nrf_uart_event_check(NRF_UART0, NRF_UART_EVENT_TXDRDY))
769770
{
770771
if (m_cb.tx_counter < (uint16_t) m_cb.tx_buffer_length)
771772
{

0 commit comments

Comments
 (0)