Skip to content

Commit e6948df

Browse files
mib1-nordicrlubos
authored andcommitted
[nrf fromlist] tests: boards: nrf: qdec: Fix test for multiple instances
- Fixed pin configuration for nRF54L15 (QDECs can use only port 1) - Changed the way the test handles testing multiple instances to make it possible to output quadrature signal to one QDEC instance at a time. Upstream PR #: 93927 Signed-off-by: Michał Bainczyk <[email protected]>
1 parent 64d7302 commit e6948df

9 files changed

+237
-229
lines changed

tests/boards/nrf/qdec/boards/bl54l15_dvk_nrf54l15_common.dtsi

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@
55
*/
66

77
/ {
8-
aliases {
9-
qdec0 = &qdec20;
10-
qenca = &phase_a;
11-
qencb = &phase_b;
12-
};
13-
148
encoder-emulate {
159
compatible = "gpio-leds";
1610

@@ -22,6 +16,14 @@
2216
gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>;
2317
};
2418
};
19+
20+
qdec_loopbacks: loopbacks {
21+
compatible = "test-qdec-loopbacks";
22+
loopback0 {
23+
qdec = <&qdec20>;
24+
qenc-emul-gpios = <&phase_a &phase_b>;
25+
};
26+
};
2527
};
2628

2729
&pinctrl {

tests/boards/nrf/qdec/boards/bl54l15u_dvk_nrf54l15_common.dtsi

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@
55
*/
66

77
/ {
8-
aliases {
9-
qdec0 = &qdec20;
10-
qenca = &phase_a;
11-
qencb = &phase_b;
12-
};
13-
148
encoder-emulate {
159
compatible = "gpio-leds";
1610

@@ -22,6 +16,14 @@
2216
gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>;
2317
};
2418
};
19+
20+
qdec_loopbacks: loopbacks {
21+
compatible = "test-qdec-loopbacks";
22+
loopback0 {
23+
qdec = <&qdec20>;
24+
qenc-emul-gpios = <&phase_a &phase_b>;
25+
};
26+
};
2527
};
2628

2729
&pinctrl {

tests/boards/nrf/qdec/boards/nrf52840dk_nrf52840.overlay

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@
2222
};
2323
};
2424

25+
qdec_loopbacks: loopbacks {
26+
compatible = "test-qdec-loopbacks";
27+
loopback0 {
28+
qdec = <&qdec0>;
29+
qenc-emul-gpios = <&phase_a &phase_b>;
30+
};
31+
};
2532
};
2633

