Skip to content

Commit c516495

Browse files
travis3630nordicjm
authored andcommitted
test: zephyr: add nrf7120 i2c testcase
Add zephyr i2c testcase for nrf7120 Signed-off-by: Travis Lam <[email protected]>
1 parent 2cce3b7 commit c516495

File tree

13 files changed

+258
-0
lines changed

13 files changed

+258
-0
lines changed

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -963,6 +963,7 @@
963963
/tests/zephyr/drivers/flash/negative_tests_nrf7120/ @nrfconnect/ncs-code-owners @rob-robinson-14 @Hi-Im-David @travis3630
964964
/tests/zephyr/drivers/gpio/ @nrfconnect/ncs-low-level-test
965965
/tests/zephyr/drivers/i2c/i2c_bme688/ @nrfconnect/ncs-low-level-test
966+
/tests/zephyr/drivers/i2c/i2c_nrfx_twim/ @nrfconnect/ncs-low-level-test @rob-robinson-14 @Hi-Im-David @travis3630
966967
/tests/zephyr/drivers/i2c/i2c_target_api/ @nrfconnect/ncs-low-level-test
967968
/tests/zephyr/drivers/i2s/ @nrfconnect/ncs-low-level-test
968969
/tests/zephyr/drivers/mspi/ @nrfconnect/ncs-low-level-test @nrfconnect/ncs-ll-ursus
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
CONFIG_I2C_NRFX_TWIS_BUF_SIZE=256
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
/*
8+
* SDA = P1.8 and P1.9
9+
* SCL = P1.14 and P1.15
10+
*/
11+
12+
/ {
13+
aliases {
14+
i2c-controller = &i2c21;
15+
i2c-controller-target = &i2c22;
16+
};
17+
};
18+
19+
&pinctrl {
20+
i2c21_default: i2c21_default {
21+
group1 {
22+
psels = <NRF_PSEL(TWIS_SDA, 1, 8)>,
23+
<NRF_PSEL(TWIS_SCL, 1, 14)>;
24+
bias-pull-up;
25+
};
26+
};
27+
28+
i2c21_sleep: i2c21_sleep {
29+
group1 {
30+
psels = <NRF_PSEL(TWIS_SDA, 1, 8)>,
31+
<NRF_PSEL(TWIS_SCL, 1, 14)>;
32+
low-power-enable;
33+
};
34+
};
35+
36+
i2c22_default: i2c22_default {
37+
group1 {
38+
psels = <NRF_PSEL(TWIS_SDA, 1, 9)>,
39+
<NRF_PSEL(TWIS_SCL, 1, 15)>;
40+
bias-pull-up;
41+
};
42+
};
43+
44+
i2c22_sleep: i2c22_sleep {
45+
group1 {
46+
psels = <NRF_PSEL(TWIS_SDA, 1, 9)>,
47+
<NRF_PSEL(TWIS_SCL, 1, 15)>;
48+
low-power-enable;
49+
};
50+
};
51+
};
52+
53+
&i2c21 {
54+
pinctrl-0 = <&i2c21_default>;
55+
pinctrl-1 = <&i2c21_sleep>;
56+
pinctrl-names = "default", "sleep";
57+
zephyr,concat-buf-size = <256>;
58+
status = "okay";
59+
};
60+
61+
&i2c22 {
62+
compatible = "nordic,nrf-twis";
63+
pinctrl-0 = <&i2c22_default>;
64+
pinctrl-1 = <&i2c22_sleep>;
65+
pinctrl-names = "default", "sleep";
66+
status = "okay";
67+
};

samples/zephyr/drivers/i2c/rtio_loopback/sample.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ tests:
1919
- [email protected]/nrf54ls05b/cpuapp
2020
- nrf54lv10dk/nrf54lv10a/cpuapp
2121
- [email protected]/nrf54lv10a/cpuapp
22+
- nrf7120pdk/nrf7120/cpuapp
2223
integration_platforms:
2324
- nrf54ls05dk/nrf54ls05b/cpuapp
2425
- nrf54lv10dk/nrf54lv10a/cpuapp
26+
- nrf7120pdk/nrf7120/cpuapp

