Skip to content

Commit 883c370

Browse files
bjarki-andreasende-nordic
authored andcommitted
[nrf fromtree] tests: modem: backend: uart: Add fixture to test suite
Add fixture to test suite to allow for and signal that the test must be run on real hardware. Signed-off-by: Bjarki Arge Andreasen <[email protected]> (cherry picked from commit bec7789) Signed-off-by: Dominik Ermel <[email protected]>
1 parent ead6b4d commit 883c370

File tree

4 files changed

+33
-64
lines changed

4 files changed

+33
-64
lines changed
Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,11 @@
1+
/* SPDX-License-Identifier: Apache-2.0 */
2+
13
/*
2-
* Pins 2 and 3 must be connected to each other on the STMOD+1 connector to
3-
* loopback RX/TX.
4+
* The Arduino D0 and D1 must be connected to each other to loopback RX/TX.
45
*/
56

6-
/ {
7-
aliases {
8-
test-uart = &usart2;
9-
};
10-
};
11-
12-
&gpioh {
13-
misc_fixed_usart2 {
14-
gpio-hog;
15-
gpios = <13 GPIO_ACTIVE_HIGH>;
16-
output-high;
17-
};
18-
};
19-
20-
&gpdma1 {
21-
status = "okay";
22-
};
23-
24-
&usart2 {
25-
pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3 &usart2_rts_pa1 &usart2_cts_pa0>;
26-
pinctrl-names = "default";
27-
current-speed = <115200>;
28-
29-
dmas = <&gpdma1 0 27 STM32_DMA_PERIPH_TX
30-
&gpdma1 1 26 STM32_DMA_PERIPH_RX>;
7+
dut: &usart3 {
8+
dmas = <&gpdma1 0 29 STM32_DMA_PERIPH_TX
9+
&gpdma1 1 28 STM32_DMA_PERIPH_RX>;
3110
dma-names = "tx", "rx";
32-
33-
status = "okay";
3411
};
Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,31 @@
1+
/* SPDX-License-Identifier: Apache-2.0 */
2+
13
/*
2-
* Pins P1.10 and P1.11 must be connected to each other to loopback RX/TX.
4+
* Pins P0.4 and P0.5 must be connected to each other to loopback RX/TX.
35
*/
46

5-
/ {
6-
aliases {
7-
test-uart = &uart1;
8-
};
9-
};
10-
11-
&uart1 {
12-
status = "okay";
13-
current-speed = <115200>;
14-
pinctrl-0 = <&uart1_default>;
15-
pinctrl-1 = <&uart1_sleep>;
16-
hw-flow-control;
17-
pinctrl-names = "default", "sleep";
18-
};
19-
207
&pinctrl {
21-
uart1_default: uart1_default {
8+
uart1_default_alt: uart1_default_alt {
229
group1 {
23-
psels = <NRF_PSEL(UART_TX, 1, 11)>;
24-
};
25-
group2 {
26-
psels = <NRF_PSEL(UART_RX, 1, 10)>;
10+
psels = <NRF_PSEL(UART_TX, 0, 4)>,
11+
<NRF_PSEL(UART_RX, 0, 5)>;
2712
};
2813
};
2914

30-
uart1_sleep: uart1_sleep {
15+
uart1_sleep_alt: uart1_sleep_alt {
3116
group1 {
32-
psels = <NRF_PSEL(UART_TX, 1, 10)>,
33-
<NRF_PSEL(UART_RX, 1, 11)>;
17+
psels = <NRF_PSEL(UART_TX, 0, 4)>,
18+
<NRF_PSEL(UART_RX, 0, 5)>;
3419
low-power-enable;
3520
};
3621
};
3722
};
23+
24+
dut: &uart1 {
25+
compatible = "nordic,nrf-uarte";
26+
current-speed = <115200>;
27+
status = "okay";
28+
pinctrl-0 = <&uart1_default_alt>;
29+
pinctrl-1 = <&uart1_sleep_alt>;
30+
pinctrl-names = "default", "sleep";
31+
};

tests/subsys/modem/backends/uart/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
/*************************************************************************************************/
2929
/* Mock pipe */
3030
/*************************************************************************************************/
31-
static const struct device *uart = DEVICE_DT_GET(DT_ALIAS(test_uart));
31+
static const struct device *uart = DEVICE_DT_GET(DT_NODELABEL(dut));
3232
static struct modem_backend_uart uart_backend;
3333
static struct modem_pipe *pipe;
3434
K_SEM_DEFINE(receive_ready_sem, 0, 1);
Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
# Copyright (c) 2023 Trackunit Corporation
22
# SPDX-License-Identifier: Apache-2.0
33

4+
common:
5+
harness: ztest
6+
harness_config:
7+
fixture: gpio_loopback
8+
platform_allow:
9+
- b_u585i_iot02a
10+
- nrf5340dk_nrf5340_cpuapp
11+
412
tests:
513
modem.backends.uart.async:
6-
tags: modem_backend
7-
harness: ztest
8-
platform_allow:
9-
- b_u585i_iot02a
10-
- nrf5340dk_nrf5340_cpuapp
1114
extra_configs:
1215
- CONFIG_UART_ASYNC_API=y
1316

1417
modem.backends.uart.isr:
15-
tags: modem_backend
16-
harness: ztest
17-
platform_allow:
18-
- b_u585i_iot02a
19-
- nrf5340dk_nrf5340_cpuapp
2018
extra_configs:
2119
- CONFIG_UART_INTERRUPT_DRIVEN=y

0 commit comments

Comments
 (0)