Skip to content

Commit 8a6195e

Browse files
nordic-krchrlubos
authored andcommitted
tests: drivers: lpuart: Fix two chip test
Test which run on nrf9160 and nrf52480 was failing as uart driver is now releasing UART pins when in idle. It means that TX pin should have pull-up as otherwise it is floating and can lead to errors in the communication. Test was failing due to that. Added pull-ups to TX pins in pinctrl sleep state. Enforced pinctrl sleep state to be present (event when PM device is not used). Added detection of premature test completion which could lead to false positive. Test is now failing if too few packets are received. Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
1 parent 4aa43eb commit 8a6195e

4 files changed

Lines changed: 17 additions & 4 deletions

File tree

tests/drivers/lpuart/boards/nrf9160dk_nrf52840.overlay

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,13 @@
1818

1919
uart1_sleep_alt: uart1_sleep_alt {
2020
group1 {
21-
psels = <NRF_PSEL(UART_TX, 0, 17)>,
22-
<NRF_PSEL(UART_RX, 0, 20)>;
21+
psels = <NRF_PSEL(UART_TX, 0, 17)>;
22+
low-power-enable;
23+
bias-pull-up;
24+
};
25+
26+
group2 {
27+
psels = <NRF_PSEL(UART_RX, 0, 20)>;
2328
low-power-enable;
2429
};
2530
};

tests/drivers/lpuart/boards/nrf9160dk_nrf9160.overlay

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,13 @@
3434

3535
uart2_sleep_alt: uart2_sleep_alt {
3636
group1 {
37-
psels = <NRF_PSEL(UART_RX, 0, 17)>,
38-
<NRF_PSEL(UART_TX, 0, 18)>;
37+
psels = <NRF_PSEL(UART_TX, 0, 18)>;
38+
low-power-enable;
39+
bias-pull-up;
40+
};
41+
42+
group2 {
43+
psels = <NRF_PSEL(UART_RX, 0, 17)>;
3944
low-power-enable;
4045
};
4146
};

tests/drivers/lpuart/prj.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ CONFIG_TEST_LOGGING_DEFAULTS=n
1313
CONFIG_COUNTER=y
1414

1515
CONFIG_TEST_LPUART_TIMEOUT=10
16+
CONFIG_PINCTRL_KEEP_SLEEP_STATE=y
1617

1718
CONFIG_ASSERT=y

tests/drivers/lpuart/src/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ ZTEST(test_lpuart_stress, test_stress)
238238
k_timer_stop(&kill_timer);
239239
zassert_equal(err, 0, NULL);
240240
zassert_false(test_err, NULL);
241+
/* Detect premature kill packet. */
242+
zassert_true(rx_cnt > 100);
241243
zassert_equal(tx_req_cnt, tx_done_cnt, NULL);
242244

243245
k_msleep(100);

0 commit comments

Comments
 (0)