Skip to content

Commit 2f28886

Browse files
drivers: add lpuarte driver and sample
Add low power uarte driver and sample. Based on NCS LPUARTE driver and sample, nrfconnect/sdk-nrf/commit/d33871cc92bc50034a6d9b7bdcac94c0ff358390 Signed-off-by: Eivind Jølsgard <[email protected]>
1 parent 0155d3a commit 2f28886

File tree

14 files changed

+1177
-0
lines changed

14 files changed

+1177
-0
lines changed

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
# Drivers
3535
/drivers/clock_control/ @nrfconnect/ncs-bm
3636
/drivers/console/ @nrfconnect/ncs-bm
37+
/drivers/lpuarte/ @nrfconnect/ncs-bm
3738

3839
# Include
3940
/include/*.h @nrfconnect/ncs-bm

boards/nordic/bm_nrf54l15dk/include/board-config.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,30 @@ extern "C" {
8181
#define BOARD_APP_UARTE_PIN_CTS NRF_PIN_PORT_TO_PIN_NUMBER(3, 0)
8282
#endif
8383

84+
/* Application UART configuration */
85+
#ifndef BOARD_APP_LPUARTE_INST
86+
#define BOARD_APP_LPUARTE_INST 21
87+
#endif
88+
89+
#ifndef BOARD_APP_LPUARTE_PIN_TX
90+
#define BOARD_APP_LPUARTE_PIN_TX NRF_PIN_PORT_TO_PIN_NUMBER(11, 1)
91+
#endif
92+
#ifndef BOARD_APP_LPUARTE_PIN_RX
93+
#define BOARD_APP_LPUARTE_PIN_RX NRF_PIN_PORT_TO_PIN_NUMBER(10, 1)
94+
#endif
95+
#ifndef BOARD_APP_LPUARTE_PIN_RTS
96+
#define BOARD_APP_LPUARTE_PIN_RTS NRF_PIN_PORT_TO_PIN_NUMBER(14, 1)
97+
#endif
98+
#ifndef BOARD_APP_LPUARTE_PIN_CTS
99+
#define BOARD_APP_LPUARTE_PIN_CTS NRF_PIN_PORT_TO_PIN_NUMBER(13, 1)
100+
#endif
101+
#ifndef BOARD_APP_LPUARTE_PIN_REQ
102+
#define BOARD_APP_LPUARTE_PIN_REQ NRF_PIN_PORT_TO_PIN_NUMBER(8, 1)
103+
#endif
104+
#ifndef BOARD_APP_LPUARTE_PIN_RDY
105+
#define BOARD_APP_LPUARTE_PIN_RDY NRF_PIN_PORT_TO_PIN_NUMBER(9, 1)
106+
#endif
107+
84108
#ifdef __cplusplus
85109
}
86110
#endif

drivers/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ add_compile_options($<TARGET_PROPERTY:compiler,warning_shadow_variables>)
1010
add_subdirectory_ifdef(CONFIG_CONSOLE console)
1111
add_subdirectory_ifdef(CONFIG_CLOCK_CONTROL clock_control)
1212
add_subdirectory_ifdef(CONFIG_FLASH flash)
13+
add_subdirectory_ifdef(CONFIG_BM_SW_LPUARTE lpuarte)

drivers/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ menu "Device Drivers"
88
# zephyr-keep-sorted-start
99
rsource "console/Kconfig"
1010
rsource "flash/Kconfig"
11+
rsource "lpuarte/Kconfig"
1112
# zephyr-keep-sorted-stop
1213

1314
endmenu

drivers/lpuarte/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
zephyr_library()
7+
8+
zephyr_library_sources(lpuarte.c)

drivers/lpuarte/Kconfig

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# UART configuration
2+
3+
# Copyright (c) 2025, Nordic Semiconductor ASA
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
6+
config BM_SW_LPUARTE
7+
bool "Low Power UARTE using REQ/RDY lines"
8+
help
9+
Low power UARTE implements UARTE API and extends standard UARTE
10+
communication with 2 pins protocol for receiver wake up and flow control.
11+
12+
if BM_SW_LPUARTE
13+
14+
# Set number of event handlers used by the lpuart driver
15+
config NRFX_GPIOTE_NUM_OF_EVT_HANDLERS
16+
default 2
17+
18+
config BM_SW_LPUARTE_INIT_PRIORITY
19+
int "Initialization priority"
20+
default 45
21+
help
22+
Initialization priority within POST_KERNEL level. It should be set to
23+
a value that ensures that device is initialized later than gpio and
24+
uart devices used by this device. Default is set to be between
25+
default (KERNEL_INIT_PRIORITY_DEFAULT) and device
26+
(KERNEL_INIT_PRIORITY_DEVICE).
27+
28+
config BM_SW_LPUARTE_MAX_PACKET_SIZE
29+
int "Maximum RX packet size"
30+
default 128
31+
help
32+
If interrupt driven API is enabled then internal RX buffer of that
33+
size is created.
34+
35+
config BM_SW_LPUARTE_DEFAULT_TX_TIMEOUT
36+
int "TX Timeout in microseconds"
37+
default 1000000
38+
help
39+
Timeout is used in uart_poll_out and uart_fifo_fill (if interrupt
40+
driven API is enabled).
41+
42+
config BM_SW_LPUARTE_INT_DRIVEN
43+
bool "Enable interrupt driven API"
44+
help
45+
If enabled, then asynchronous API cannot be used
46+
47+
config BM_SW_LPUARTE_INT_DRV_TX_BUF_SIZE
48+
int "Tx buffer size"
49+
default 128
50+
depends on BM_SW_LPUARTE_INT_DRIVEN
51+
help
52+
Internal buffer of that size is created and used by uart_fifo_fill.
53+
For optimal performance it should be able to fit the longest possible
54+
packet.
55+
56+
module = BM_SW_LPUARTE
57+
module-str = low power uart
58+
source "subsys/logging/Kconfig.template.log_config"
59+
60+
endif

0 commit comments

Comments
 (0)