Skip to content

Commit ba48181

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 Co-authored-by: Andreas Moltumyr <[email protected]> Signed-off-by: Eivind Jølsgard <[email protected]>
1 parent 839aa09 commit ba48181

File tree

17 files changed

+1252
-0
lines changed

17 files changed

+1252
-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: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,24 @@ extern "C" {
8181
#define BOARD_APP_UARTE_PIN_CTS NRF_PIN_PORT_TO_PIN_NUMBER(3, 0)
8282
#endif
8383

84+
/* Application LPUART 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_REQ
96+
#define BOARD_APP_LPUARTE_PIN_REQ NRF_PIN_PORT_TO_PIN_NUMBER(8, 1)
97+
#endif
98+
#ifndef BOARD_APP_LPUARTE_PIN_RDY
99+
#define BOARD_APP_LPUARTE_PIN_RDY NRF_PIN_PORT_TO_PIN_NUMBER(9, 1)
100+
#endif
101+
84102
#ifdef __cplusplus
85103
}
86104
#endif

doc/nrf-bm/drivers.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.. _drivers:
2+
3+
Drivers
4+
#######
5+
6+
In supplement to nrfx drivers, |BMlong| provides drivers for typical use cases with Nordic Semiconductor devices.
7+
If the driver you are looking for is not available below, please check the `nrfx documentation`_.
8+
9+
Only nrfx drivers and the drivers located under :file:`nrf-bm/drivers` are in the scope of the |BMshort| option.
10+
All other drivers that are included in the distribution must be ignored when working with the |BMshort| option.
11+
12+
.. toctree::
13+
:maxdepth: 2
14+
:glob:
15+
:caption: Subpages:
16+
17+
drivers/lpuarte.rst

doc/nrf-bm/drivers/lpuarte.rst

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
.. _lpuarte:
2+
3+
Low Power UART with EasyDMA (LPUARTE)
4+
#####################################
5+
6+
The Low Power UART with EasyDMA (LPUARTE) driver implements the standard UART with EasyDMA and two extra control lines for low power capabilities.
7+
The control lines allow for disabling the UART receiver during the idle period.
8+
This results in low power consumption, as you can shut down the high-frequency clock when UART is in idle state.
9+
10+
Control protocol
11+
****************
12+
13+
You can use the protocol for duplex transmission between two devices.
14+
15+
The control protocol uses two additional lines alongside the standard TX and RX lines:
16+
17+
* the *Request* line (REQ),
18+
* the *Ready* line (RDY).
19+
20+
The REQ line of the first device is connected with the RDY line of the second device.
21+
It is configured as an output and set to low.
22+
23+
The RDY line is configured as input without pull-up and the interrupt is configured to detect the transition from low to high state.
24+
25+
The driver implements the control protocol in the following way:
26+
27+
#. The transmitter initiates the transmission by calling :c:func:`bm_lpuarte_tx`.
28+
#. The driver reconfigures the REQ line to input with pull-up and enables the detection of high to low transition.
29+
#. The line is set to high due to the pull-up register, and that triggers an interrupt on the RDY line on the receiver device.
30+
#. On that interrupt, the driver starts the UART receiver.
31+
#. When the receiver is ready, the driver reconfigures the RDY line to output low.
32+
#. Then, the driver reconfigures the RDY line to input with pull-up and enables the interrupt on detection of high to low transition.
33+
#. This sequence results in a short pulse on the line, as the line goes low and high.
34+
#. The initiator detects the pulse and starts the standard UART transfer.
35+
#. When the transfer is completed, the transmitter driver reconfigures the REQ line to the initial state: output set to low.
36+
This results in a line state change.
37+
#. As the line goes low, the receiver detects the change.
38+
This indicates that the UARTE receiver can be stopped.
39+
40+
Once the receiver acknowledges the transfer, it must be capable of receiving the whole transfer until the REQ line goes down.
41+
42+
This requirement can be fulfilled in two ways:
43+
44+
* By providing a buffer of the size of the maximum packet length.
45+
* By continuously responding to the RX buffer request event.
46+
The latency of the event handling must be taken into account in that case.
47+
For example, a flash page erase on some devices might have a significant impact.
48+
49+
See :ref:`bm_lpuarte_sample` sample for the implementation of this driver.

doc/nrf-bm/links.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,4 @@
6464
.. _`nRF54L15`: https://docs.nordicsemi.com/category/nRF54L15-category
6565
.. _`nRF54L10`: https://docs.nordicsemi.com/category/nRF54L10-category
6666
.. _`nRF54L05`: https://docs.nordicsemi.com/category/nRF54L05-category
67+
.. _`nrfx documentation`: https://docs.nordicsemi.com/bundle/nrfx-apis-latest/page/index.html

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: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
config BM_SW_LPUARTE
8+
bool "Low Power UARTE using REQ/RDY lines"
9+
depends on BM_TIMER
10+
help
11+
Low Power UARTE implements UARTE API and extends standard UARTE
12+
communication with a 2-pin protocol for receiver wake-up and flow control.
13+
14+
if BM_SW_LPUARTE
15+
16+
module = BM_SW_LPUARTE
17+
module-str = Low Power UARTE
18+
source "subsys/logging/Kconfig.template.log_config"
19+
20+
endif # BM_SW_LPUARTE

0 commit comments

Comments
 (0)