scripts/ci/tags.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,6 +1689,11 @@ ci_tests_zephyr_drivers_i2c_i2c_bme688:
16891689
- nrf/tests/zephyr/drivers/i2c/i2c_bme688/
16901690
- zephyr/tests/drivers/i2c/i2c_bme688/
16911691

1692+
ci_tests_zephyr_drivers_i2c_i2c_nrfx_twim:
1693+
files:
1694+
- nrf/tests/zephyr/drivers/i2c/i2c_nrfx_twim/
1695+
- zephyr/tests/drivers/i2c/i2c_nrfx_twim/
1696+
16921697
ci_tests_zephyr_drivers_spi:
16931698
files:
16941699
- nrf/tests/zephyr/drivers/spi/
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_NRFX_TWIS22=y
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/ {
2+
aliases {
3+
i2c-slave = &i2c22;
4+
};
5+
};
6+
7+
&pinctrl {
8+
i2c21_default_alt: i2c21_default_alt {
9+
group1 {
10+
psels = <NRF_PSEL(TWIM_SDA, 1, 8)>,
11+
<NRF_PSEL(TWIM_SCL, 1, 14)>;
12+
};
13+
};
14+
15+
i2c21_sleep_alt: i2c21_sleep_alt {
16+
group1 {
17+
psels = <NRF_PSEL(TWIM_SDA, 1, 8)>,
18+
<NRF_PSEL(TWIM_SCL, 1, 14)>;
19+
low-power-enable;
20+
};
21+
};
22+
23+
i2c22_default_alt: i2c22_default_alt {
24+
group1 {
25+
/* Temporary workaround as it is currently not possible
26+
* to configure pins for TWIS with pinctrl.
27+
*/
28+
psels = <NRF_PSEL(TWIM_SDA, 1, 9)>,
29+
<NRF_PSEL(TWIM_SCL, 1, 15)>;
30+
bias-pull-up;
31+
};
32+
};
33+
34+
i2c22_sleep_alt: i2c22_sleep_alt {
35+
group1 {
36+
psels = <NRF_PSEL(TWIM_SDA, 1, 9)>,
37+
<NRF_PSEL(TWIM_SCL, 1, 15)>;
38+
low-power-enable;
39+
};
40+
};
41+
};
42+
43+
dut_twim: &i2c21 {
44+
compatible = "nordic,nrf-twim";
45+
status = "okay";
46+
pinctrl-0 = <&i2c21_default_alt>;
47+
pinctrl-1 = <&i2c21_sleep_alt>;
48+
pinctrl-names = "default", "sleep";
49+
clock-frequency = <I2C_BITRATE_STANDARD>;
50+
51+
sensor: sensor@54 {
52+
reg = <0x54>;
53+
};
54+
};
55+
56+
&i2c22 {
57+
compatible = "nordic,nrf-twis";
58+
status = "okay";
59+
pinctrl-0 = <&i2c22_default_alt>;
60+
pinctrl-1 = <&i2c22_sleep_alt>;
61+
pinctrl-names = "default", "sleep";
62+
};

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ tests:
1414
- nrf54lv10dk/nrf54lv10a/cpuapp
1515
- [email protected]/nrf54lv10a/cpuapp
1616
- nrf54lv10dk/nrf54lv10a/cpuapp/ns
17+
- nrf7120pdk/nrf7120/cpuapp
1718
integration_platforms:
1819
- nrf54ls05dk/nrf54ls05b/cpuapp
1920
- nrf54lv10dk/nrf54lv10a/cpuapp
21+
- nrf7120pdk/nrf7120/cpuapp
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
cmake_minimum_required(VERSION 3.20.0)
8+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
9+
project(i2c_nrfx_twim)
10+
11+
FILE(GLOB app_sources ${ZEPHYR_BASE}/tests/drivers/i2c/i2c_nrfx_twim/src/*.c)
12+
target_sources(app PRIVATE ${app_sources})
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
This sample extends the same-named Zephyr sample to verify it
2+
with Nordic development kits.
3+
4+
Source code and basic configuration files can be found in the corresponding folder structure in zephyr/tests/drivers/i2c/i2c_nrfx_twim.

0 commit comments

Comments
 (0)