Skip to content

Commit bb1a8e3

Browse files
nordic-bamirlubos
authored andcommitted
[nrf fromtree] tests: boards: nrf: qdec: Add testing with multiple QDEC instances
NRFX should support multiple QDEC devices operation. Signed-off-by: Bartosz Miller <[email protected]> (cherry picked from commit 08cc78c)
1 parent 1ed3c0d commit bb1a8e3

File tree

3 files changed

+300
-82
lines changed

3 files changed

+300
-82
lines changed

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

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,21 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6+
/* Required loopbacks
7+
* P2.08 <-> P2.09
8+
* P2.10 <-> P2.11
9+
* P1.02 <-> P1.03
10+
* P7.01 <-> P1.05
11+
*/
12+
613
/ {
714
aliases {
815
qdec0 = &qdec130;
16+
qdec1 = &qdec131;
917
qenca = &phase_a;
1018
qencb = &phase_b;
19+
qenca1 = &phase_a1;
20+
qencb1 = &phase_b1;
1121
};
1222

1323
encoder-emulate {
@@ -18,34 +28,73 @@
1828
phase_b: phase_b {
1929
gpios = <&gpio2 11 GPIO_ACTIVE_HIGH>;
2030
};
31+
phase_a1: phase_a1 {
32+
gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
33+
};
34+
phase_b1: phase_b1 {
35+
gpios = <&gpio7 1 GPIO_ACTIVE_HIGH>;
36+
};
2137
};
2238
};
2339

2440
&pinctrl {
25-
qdec_pinctrl: qdec_pinctrl {
41+
qdec_130_pinctrl: qdec_130_pinctrl {
2642
group1 {
2743
psels = <NRF_PSEL(QDEC_A, 2, 8)>,
2844
<NRF_PSEL(QDEC_B, 2, 10)>;
2945
};
3046
};
3147

32-
qdec_sleep_pinctrl: qdec_sleep_pinctrl {
48+
qdec_130_sleep_pinctrl: qdec_130_sleep_pinctrl {
3349
group1 {
3450
psels = <NRF_PSEL(QDEC_A, 2, 8)>,
3551
<NRF_PSEL(QDEC_B, 2, 10)>;
3652
low-power-enable;
3753
};
3854
};
55+
56+
qdec_131_pinctrl: qdec_131_pinctrl {
57+
group1 {
58+
psels = <NRF_PSEL(QDEC_A, 1, 3)>,
59+
<NRF_PSEL(QDEC_B, 1, 5)>;
60+
};
61+
};
62+
63+
qdec_131_sleep_pinctrl: qdec_131_sleep_pinctrl {
64+
group1 {
65+
psels = <NRF_PSEL(QDEC_A, 1, 3)>,
66+
<NRF_PSEL(QDEC_B, 1, 5)>;
67+
low-power-enable;
68+
};
69+
};
70+
};
71+
72+
&gpio1 {
73+
status = "okay";
3974
};
4075

4176
&gpio2 {
4277
status = "okay";
4378
};
4479

80+
&gpio7 {
81+
status = "okay";
82+
};
83+
4584
&qdec130 {
4685
status = "okay";
47-
pinctrl-0 = <&qdec_pinctrl>;
48-
pinctrl-1 = <&qdec_sleep_pinctrl>;
86+
pinctrl-0 = <&qdec_130_pinctrl>;
87+
pinctrl-1 = <&qdec_130_sleep_pinctrl>;
88+
pinctrl-names = "default", "sleep";
89+
steps = <127>;
90+
led-pre = <500>;
91+
zephyr,pm-device-runtime-auto;
92+
};
93+
94+
&qdec131 {
95+
status = "okay";
96+
pinctrl-0 = <&qdec_131_pinctrl>;
97+
pinctrl-1 = <&qdec_131_sleep_pinctrl>;
4998
pinctrl-names = "default", "sleep";
5099
steps = <127>;
51100
led-pre = <500>;

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

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,21 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6+
/* Required loopbacks
7+
* P1.8 <-> P1.9
8+
* P1.10 >-> P1.11
9+
* P2.8 <-> P2.9
10+
* P2.10 <-> P1.14
11+
*/
12+
613
/ {
714
aliases {
815
qdec0 = &qdec20;
16+
qdec1 = &qdec21;
917
qenca = &phase_a;
1018
qencb = &phase_b;
19+
qenca1 = &phase_a1;
20+
qencb1 = &phase_b1;
1121
};
1222

1323
encoder-emulate {
@@ -18,34 +28,69 @@
1828
phase_b: phase_b {
1929
gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>;
2030
};
31+
phase_a1: phase_a1 {
32+
gpios = <&gpio2 9 GPIO_ACTIVE_HIGH>;
33+
};
34+
phase_b1: phase_b1 {
35+
gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>;
36+
};
2137
};
2238
};
2339

2440
&pinctrl {
25-
qdec_pinctrl: qdec_pinctrl {
41+
qdec_20_pinctrl: qdec_20_pinctrl {
2642
group1 {
2743
psels = <NRF_PSEL(QDEC_A, 1, 8)>,
2844
<NRF_PSEL(QDEC_B, 1, 10)>;
2945
};
3046
};
3147

32-
qdec_sleep_pinctrl: qdec_sleep_pinctrl {
48+
qdec_20_sleep_pinctrl: qdec_20_sleep_pinctrl {
3349
group1 {
3450
psels = <NRF_PSEL(QDEC_A, 1, 8)>,
3551
<NRF_PSEL(QDEC_B, 1, 10)>;
3652
low-power-enable;
3753
};
3854
};
55+
56+
qdec_21_pinctrl: qdec_21_pinctrl {
57+
group1 {
58+
psels = <NRF_PSEL(QDEC_A, 2, 8)>,
59+
<NRF_PSEL(QDEC_B, 2, 10)>;
60+
};
61+
};
62+
63+
qdec_21_sleep_pinctrl: qdec_21_sleep_pinctrl {
64+
group1 {
65+
psels = <NRF_PSEL(QDEC_A, 2, 8)>,
66+
<NRF_PSEL(QDEC_B, 2, 10)>;
67+
low-power-enable;
68+
};
69+
};
3970
};
4071

4172
&gpio1 {
4273
status = "okay";
4374
};
4475

76+
&gpio2 {
77+
status = "okay";
78+
};
79+
4580
&qdec20 {
4681
status = "okay";
47-
pinctrl-0 = <&qdec_pinctrl>;
48-
pinctrl-1 = <&qdec_sleep_pinctrl>;
82+
pinctrl-0 = <&qdec_20_pinctrl>;
83+
pinctrl-1 = <&qdec_20_sleep_pinctrl>;
84+
pinctrl-names = "default", "sleep";
85+
steps = <127>;
86+
led-pre = <500>;
87+
zephyr,pm-device-runtime-auto;
88+
};
89+
90+
&qdec21 {
91+
status = "okay";
92+
pinctrl-0 = <&qdec_21_pinctrl>;
93+
pinctrl-1 = <&qdec_21_sleep_pinctrl>;
4994
pinctrl-names = "default", "sleep";
5095
steps = <127>;
5196
led-pre = <500>;

0 commit comments

Comments
 (0)