Skip to content

Commit 0ebb8ff

Browse files
committed
app: Add hardware RX byte counting without hw-flow-control
If NRF91 UART is used without hw-flow-control, the RX can lose data unless hardware RX byte counting is enabled for the UART. Enable hardware RX byte counting for the selected UART(s) when hw-flow-control is not enabled. Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
1 parent 96600f4 commit 0ebb8ff

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

app/Kconfig

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,30 @@ config SM_PGPS_INJECT_FIX_DATA
334334

335335
endif # SM_GNSS
336336

337+
#
338+
# Hardware RX byte counting for UART
339+
#
340+
# Either hardware flow control OR hardware RX byte counting is required to prevent RX data loss.
341+
# When hw-flow-control is enabled in devicetree, it handles flow management efficiently.
342+
# When hw-flow-control is disabled, hardware RX byte counting is enabled to prevent data loss,
343+
# but it consumes more power due to additional timer usage.
344+
#
345+
if UART_ASYNC_API
346+
347+
config UART_0_NRF_HW_ASYNC
348+
default y if HAS_HW_NRF_UARTE0 && !$(dt_nodelabel_bool_prop,uart0,hw-flow-control)
349+
350+
config UART_0_NRF_HW_ASYNC_TIMER
351+
default 0 if HAS_HW_NRF_UARTE0 && !$(dt_nodelabel_bool_prop,uart0,hw-flow-control)
352+
353+
config UART_2_NRF_HW_ASYNC
354+
default y if HAS_HW_NRF_UARTE2 && !$(dt_nodelabel_bool_prop,uart2,hw-flow-control)
355+
356+
config UART_2_NRF_HW_ASYNC_TIMER
357+
default 2 if HAS_HW_NRF_UARTE2 && !$(dt_nodelabel_bool_prop,uart2,hw-flow-control)
358+
359+
endif # UART_ASYNC_API
360+
337361
module = SM
338362
module-str = serial modem
339363
source "$(ZEPHYR_BASE)/subsys/logging/Kconfig.template.log_config"

app/prj.conf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ CONFIG_SERIAL=y
5454
CONFIG_UART_USE_RUNTIME_CONFIGURE=y
5555
CONFIG_UART_ASYNC_API=y
5656
CONFIG_UART_INTERRUPT_DRIVEN=n
57-
CONFIG_NRFX_TIMER=y
5857

5958
# Stacks and heaps
6059
CONFIG_MAIN_STACK_SIZE=4096

0 commit comments

Comments
 (0)