Skip to content

Commit 1789986

Browse files
committed
[nrf fromtree] drivers: serial: nrfx_uarte: Fix spurious RXTO event
Fast instance in nrf54h (uart120) can generate a spurious RXTO event some time after RXTO event that indicates that RX path is disabled. The time when event is generated depends on baudrate and when slower baudrates are used peripheral is disabled on time to not notice it in the test but with higher baudates issue become visible. In order to avoid spurious interrupt, RXTO interrupt is disabled during RXTO event handling and enabled when RX is enabled. This workaround is applied only for fast instance to avoid unnecessary register accesses for slower instances. Signed-off-by: Krzysztof Chruściński <[email protected]> (cherry picked from commit e235e7b)
1 parent e231189 commit 1789986

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

drivers/serial/uart_nrfx_uarte.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,6 +1165,14 @@ static int uarte_nrfx_rx_enable(const struct device *dev, uint8_t *buf,
11651165

11661166
nrf_uarte_rx_buffer_set(uarte, buf, len);
11671167

1168+
if (IS_ENABLED(UARTE_ANY_FAST_PD) && (cfg->flags & UARTE_CFG_FLAG_CACHEABLE)) {
1169+
/* Spurious RXTO event was seen on fast instance (UARTE120) thus
1170+
* RXTO interrupt is kept enabled only when RX is active.
1171+
*/
1172+
nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXTO);
1173+
nrf_uarte_int_enable(uarte, NRF_UARTE_INT_RXTO_MASK);
1174+
}
1175+
11681176
nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_ENDRX);
11691177
nrf_uarte_event_clear(uarte, NRF_UARTE_EVENT_RXSTARTED);
11701178

@@ -1637,6 +1645,12 @@ static void rxto_isr(const struct device *dev)
16371645

16381646
#ifdef CONFIG_UART_NRFX_UARTE_ENHANCED_RX
16391647
NRF_UARTE_Type *uarte = get_uarte_instance(dev);
1648+
if (IS_ENABLED(UARTE_ANY_FAST_PD) && (config->flags & UARTE_CFG_FLAG_CACHEABLE)) {
1649+
/* Spurious RXTO event was seen on fast instance (UARTE120) thus
1650+
* RXTO interrupt is kept enabled only when RX is active.
1651+
*/
1652+
nrf_uarte_int_disable(uarte, NRF_UARTE_INT_RXTO_MASK);
1653+
}
16401654
#ifdef UARTE_HAS_FRAME_TIMEOUT
16411655
nrf_uarte_shorts_disable(uarte, NRF_UARTE_SHORT_FRAME_TIMEOUT_STOPRX);
16421656
#endif

0 commit comments

Comments
 (0)