Skip to content

Commit c6a88c2

Browse files
committed
samples: drivers: mbox: enable run on s32z
The hardware MRU on SoC S32Z supports ping-pong loopback data on a MBOX channel within one core. The expected received data must match the sent data when running loopback tests Signed-off-by: Cong Nguyen Huu <cong.nguyenhuu@nxp.com>
1 parent 330eb96 commit c6a88c2

File tree

5 files changed

+91
-3
lines changed

5 files changed

+91
-3
lines changed

samples/drivers/mbox_data/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ if(CONFIG_BOARD_MIMXRT1170_EVK_MIMXRT1176_CM7 OR
1414
CONFIG_BOARD_FRDM_MCXN947_MCXN947_CPU0 OR
1515
CONFIG_BOARD_MCX_N9XX_EVK_MCXN947_CPU0 OR
1616
CONFIG_BOARD_MIMXRT1180_EVK_MIMXRT1189_CM33 OR
17-
CONFIG_BOARD_LPCXPRESSO55S69_LPC55S69_CPU0)
17+
CONFIG_BOARD_LPCXPRESSO55S69_LPC55S69_CPU0 OR
18+
CONFIG_BOARD_S32Z2XXDC2)
1819
message(STATUS "${BOARD}${BOARD_QUALIFIERS} compile as Main in this sample")
1920
else()
2021
message(FATAL_ERROR "${BOARD}${BOARD_QUALIFIERS} is not supported for this sample")

samples/drivers/mbox_data/README.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ It can be used only with mbox driver which supports data transfer mode.
1313
Sample will ping-pong up to 4 bytes of data between two cores via two mbox channels.
1414
After each core receives data, it increments it by one and sends it back to other core.
1515

16+
Sample also supports ping-pong loopback data on a mbox channel within one core,
17+
if the hardware allows (eg. Hardware MRU on SoC S32Z).
18+
1619
Building and Running
1720
********************
1821

@@ -54,6 +57,14 @@ Building the application for frdm_mcxn947/mcxn947/cpu0
5457
:goals: debug
5558
:west-args: --sysbuild
5659

60+
Building the application for the test loopback, example for s32z2xxdc2/s32z270/rtu0
61+
===================================================================================
62+
63+
.. zephyr-app-commands::
64+
:zephyr-app: samples/drivers/mbox_data/
65+
:board: s32z2xxdc2/s32z270/rtu0
66+
:goals: build flash
67+
5768
Sample Output
5869
=============
5970

@@ -102,3 +113,20 @@ serial port, one is the main core another is the remote core:
102113
Server receive (on channel 3) value: 98
103114
Server send (on channel 2) value: 99
104115
mbox_data Server demo ended.
116+
117+
Results from running the test loopback, example for s32z2xxdc2/s32z270/rtu0:
118+
119+
.. code-block:: console
120+
121+
*** Booting Zephyr OS build v4.1.0-3644-ga4ee89a96597 ***
122+
mbox_data Client demo started
123+
Client send (on channel 0) value: 0
124+
Client received (on channel 0) value: 0
125+
Client send (on channel 0) value: 1
126+
Client received (on channel 0) value: 1
127+
...
128+
Client send (on channel 0) value: 98
129+
Client received (on channel 0) value: 98
130+
Client send (on channel 0) value: 99
131+
Client received (on channel 0) value: 99
132+
mbox_data Client demo ended
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright 2025 NXP
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
mbox-consumer {
9+
compatible = "vnd,mbox-consumer";
10+
mboxes = <&mru0 0>, <&mru0 0>;
11+
mbox-names = "tx", "rx";
12+
};
13+
};
14+
15+
&mru0 {
16+
rx-channels = <1>;
17+
status = "okay";
18+
};
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright 2025 NXP
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
mbox-consumer {
9+
compatible = "vnd,mbox-consumer";
10+
mboxes = <&mru4 0>, <&mru4 0>;
11+
mbox-names = "tx", "rx";
12+
};
13+
};
14+
15+
&mru4 {
16+
rx-channels = <1>;
17+
status = "okay";
18+
};

samples/drivers/mbox_data/sample.yaml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
sample:
22
name: MBOX Data IPC sample
33
common:
4-
sysbuild: true
54
tags: mbox
5+
filter: dt_compat_enabled("vnd,mbox-consumer")
66
tests:
77
sample.drivers.mbox_data.real_hw:
8-
filter: dt_compat_enabled("vnd,mbox-consumer")
8+
sysbuild: true
99
integration_platforms:
1010
- mimxrt1160_evk/mimxrt1166/cm7
1111
- lpcxpresso55s69/lpc55s69/cpu0
@@ -23,3 +23,26 @@ tests:
2323
- "Client received .+ value: 97"
2424
- "Client send .+ value: 98"
2525
- "Client received .+ value: 99"
26+
sample.drivers.mbox_data.loopback:
27+
platform_allow:
28+
- s32z2xxdc2/s32z270/rtu0
29+
- s32z2xxdc2/s32z270/rtu1
30+
- s32z2xxdc2@D/s32z270/rtu0
31+
- s32z2xxdc2@D/s32z270/rtu1
32+
harness: console
33+
harness_config:
34+
type: multi_line
35+
ordered: false
36+
regex:
37+
- "Client send .+ value: 0"
38+
- "Client received .+ value: 0"
39+
- "Client send .+ value: 1"
40+
- "Client received .+ value: 1"
41+
- "Client send .+ value: 41"
42+
- "Client received .+ value: 41"
43+
- "Client send .+ value: 42"
44+
- "Client received .+ value: 42"
45+
- "Client send .+ value: 98"
46+
- "Client received .+ value: 98"
47+
- "Client send .+ value: 99"
48+
- "Client received .+ value: 99"

0 commit comments

Comments
 (0)