-
Notifications
You must be signed in to change notification settings - Fork 636
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[nrf fromtree] drivers: Extend coverage for UARTE driver
Add more test cases for UARTE driver API Signed-off-by: Bartosz Miller <[email protected]> (cherry picked from commit 211477f)
- Loading branch information
1 parent
3ae7585
commit 57a9aff
Showing
13 changed files
with
608 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
cmake_minimum_required(VERSION 3.20.0) | ||
|
||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | ||
project(uart_high_level_api) | ||
|
||
target_sources(app PRIVATE | ||
src/main.c | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# UART test configuration options | ||
# Copyright (c) 2024 Nordic Semiconductor ASA | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config DUAL_UART_TEST | ||
bool "Enable dual UART test" | ||
|
||
config SETUP_MISMATCH_TEST | ||
bool "Enable mismatched configuration in dual UART test" | ||
|
||
source "Kconfig.zephyr" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
The purpose of this test is to validate basic UART driver functions, | ||
that are not tested elsewhere. | ||
UART interrupt mode is used for the tests purpose. | ||
|
||
Hardware setup required for these tests: | ||
For single uart conviguration - UART0 TX connected to RX and CTS to RTS | ||
For dual uart configuratiom - UART0 and UART1 TXs and RXs cross-connected | ||
|
||
These test cases cover: | ||
- UART configuration, | ||
- UART error check, | ||
- UART callback setup, | ||
- Dual UART transmission with matched and mismatched configurations |
1 change: 1 addition & 0 deletions
1
tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
CONFIG_UART_NRFX_UARTE_LEGACY_SHIM=n |
32 changes: 32 additions & 0 deletions
32
tests/drivers/uart/uart_elementary/boards/nrf5340dk_nrf5340_cpuapp.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* SPDX-License-Identifier: Apache-2.0 */ | ||
|
||
&pinctrl { | ||
uart1_default_alt: uart1_default_alt { | ||
group1 { | ||
psels = <NRF_PSEL(UART_TX, 0, 4)>, | ||
<NRF_PSEL(UART_RX, 0, 5)>, | ||
<NRF_PSEL(UART_RTS, 0, 6)>, | ||
<NRF_PSEL(UART_CTS, 0, 7)>; | ||
}; | ||
}; | ||
|
||
uart1_sleep_alt: uart1_sleep_alt { | ||
group1 { | ||
psels = <NRF_PSEL(UART_TX, 0, 4)>, | ||
<NRF_PSEL(UART_RX, 0, 5)>, | ||
<NRF_PSEL(UART_RTS, 0, 6)>, | ||
<NRF_PSEL(UART_CTS, 0, 7)>; | ||
low-power-enable; | ||
}; | ||
}; | ||
}; | ||
|
||
dut: &uart1 { | ||
current-speed = <115200>; | ||
compatible = "nordic,nrf-uarte"; | ||
status = "okay"; | ||
pinctrl-0 = <&uart1_default_alt>; | ||
pinctrl-1 = <&uart1_sleep_alt>; | ||
pinctrl-names = "default", "sleep"; | ||
hw-flow-control; | ||
}; |
37 changes: 37 additions & 0 deletions
37
tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_common.dtsi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* SPDX-License-Identifier: Apache-2.0 */ | ||
|
||
&cpuapp_dma_region { | ||
status="okay"; | ||
}; | ||
|
||
&pinctrl { | ||
uart135_default_alt: uart135_default_alt { | ||
group1 { | ||
psels = <NRF_PSEL(UART_TX, 0, 6)>, | ||
<NRF_PSEL(UART_RX, 0, 7)>, | ||
<NRF_PSEL(UART_RTS, 0, 8)>, | ||
<NRF_PSEL(UART_CTS, 0, 9)>; | ||
}; | ||
}; | ||
|
||
uart135_sleep_alt: uart135_sleep_alt { | ||
group1 { | ||
psels = <NRF_PSEL(UART_TX, 0, 6)>, | ||
<NRF_PSEL(UART_RX, 0, 7)>, | ||
<NRF_PSEL(UART_RTS, 0, 8)>, | ||
<NRF_PSEL(UART_CTS, 0, 9)>; | ||
low-power-enable; | ||
}; | ||
}; | ||
}; | ||
|
||
dut: &uart135 { | ||
status = "okay"; | ||
memory-regions = <&cpuapp_dma_region>; | ||
pinctrl-0 = <&uart135_default_alt>; | ||
pinctrl-1 = <&uart135_sleep_alt>; | ||
pinctrl-names = "default", "sleep"; | ||
current-speed = <115200>; | ||
hw-flow-control; | ||
|
||
}; |
3 changes: 3 additions & 0 deletions
3
tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/* SPDX-License-Identifier: Apache-2.0 */ | ||
|
||
#include "nrf54h20dk_nrf54h20_common.dtsi" |
56 changes: 56 additions & 0 deletions
56
tests/drivers/uart/uart_elementary/boards/nrf54h20dk_nrf54h20_cpuapp_dual_uart.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* SPDX-License-Identifier: Apache-2.0 */ | ||
|
||
#include "nrf54h20dk_nrf54h20_common.dtsi" | ||
|
||
|
||
&pinctrl { | ||
uart135_default_alt: uart135_default_alt { | ||
group1 { | ||
psels = <NRF_PSEL(UART_TX, 0, 6)>, | ||
<NRF_PSEL(UART_RX, 0, 9)>; | ||
}; | ||
}; | ||
|
||
uart135_sleep_alt: uart135_sleep_alt { | ||
group1 { | ||
psels = <NRF_PSEL(UART_TX, 0, 6)>, | ||
<NRF_PSEL(UART_RX, 0, 9)>; | ||
low-power-enable; | ||
}; | ||
}; | ||
}; | ||
|
||
dut: &uart135 { | ||
status = "okay"; | ||
memory-regions = <&cpuapp_dma_region>; | ||
pinctrl-0 = <&uart135_default_alt>; | ||
pinctrl-1 = <&uart135_sleep_alt>; | ||
pinctrl-names = "default", "sleep"; | ||
current-speed = <115200>; | ||
}; | ||
|
||
&pinctrl { | ||
uart137_default_alt: uart137_default_alt { | ||
group1 { | ||
psels = <NRF_PSEL(UART_TX, 0, 8)>, | ||
<NRF_PSEL(UART_RX, 0, 7)>; | ||
}; | ||
}; | ||
|
||
uart137_sleep_alt: uart137_sleep_alt { | ||
group1 { | ||
psels = <NRF_PSEL(UART_TX, 0, 8)>, | ||
<NRF_PSEL(UART_RX, 0, 9)>; | ||
low-power-enable; | ||
}; | ||
}; | ||
}; | ||
|
||
dut_aux: &uart137 { | ||
status = "okay"; | ||
memory-regions = <&cpuapp_dma_region>; | ||
pinctrl-0 = <&uart137_default_alt>; | ||
pinctrl-1 = <&uart137_sleep_alt>; | ||
pinctrl-names = "default", "sleep"; | ||
current-speed = <115200>; | ||
}; |
31 changes: 31 additions & 0 deletions
31
tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* SPDX-License-Identifier: Apache-2.0 */ | ||
|
||
&pinctrl { | ||
uart21_default: uart21_default { | ||
group1 { | ||
psels = <NRF_PSEL(UART_TX, 1, 10)>, | ||
<NRF_PSEL(UART_RX, 1, 11)>, | ||
<NRF_PSEL(UART_RTS, 1, 8)>, | ||
<NRF_PSEL(UART_CTS, 1, 9)>; | ||
}; | ||
}; | ||
|
||
uart21_sleep: uart21_sleep { | ||
group1 { | ||
psels = <NRF_PSEL(UART_TX, 1, 10)>, | ||
<NRF_PSEL(UART_RX, 1, 11)>, | ||
<NRF_PSEL(UART_RTS, 1, 8)>, | ||
<NRF_PSEL(UART_CTS, 1, 9)>; | ||
low-power-enable; | ||
}; | ||
}; | ||
}; | ||
|
||
dut: &uart21 { | ||
status = "okay"; | ||
current-speed = <115200>; | ||
pinctrl-0 = <&uart21_default>; | ||
pinctrl-1 = <&uart21_sleep>; | ||
pinctrl-names = "default", "sleep"; | ||
hw-flow-control; | ||
}; |
51 changes: 51 additions & 0 deletions
51
tests/drivers/uart/uart_elementary/boards/nrf54l15pdk_nrf54l15_cpuapp_dual_uart.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* SPDX-License-Identifier: Apache-2.0 */ | ||
|
||
&pinctrl { | ||
uart21_default: uart21_default { | ||
group1 { | ||
psels = <NRF_PSEL(UART_TX, 1, 10)>, | ||
<NRF_PSEL(UART_RX, 1, 8)>; | ||
bias-pull-up; | ||
}; | ||
}; | ||
|
||
uart21_sleep: uart21_sleep { | ||
group1 { | ||
psels = <NRF_PSEL(UART_TX, 1, 10)>, | ||
<NRF_PSEL(UART_RX, 1, 8)>; | ||
low-power-enable; | ||
}; | ||
}; | ||
|
||
uart22_default: uart22_default { | ||
group1 { | ||
psels = <NRF_PSEL(UART_TX, 1, 9)>, | ||
<NRF_PSEL(UART_RX, 1, 11)>; | ||
bias-pull-up; | ||
}; | ||
}; | ||
|
||
uart22_sleep: uart22_sleep { | ||
group1 { | ||
psels = <NRF_PSEL(UART_TX, 1, 9)>, | ||
<NRF_PSEL(UART_RX, 1, 11)>; | ||
low-power-enable; | ||
}; | ||
}; | ||
}; | ||
|
||
dut: &uart21 { | ||
status = "okay"; | ||
current-speed = <115200>; | ||
pinctrl-0 = <&uart21_default>; | ||
pinctrl-1 = <&uart21_sleep>; | ||
pinctrl-names = "default", "sleep"; | ||
}; | ||
|
||
dut_aux: &uart22 { | ||
status = "okay"; | ||
current-speed = <115200>; | ||
pinctrl-0 = <&uart22_default>; | ||
pinctrl-1 = <&uart22_sleep>; | ||
pinctrl-names = "default", "sleep"; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CONFIG_SERIAL=y | ||
CONFIG_ZTEST=y | ||
CONFIG_TEST_USERSPACE=y | ||
CONFIG_MAIN_STACK_SIZE=2048 | ||
CONFIG_UART_USE_RUNTIME_CONFIGURE=y | ||
CONFIG_UART_INTERRUPT_DRIVEN=y |
Oops, something went wrong.