Skip to content

Commit 3552a95

Browse files
tunguyen4585Dat-NguyenDuy
authored andcommitted
samples: boards: nxp: add sample for using psi5_s driver
add sample for using psi5_s driver in S32Z270 device Signed-off-by: Tu Nguyen Van <[email protected]>
1 parent 61b20b4 commit 3552a95

File tree

2 files changed

+54
-4
lines changed

2 files changed

+54
-4
lines changed

samples/boards/nxp/s32/psi5/boards/s32z2xxdc2_s32z270_rtu0.overlay

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,23 @@
1515
input-enable;
1616
};
1717
};
18+
19+
psi5_s_0_default: psi5_s_0_default {
20+
group1 {
21+
pinmux = <PA2_PSI5_S_0_TX>, <PB7_PSI5_S_0_TX>;
22+
output-enable;
23+
};
24+
group2 {
25+
pinmux = <PA3_PSI5_S_0_RX>, <PB8_PSI5_S_0_RX>;
26+
input-enable;
27+
};
28+
};
1829
};
1930

2031
&psi5_0 {
2132
pinctrl-0 = <&psi5_0_default>;
2233
pinctrl-names = "default";
23-
status = "okay";
34+
status = "disabled";
2435
};
2536

2637
&psi5_0_ch1 {
@@ -34,7 +45,7 @@
3445
array-slot-duration-us = <1000 1000>;
3546
array-slot-start-offset-us = <0 0>;
3647
array-slot-data-length = <16 16>;
37-
status = "okay";
48+
status = "disabled";
3849
};
3950

4051
&psi5_0_ch2 {
@@ -48,5 +59,38 @@
4859
array-slot-duration-us = <1000 1000>;
4960
array-slot-start-offset-us = <0 0>;
5061
array-slot-data-length = <16 16>;
62+
status = "disabled";
63+
};
64+
65+
&psi5_s_0 {
66+
pinctrl-0 = <&psi5_s_0_default>;
67+
pinctrl-names = "default";
68+
69+
uart-baud-rate = <115200>;
70+
uart-preset-timeout = <5>;
71+
uart-tx-idle-delay-time = <0>;
72+
uart-reduced-over-sampling = <4>;
73+
uart-sampling-point = <3>;
74+
75+
status = "okay";
76+
};
77+
78+
&psi5_s_0_ch1 {
79+
init-cmd = <500>;
80+
init-acmd = <500>;
81+
target-period = <500>;
82+
counter-delay = <500>;
83+
tx-mode = "short-frame-31";
84+
slots-pay-load-size = <16 16>;
85+
status = "okay";
86+
};
87+
88+
&psi5_s_0_ch2 {
89+
init-cmd = <500>;
90+
init-acmd = <500>;
91+
target-period = <500>;
92+
counter-delay = <500>;
93+
tx-mode = "short-frame-31";
94+
slots-pay-load-size = <16 16>;
5195
status = "okay";
5296
};

samples/boards/nxp/s32/psi5/src/main.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ LOG_MODULE_REGISTER(nxp_s32_psi5_sample, LOG_LEVEL_DBG);
1111

1212
#include <zephyr/drivers/psi5/psi5.h>
1313

14+
#if DT_HAS_COMPAT_STATUS_OKAY(nxp_s32_psi5)
1415
#define PSI5_NODE DT_INST(0, nxp_s32_psi5)
16+
#else
17+
#define PSI5_NODE DT_INST(0, nxp_s32_psi5_s)
18+
#endif
1519

1620
void tx_cb(const struct device *dev, uint8_t channel_id, enum psi5_state state, void *user_data)
1721
{
@@ -33,8 +37,10 @@ int main(void)
3337

3438
psi5_start(dev, 1);
3539

36-
psi5_send(dev, 1, send_data, K_MSEC(100), tx_cb, NULL);
37-
40+
while (1) {
41+
psi5_send(dev, 1, send_data, K_MSEC(100), tx_cb, NULL);
42+
k_sleep(K_MSEC(1000));
43+
}
3844
psi5_stop(dev, 1);
3945

4046
k_sleep(K_MSEC(100));

0 commit comments

Comments
 (0)