Skip to content

Commit efefb74

Browse files
nika-nordicgithub-actions[bot]
authored andcommitted
[nrf fromlist] tests: boards: nrf: i2c: add twi variant
Currently only TWIM peripheral is verified against TWIS. Add new test variant to verify nRF52 TWI peripheral as well. Upstream PR #: 100805 Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no> (cherry picked from commit 06ae9be)
1 parent 2b64f0d commit efefb74

File tree

4 files changed

+87
-62
lines changed

4 files changed

+87
-62
lines changed

tests/boards/nrf/i2c/i2c_slave/boards/nrf52840dk_nrf52840.overlay

Lines changed: 1 addition & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -3,69 +3,8 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
/*
7-
* Two loopbacks are required:
8-
* P1.01 - P1.02
9-
* P1.03 - P1.04
10-
*/
11-
12-
/ {
13-
aliases {
14-
i2c-slave = &i2c1;
15-
};
16-
};
17-
18-
&pinctrl {
19-
i2c0_default_alt: i2c0_default_alt {
20-
group1 {
21-
psels = <NRF_PSEL(TWIM_SDA, 1, 1)>,
22-
<NRF_PSEL(TWIM_SCL, 1, 3)>;
23-
};
24-
};
25-
26-
i2c0_sleep_alt: i2c0_sleep_alt {
27-
group1 {
28-
psels = <NRF_PSEL(TWIM_SDA, 1, 1)>,
29-
<NRF_PSEL(TWIM_SCL, 1, 3)>;
30-
low-power-enable;
31-
};
32-
};
33-
34-
i2c1_default_alt: i2c1_default_alt {
35-
group1 {
36-
psels = <NRF_PSEL(TWIM_SDA, 1, 2)>,
37-
<NRF_PSEL(TWIM_SCL, 1, 4)>;
38-
bias-pull-up;
39-
};
40-
};
41-
42-
i2c1_sleep_alt: i2c1_sleep_alt {
43-
group1 {
44-
psels = <NRF_PSEL(TWIM_SDA, 1, 2)>,
45-
<NRF_PSEL(TWIM_SCL, 1, 4)>;
46-
low-power-enable;
47-
};
48-
};
49-
};
6+
#include "nrf52840dk_nrf52840_common.overlay"
507

518
dut_twim: &i2c0 {
529
compatible = "nordic,nrf-twim";
53-
status = "okay";
54-
pinctrl-0 = <&i2c0_default_alt>;
55-
pinctrl-1 = <&i2c0_sleep_alt>;
56-
pinctrl-names = "default", "sleep";
57-
clock-frequency = <I2C_BITRATE_STANDARD>;
58-
59-
sensor: sensor@54 {
60-
reg = <0x54>;
61-
};
62-
};
63-
64-
dut_twis: &i2c1 {
65-
compatible = "nordic,nrf-twis";
66-
status = "okay";
67-
pinctrl-0 = <&i2c1_default_alt>;
68-
pinctrl-1 = <&i2c1_sleep_alt>;
69-
pinctrl-names = "default", "sleep";
70-
clock-frequency = <I2C_BITRATE_STANDARD>;
7110
};
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*
2+
* Copyright 2025 Nordic Semiconductor ASA
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
/*
7+
* Two loopbacks are required:
8+
* P1.01 - P1.02
9+
* P1.03 - P1.04
10+
*/
11+
12+
/ {
13+
aliases {
14+
i2c-slave = &i2c1;
15+
};
16+
};
17+
18+
&pinctrl {
19+
i2c0_default_alt: i2c0_default_alt {
20+
group1 {
21+
psels = <NRF_PSEL(TWIM_SDA, 1, 1)>,
22+
<NRF_PSEL(TWIM_SCL, 1, 3)>;
23+
};
24+
};
25+
26+
i2c0_sleep_alt: i2c0_sleep_alt {
27+
group1 {
28+
psels = <NRF_PSEL(TWIM_SDA, 1, 1)>,
29+
<NRF_PSEL(TWIM_SCL, 1, 3)>;
30+
low-power-enable;
31+
};
32+
};
33+
34+
i2c1_default_alt: i2c1_default_alt {
35+
group1 {
36+
psels = <NRF_PSEL(TWIS_SDA, 1, 2)>,
37+
<NRF_PSEL(TWIS_SCL, 1, 4)>;
38+
bias-pull-up;
39+
};
40+
};
41+
42+
i2c1_sleep_alt: i2c1_sleep_alt {
43+
group1 {
44+
psels = <NRF_PSEL(TWIS_SDA, 1, 2)>,
45+
<NRF_PSEL(TWIS_SCL, 1, 4)>;
46+
low-power-enable;
47+
};
48+
};
49+
};
50+
51+
&i2c0 {
52+
status = "okay";
53+
pinctrl-0 = <&i2c0_default_alt>;
54+
pinctrl-1 = <&i2c0_sleep_alt>;
55+
pinctrl-names = "default", "sleep";
56+
clock-frequency = <I2C_BITRATE_STANDARD>;
57+
58+
sensor: sensor@54 {
59+
reg = <0x54>;
60+
};
61+
};
62+
63+
dut_twis: &i2c1 {
64+
compatible = "nordic,nrf-twis";
65+
status = "okay";
66+
pinctrl-0 = <&i2c1_default_alt>;
67+
pinctrl-1 = <&i2c1_sleep_alt>;
68+
pinctrl-names = "default", "sleep";
69+
clock-frequency = <I2C_BITRATE_STANDARD>;
70+
};
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/*
2+
* Copyright 2025 Nordic Semiconductor ASA
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
#include "nrf52840dk_nrf52840_common.overlay"
7+
8+
&i2c0 {
9+
compatible = "nordic,nrf-twi";
10+
};

tests/boards/nrf/i2c/i2c_slave/testcase.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ tests:
2424
- nrf54h20dk/nrf54h20/cpuppr
2525
- nrf54l15dk/nrf54l15/cpuapp
2626
- nrf54lm20dk/nrf54lm20a/cpuapp
27+
boards.nrf.i2c.i2c_slave.twi:
28+
platform_allow:
29+
- nrf52840dk/nrf52840
30+
integration_platforms:
31+
- nrf52840dk/nrf52840
32+
extra_args: DTC_OVERLAY_FILE="boards/nrf52840dk_nrf52840_twi.overlay"
2733
boards.nrf.i2c.i2c_slave.fast:
2834
platform_allow:
2935
- nrf52840dk/nrf52840

0 commit comments

Comments
 (0)