Skip to content

Commit 26fc172

Browse files
committed
Don't set a minimum value for rx_timeout_slab if HW timers are used
1 parent fcaa60a commit 26fc172

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

drivers/serial/uart_nrfx_uarte.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ LOG_MODULE_REGISTER(uart_nrfx_uarte, CONFIG_UART_LOG_LEVEL);
6969
#define UARTE_ANY_ASYNC 1
7070
#endif
7171

72+
#if (defined(CONFIG_UART_0_NRF_HW_ASYNC) && defined(CONFIG_UART_0_NRF_HW_ASYNC_TIMER)) || \
73+
(defined(CONFIG_UART_1_NRF_HW_ASYNC) && defined(CONFIG_UART_1_NRF_HW_ASYNC_TIMER)) || \
74+
(defined(CONFIG_UART_2_NRF_HW_ASYNC) && defined(CONFIG_UART_2_NRF_HW_ASYNC_TIMER)) || \
75+
(defined(CONFIG_UART_3_NRF_HW_ASYNC) && defined(CONFIG_UART_3_NRF_HW_ASYNC_TIMER))
76+
#define UARTE_HW_ASYNC 1
77+
#endif
78+
7279
/*
7380
* RX timeout is divided into time slabs, this define tells how many divisions
7481
* should be made. More divisions - higher timeout accuracy and processor usage.
@@ -905,9 +912,14 @@ static int uarte_nrfx_rx_enable(const struct device *dev, uint8_t *buf,
905912
* way but timeouts would always occur later than expected, most likely
906913
* after ~3 ticks.
907914
*/
915+
#ifdef UARTE_HW_ASYNC
916+
data->async->rx_timeout_slab = timeout / RX_TIMEOUT_DIV;
917+
#else
908918
data->async->rx_timeout_slab =
909919
MAX(timeout / RX_TIMEOUT_DIV,
910920
NRFX_CEIL_DIV(3 * 1000000, CONFIG_SYS_CLOCK_TICKS_PER_SEC));
921+
#endif
922+
911923

912924
data->async->rx_buf = buf;
913925
data->async->rx_buf_len = len;

0 commit comments

Comments
 (0)