Skip to content

Commit 52ea3d7

Browse files
nordic-baminordicjm
authored andcommitted
tests: drivers: i2c: Add test for MLTPAN-105
Verify MLTPAN-105 workaorund implementation I2C transaction cannot recover from TWIM reset Signed-off-by: Bartosz Miller <[email protected]>
1 parent 90f9611 commit 52ea3d7

10 files changed

+544
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
9+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
10+
11+
project(i2c_pan)
12+
13+
target_sources(app PRIVATE src/main.c)
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/ {
2+
aliases {
3+
i2c-slave = &i2c1;
4+
};
5+
};
6+
7+
&pinctrl {
8+
i2c0_default_alt: i2c0_default_alt {
9+
group1 {
10+
psels = <NRF_PSEL(TWIM_SDA, 1, 1)>,
11+
<NRF_PSEL(TWIM_SCL, 1, 3)>;
12+
};
13+
};
14+
15+
i2c0_sleep_alt: i2c0_sleep_alt {
16+
group1 {
17+
psels = <NRF_PSEL(TWIM_SDA, 1, 1)>,
18+
<NRF_PSEL(TWIM_SCL, 1, 3)>;
19+
low-power-enable;
20+
};
21+
};
22+
23+
i2c1_default_alt: i2c1_default_alt {
24+
group1 {
25+
psels = <NRF_PSEL(TWIS_SDA, 1, 2)>,
26+
<NRF_PSEL(TWIS_SCL, 1, 4)>;
27+
bias-pull-up;
28+
};
29+
};
30+
31+
i2c1_sleep_alt: i2c1_sleep_alt {
32+
group1 {
33+
psels = <NRF_PSEL(TWIS_SDA, 1, 2)>,
34+
<NRF_PSEL(TWIS_SCL, 1, 4)>;
35+
low-power-enable;
36+
};
37+
};
38+
};
39+
40+
dut_twim: &i2c0 {
41+
compatible = "nordic,nrf-twim";
42+
status = "okay";
43+
pinctrl-0 = <&i2c0_default_alt>;
44+
pinctrl-1 = <&i2c0_sleep_alt>;
45+
pinctrl-names = "default", "sleep";
46+
47+
sensor: sensor@54 {
48+
reg = <0x54>;
49+
};
50+
};
51+
52+
53+
dut_twis: &i2c1 {
54+
compatible = "nordic,nrf-twis";
55+
status = "okay";
56+
pinctrl-0 = <&i2c1_default_alt>;
57+
pinctrl-1 = <&i2c1_sleep_alt>;
58+
pinctrl-names = "default", "sleep";
59+
};
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/ {
2+
aliases {
3+
i2c-slave = &i2c2;
4+
};
5+
};
6+
7+
&pinctrl {
8+
i2c1_default_alt: i2c1_default_alt {
9+
group1 {
10+
psels = <NRF_PSEL(TWIM_SDA, 0, 4)>,
11+
<NRF_PSEL(TWIM_SCL, 0, 6)>;
12+
};
13+
};
14+
15+
i2c1_sleep_alt: i2c1_sleep_alt {
16+
group1 {
17+
psels = <NRF_PSEL(TWIM_SDA, 0, 4)>,
18+
<NRF_PSEL(TWIM_SCL, 0, 6)>;
19+
low-power-enable;
20+
};
21+
};
22+
23+
i2c2_default_alt: i2c2_default_alt {
24+
group1 {
25+
psels = <NRF_PSEL(TWIS_SDA, 0, 5)>,
26+
<NRF_PSEL(TWIS_SCL, 0, 7)>;
27+
bias-pull-up;
28+
};
29+
};
30+
31+
i2c2_sleep_alt: i2c2_sleep_alt {
32+
group1 {
33+
psels = <NRF_PSEL(TWIS_SDA, 0, 5)>,
34+
<NRF_PSEL(TWIS_SCL, 0, 7)>;
35+
low-power-enable;
36+
};
37+
};
38+
};
39+
40+
dut_twim: &i2c1 {
41+
compatible = "nordic,nrf-twim";
42+
status = "okay";
43+
pinctrl-0 = <&i2c1_default_alt>;
44+
pinctrl-1 = <&i2c1_sleep_alt>;
45+
pinctrl-names = "default", "sleep";
46+
47+
sensor: sensor@54 {
48+
reg = <0x54>;
49+
};
50+
};
51+
52+
dut_twis: &i2c2 {
53+
compatible = "nordic,nrf-twis";
54+
pinctrl-0 = <&i2c2_default_alt>;
55+
pinctrl-1 = <&i2c2_sleep_alt>;
56+
pinctrl-names = "default", "sleep";
57+
};
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/ {
2+
aliases {
3+
i2c-slave = &i2c131;
4+
};
5+
};
6+
7+
&pinctrl {
8+
i2c130_default_alt: i2c130_default_alt {
9+
group1 {
10+
psels = <NRF_PSEL(TWIM_SDA, 2, 8)>,
11+
<NRF_PSEL(TWIM_SCL, 1, 2)>;
12+
};
13+
};
14+
15+
i2c130_sleep_alt: i2c130_sleep_alt {
16+
group1 {
17+
psels = <NRF_PSEL(TWIM_SDA, 2, 8)>,
18+
<NRF_PSEL(TWIM_SCL, 1, 2)>;
19+
low-power-enable;
20+
};
21+
};
22+
23+
i2c131_default_alt: i2c131_default_alt {
24+
group1 {
25+
psels = <NRF_PSEL(TWIM_SDA, 2, 9)>,
26+
<NRF_PSEL(TWIM_SCL, 1, 3)>;
27+
bias-pull-up;
28+
};
29+
};
30+
31+
i2c131_sleep_alt: i2c131_sleep_alt {
32+
group1 {
33+
psels = <NRF_PSEL(TWIM_SDA, 2, 9)>,
34+
<NRF_PSEL(TWIM_SCL, 1, 3)>;
35+
low-power-enable;
36+
};
37+
};
38+
};
39+
40+
dut_twim: &i2c130 {
41+
compatible = "nordic,nrf-twim";
42+
status = "okay";
43+
pinctrl-0 = <&i2c130_default_alt>;
44+
pinctrl-1 = <&i2c130_sleep_alt>;
45+
pinctrl-names = "default", "sleep";
46+
memory-regions = <&cpuapp_dma_region>;
47+
zephyr,concat-buf-size = <512>;
48+
49+
sensor: sensor@54 {
50+
reg = <0x54>;
51+
};
52+
};
53+
54+
dut_twis: &i2c131 {
55+
compatible = "nordic,nrf-twis";
56+
status = "okay";
57+
pinctrl-0 = <&i2c131_default_alt>;
58+
pinctrl-1 = <&i2c131_sleep_alt>;
59+
pinctrl-names = "default", "sleep";
60+
memory-regions = <&cpuapp_dma_region>;
61+
};
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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, 12)>;
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, 12)>;
19+
low-power-enable;
20+
};
21+
};
22+
23+
i2c22_default_alt: i2c22_default_alt {
24+
group1 {
25+
psels = <NRF_PSEL(TWIS_SDA, 1, 9)>,
26+
<NRF_PSEL(TWIS_SCL, 1, 13)>;
27+
bias-pull-up;
28+
};
29+
};
30+
31+
i2c22_sleep_alt: i2c22_sleep_alt {
32+
group1 {
33+
psels = <NRF_PSEL(TWIS_SDA, 1, 9)>,
34+
<NRF_PSEL(TWIS_SCL, 1, 13)>;
35+
low-power-enable;
36+
};
37+
};
38+
};
39+
40+
dut_twim: &i2c21 {
41+
compatible = "nordic,nrf-twim";
42+
status = "okay";
43+
pinctrl-0 = <&i2c21_default_alt>;
44+
pinctrl-1 = <&i2c21_sleep_alt>;
45+
pinctrl-names = "default", "sleep";
46+
47+
sensor: sensor@54 {
48+
reg = <0x54>;
49+
};
50+
};
51+
52+
dut_twis: &i2c22 {
53+
compatible = "nordic,nrf-twis";
54+
status = "okay";
55+
pinctrl-0 = <&i2c22_default_alt>;
56+
pinctrl-1 = <&i2c22_sleep_alt>;
57+
pinctrl-names = "default", "sleep";
58+
};
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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, 12)>;
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, 12)>;
19+
low-power-enable;
20+
};
21+
};
22+
23+
i2c22_default_alt: i2c22_default_alt {
24+
group1 {
25+
psels = <NRF_PSEL(TWIS_SDA, 1, 9)>,
26+
<NRF_PSEL(TWIS_SCL, 1, 13)>;
27+
bias-pull-up;
28+
};
29+
};
30+
31+
i2c22_sleep_alt: i2c22_sleep_alt {
32+
group1 {
33+
psels = <NRF_PSEL(TWIS_SDA, 1, 9)>,
34+
<NRF_PSEL(TWIS_SCL, 1, 13)>;
35+
low-power-enable;
36+
};
37+
};
38+
};
39+
40+
dut_twim: &i2c21 {
41+
compatible = "nordic,nrf-twim";
42+
status = "okay";
43+
pinctrl-0 = <&i2c21_default_alt>;
44+
pinctrl-1 = <&i2c21_sleep_alt>;
45+
pinctrl-names = "default", "sleep";
46+
47+
sensor: sensor@54 {
48+
reg = <0x54>;
49+
};
50+
};
51+
52+
dut_twis: &i2c22 {
53+
compatible = "nordic,nrf-twis";
54+
status = "okay";
55+
pinctrl-0 = <&i2c22_default_alt>;
56+
pinctrl-1 = <&i2c22_sleep_alt>;
57+
pinctrl-names = "default", "sleep";
58+
};
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/ {
2+
aliases {
3+
i2c-slave = &i2c21;
4+
};
5+
};
6+
7+
&pinctrl {
8+
i2c20_default_alt: i2c20_default_alt {
9+
group1 {
10+
psels = <NRF_PSEL(TWIM_SDA, 1, 0)>,
11+
<NRF_PSEL(TWIM_SCL, 1, 2)>;
12+
};
13+
};
14+
15+
i2c20_sleep_alt: i2c20_sleep_alt {
16+
group1 {
17+
psels = <NRF_PSEL(TWIM_SDA, 1, 0)>,
18+
<NRF_PSEL(TWIM_SCL, 1, 2)>;
19+
low-power-enable;
20+
};
21+
};
22+
23+
i2c21_default_alt: i2c21_default_alt {
24+
group1 {
25+
psels = <NRF_PSEL(TWIS_SDA, 1, 1)>,
26+
<NRF_PSEL(TWIS_SCL, 1, 3)>;
27+
bias-pull-up;
28+
};
29+
};
30+
31+
i2c21_sleep_alt: i2c21_sleep_alt {
32+
group1 {
33+
psels = <NRF_PSEL(TWIS_SDA, 1, 1)>,
34+
<NRF_PSEL(TWIS_SCL, 1, 3)>;
35+
low-power-enable;
36+
};
37+
};
38+
};
39+
40+
dut_twim: &i2c20 {
41+
compatible = "nordic,nrf-twim";
42+
status = "okay";
43+
pinctrl-0 = <&i2c20_default_alt>;
44+
pinctrl-1 = <&i2c20_sleep_alt>;
45+
pinctrl-names = "default", "sleep";
46+
47+
sensor: sensor@54 {
48+
reg = <0x54>;
49+
};
50+
};
51+
52+
dut_twis: &i2c21 {
53+
compatible = "nordic,nrf-twis";
54+
status = "okay";
55+
pinctrl-0 = <&i2c21_default_alt>;
56+
pinctrl-1 = <&i2c21_sleep_alt>;
57+
pinctrl-names = "default", "sleep";
58+
};

tests/drivers/i2c/i2c_pan/prj.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
CONFIG_I2C=y
2+
CONFIG_NRFX_TWIS=y
3+
4+
CONFIG_ZTEST=y

0 commit comments

Comments
 (0)