2734
&pinctrl {

tests/boards/nrf/qdec/boards/nrf5340dk_nrf5340_cpuapp.overlay

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44
*/
55

66
/ {
7-
aliases {
8-
qdec0 = &qdec1;
9-
qenca = &phase_a;
10-
qencb = &phase_b;
11-
};
12-
137
encoder-emulate {
148
compatible = "gpio-leds";
159
phase_a: phase_a {
@@ -21,6 +15,14 @@
2115
gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
2216
};
2317
};
18+
19+
qdec_loopbacks: loopbacks {
20+
compatible = "test-qdec-loopbacks";
21+
loopback0 {
22+
qdec = <&qdec1>;
23+
qenc-emul-gpios = <&phase_a &phase_b>;
24+
};
25+
};
2426
};
2527

2628
&pinctrl {

tests/boards/nrf/qdec/boards/nrf54h20dk_nrf54h20_cpuapp.overlay

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,12 @@
1111
*/
1212

1313
/ {
14-
aliases {
15-
qdec0 = &qdec130;
16-
qdec1 = &qdec131;
17-
qenca = &phase_a;
18-
qencb = &phase_b;
19-
qenca1 = &phase_a1;
20-
qencb1 = &phase_b1;
21-
};
22-
2314
encoder-emulate {
2415
compatible = "gpio-leds";
25-
phase_a: phase_a {
16+
phase_a0: phase_a0 {
2617
gpios = <&gpio2 9 GPIO_ACTIVE_HIGH>;
2718
};
28-
phase_b: phase_b {
19+
phase_b0: phase_b0 {
2920
gpios = <&gpio2 11 GPIO_ACTIVE_HIGH>;
3021
};
3122
phase_a1: phase_a1 {
@@ -35,6 +26,18 @@
3526
gpios = <&gpio7 1 GPIO_ACTIVE_HIGH>;
3627
};
3728
};
29+
30+
qdec_loopbacks: loopbacks {
31+
compatible = "test-qdec-loopbacks";
32+
loopback0 {
33+
qdec = <&qdec130>;
34+
qenc-emul-gpios = <&phase_a0 &phase_b0>;
35+
};
36+
loopback1 {
37+
qdec = <&qdec131>;
38+
qenc-emul-gpios = <&phase_a1 &phase_b1>;
39+
};
40+
};
3841
};
3942

4043
&pinctrl {

tests/boards/nrf/qdec/boards/nrf54l15dk_nrf54l15_common.dtsi

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,38 @@
44
*/
55

66
/* Required loopbacks
7-
* P1.8 <-> P1.9
8-
* P1.10 >-> P1.11
9-
* P2.8 <-> P2.9
10-
* P2.10 <-> P1.14
7+
* P1.8 <-> P1.9
8+
* P1.10 <-> P1.11
9+
* P1.12 <-> P1.13
10+
* P1.14 <-> P2.10
1111
*/
1212

1313
/ {
14-
aliases {
15-
qdec0 = &qdec20;
16-
qdec1 = &qdec21;
17-
qenca = &phase_a;
18-
qencb = &phase_b;
19-
qenca1 = &phase_a1;
20-
qencb1 = &phase_b1;
21-
};
22-
2314
encoder-emulate {
2415
compatible = "gpio-leds";
25-
phase_a: phase_a {
16+
phase_a0: phase_a0 {
2617
gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>;
2718
};
28-
phase_b: phase_b {
19+
phase_b0: phase_b0 {
2920
gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>;
3021
};
3122
phase_a1: phase_a1 {
32-
gpios = <&gpio2 9 GPIO_ACTIVE_HIGH>;
23+
gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>;
3324
};
3425
phase_b1: phase_b1 {
35-
gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>;
26+
gpios = <&gpio2 10 GPIO_ACTIVE_HIGH>;
27+
};
28+
};
29+
30+
qdec_loopbacks: loopbacks {
31+
compatible = "test-qdec-loopbacks";
32+
loopback0 {
33+
qdec = <&qdec20>;
34+
qenc-emul-gpios = <&phase_a0 &phase_b0>;
35+
};
36+
loopback1 {
37+
qdec = <&qdec21>;
38+
qenc-emul-gpios = <&phase_a1 &phase_b1>;
3639
};
3740
};
3841
};
@@ -55,15 +58,15 @@
5558

5659
qdec_21_pinctrl: qdec_21_pinctrl {
5760
group1 {
58-
psels = <NRF_PSEL(QDEC_A, 2, 8)>,
59-
<NRF_PSEL(QDEC_B, 2, 10)>;
61+
psels = <NRF_PSEL(QDEC_A, 1, 12)>,
62+
<NRF_PSEL(QDEC_B, 1, 14)>;
6063
};
6164
};
6265

6366
qdec_21_sleep_pinctrl: qdec_21_sleep_pinctrl {
6467
group1 {
65-
psels = <NRF_PSEL(QDEC_A, 2, 8)>,
66-
<NRF_PSEL(QDEC_B, 2, 10)>;
68+
psels = <NRF_PSEL(QDEC_A, 1, 12)>,
69+
<NRF_PSEL(QDEC_B, 1, 14)>;
6770
low-power-enable;
6871
};
6972
};

tests/boards/nrf/qdec/boards/nrf54lm20dk_nrf54lm20_common.dtsi

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@
1111
*/
1212

1313
/ {
14-
aliases {
15-
qdec0 = &qdec20;
16-
qenca = &phase_a;
17-
qencb = &phase_b;
18-
};
19-
2014
encoder-emulate {
2115
compatible = "gpio-leds";
2216
phase_a: phase_a {
@@ -26,6 +20,14 @@
2620
gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>;
2721
};
2822
};
23+
24+
qdec_loopbacks: loopbacks {
25+
compatible = "test-qdec-loopbacks";
26+
loopback0 {
27+
qdec = <&qdec20>;
28+
qenc-emul-gpios = <&phase_a &phase_b>;
29+
};
30+
};
2931
};
3032

3133
&pinctrl {
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
description: |
2+
Binding describing loopbacks required to run tests/boards/nrf/qdec test in Zephyr.
3+
4+
compatible: "test-qdec-loopbacks"
5+
6+
child-binding:
7+
description: |
8+
Binding describing a single loopback pair consisting of a QDEC device and two "gpio-leds" pins
9+
working as a quadrature encoder for the test.
10+
properties:
11+
qdec:
12+
type: phandle
13+
required: true
14+
description: Node of the QDEC device used to capture quadrature signal in the loopback.
15+
qenc-emul-gpios:
16+
type: phandles
17+
required: true
18+
description: |
19+
Children nodes of "gpio-leds" compatible used to generate quadrature signal. The first
20+
phandles outputs phase A signal, the second one outputs phase B signal.

0 commit comments

Comments
 (0)