MCUXpresso SDK Documentation

rpmsg_lite_pingpong_dsp#

Overview#

The Multicore RPMsg-Lite pingpong DSP project is a demonstration program that uses the MCUXpresso SDK software and the RPMsg-Lite library and shows how to implement the inter-core communication between multiple CM cores and DSP of the asymmetric multicore system.

The primary core releases the secondary core and DSP Core from the reset. Then the inter-core communication is established between Primary Core and Secondary core and between Primary core and DSP core.

The secondary core releases the other DSP from the reset. Then the inter-core communication is established between Secondary Core and Secondary core

When using CONFIG_RPMSG_LITE_PINGPONG_SWITCH_COMM the example will change the DSP cores communication channels. It will use primary core to send messages to Hifi1 core and secondary core will send messages to Hifi4 core.

Once the RPMsg is initialized and endpoints are created the message exchange starts, incrementing a virtual counter that is part of the message payload.

The message pingpong uses following counter values and increments them: 0 to 99 for Primary to Secondary RPSMG-Lite communication. 100 to 199 for Primary to DSP RPSMG-Lite communication. 200 to 299 for Secondary to DSP RPSMG-Lite communication.

Shared memory usage#

This multicore example uses the shared memory for data exchange. The shared memory region is defined and the size can be adjustable in the linker file. The shared memory region start address and the size have to be defined in linker file for each core equally. This shared memory is split in half, first half is used between Primary Core and Secondary core and second half is used between Primary Core and DSP.

The other shared memory is created in linker file of Secondary Core for communication between other DSP core. This memory is used whole.

Building the application#

This shows example how to build application for mimxrt700evk board with cm33_core0 core_id. Change the -b <board>parameter based on board you want to build. Change the -Dcore_id=<core_id> parameter based on board core you want to build. For these parameters please see attribute boards:in primary/example.yml.

west build -b mimxrt700evk examples/multicore_examples/rpmsg_lite_pingpong_dsp/primary/ -Dcore_id=cm33_core0 -p always --sysbuild --config flash_debug

To build the switched communication use the config option CONFIG_RPMSG_LITE_PINGPONG_SWITCH_COMM.

west build -b mimxrt700evk examples/multicore_examples/rpmsg_lite_pingpong_dsp/primary/ -Dcore_id=cm33_core0 -p always --sysbuild --config flash_debug -DCONFIG_RPMSG_LITE_PINGPONG_SWITCH_COMM=y -Drpmsg_lite_pingpong_dsp_secondary_core_CONFIG_RPMSG_LITE_PINGPONG_SWITCH_COMM=y -Drpmsg_lite_pingpong_dsp_hifi4_CONFIG_RPMSG_LITE_PINGPONG_SWITCH_COMM=y -Drpmsg_lite_pingpong_dsp_hifi1_CONFIG_RPMSG_LITE_PINGPONG_SWITCH_COMM=y

Supported Boards#

MIMXRT700-EVK
Hardware requirements
  • Mini/micro USB cable

  • MIMXRT700-EVK board

  • Personal Computer

Board settings

Unshort jumper JP27 to enable also Serial Console from Secondary Core.

Prepare the Demo
  1. Connect the PC host and the board

  2. Open a two serial terminals with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Demo Diagram
                  [ SHMEM 0 @ 0x20200000 | 4KB ]
                    [ RPMSG Inst 0 | SHMEM 0 ]

+------------------------+       MU4_A / MU4_B       +------------------+
| CM33_core0             |<=========================>| HIFI4            |
| rpmsg-master0,master1  |                           | rpmsg-slave0     |
+------------------------+                           +------------------+
 ॥    \                                                    |
 ॥     \  MU0_A / MU0_B                     /==============/
 ॥      \                                   ^
 ॥       \==================================================/
 ॥            /============================/^               |
 ॥ MU1_A /   /  MU2_A / MU2_B                               |
 ॥ MU1_B    /                                               |
+------------------------+       MU3_A / MU3_B       +------------------+
| CM33_core1             |<=========================>| HIFI1            |
| rpmsg-slave1,master2   |                           | rpmsg-slave2     |
+------------------------+                           +------------------+
[ SHMEM 1 @ 0x20201000 | 4KB ]
  [ RPMSG Inst 1 | SHMEM 1 ]
                                    [ SHMEM 2 @ 0x20588000 | 4KB ]
                                      [ RPMSG Inst 2 | SHMEM 2 ]

Communication (Default):
CM33_core0 -> MU1_A/MU1_B -> CM33_core1
CM33_core0 -> MU4_A/MU4_B -> HIFI4
CM33_core1 -> MU3_A/MU3_B -> HIFI1

Communication Cross-links (CONFIG_RPMSG_LITE_PINGPONG_SWITCH_COMM=y):
CM33_core0 -> MU1_A/MU1_B -> CM33_core1
CM33_core0 -> MU0_A/MU0_B -> HIFI1
CM33_core1 -> MU2_A/MU2_B -> HIFI4
Running the demo

The log below shows the output of the RPMsg-Lite pingpong demo in the terminal window on primary core:

RPMsg demo starts Primary core.
Copy CORE1 image to address: 0x20600000, size: 102860
RPMsg demo starts DSP core 'rt700_hifi4_RI23_11_nlib'.

RPMsg demo starts
Sending data to Secondary core...
Primary core sending  a cm_msg. Message: Size=4, DATA = 0
Primary core received a cm_msg. Message: Size=4, DATA = 1
...
...
Primary core sending  a cm_msg. Message: Size=4, DATA = 98
Primary core received a cm_msg. Message: Size=4, DATA = 99
Sending data to HIFI4 core...
Primary core sending  a dsp_msg. Message: Size=4, DATA = 100
Primary core received a dsp_msg. Message: Size=4, DATA = 101
...
...
Primary core sending  a dsp_msg. Message: Size=4, DATA = 198
Primary core received a dsp_msg. Message: Size=4, DATA = 199

RPMsg demo ends

The log below shows the output of the RPMsg-Lite pingpong demo in the terminal window on secondary core:

RPMsg demo starts Secondary core.
RPMsg demo starts DSP core 'rt700_hifi1_RI23_11_nlib'.
Sending data to HIFI1 core...
Secondary core sending  a dsp_msg. Message: Size=4, DATA = 200
Secondary core received a dsp_msg. Message: Size=4, DATA = 201
...
...
Secondary core sending  a dsp_msg. Message: Size=4, DATA = 298
Secondary core received a dsp_msg. Message: Size=4, DATA = 299

RPMsg demo ends

FRDM-IMXRT700
Hardware requirements
  • Type-C USB cable

  • FRDM-IMXRT700 board

  • Personal Computer

Board settings

Unshort jumper JP27 to enable also Serial Console from Secondary Core.

Prepare the Demo
  1. Connect the PC host and the board

  2. Open a two serial terminals with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Demo Diagram
                  [ SHMEM 0 @ 0x20200000 | 4KB ]
                    [ RPMSG Inst 0 | SHMEM 0 ]

+------------------------+       MU4_A / MU4_B       +------------------+
| CM33_core0             |<=========================>| HIFI4            |
| rpmsg-master0,master1  |                           | rpmsg-slave0     |
+------------------------+                           +------------------+
 ॥    \                                                    |
 ॥     \  MU0_A / MU0_B                     /==============/
 ॥      \                                   ^
 ॥       \==================================================/
 ॥            /============================/^               |
 ॥ MU1_A /   /  MU2_A / MU2_B                               |
 ॥ MU1_B    /                                               |
+------------------------+       MU3_A / MU3_B       +------------------+
| CM33_core1             |<=========================>| HIFI1            |
| rpmsg-slave1,master2   |                           | rpmsg-slave2     |
+------------------------+                           +------------------+
[ SHMEM 1 @ 0x20201000 | 4KB ]
  [ RPMSG Inst 1 | SHMEM 1 ]
                                    [ SHMEM 2 @ 0x20588000 | 4KB ]
                                      [ RPMSG Inst 2 | SHMEM 2 ]

Communication (Default):
CM33_core0 -> MU1_A/MU1_B -> CM33_core1
CM33_core0 -> MU4_A/MU4_B -> HIFI4
CM33_core1 -> MU3_A/MU3_B -> HIFI1

Communication Cross-links (CONFIG_RPMSG_LITE_PINGPONG_SWITCH_COMM=y):
CM33_core0 -> MU1_A/MU1_B -> CM33_core1
CM33_core0 -> MU0_A/MU0_B -> HIFI1
CM33_core1 -> MU2_A/MU2_B -> HIFI4
Running the demo

The log below shows the output of the RPMsg-Lite pingpong demo in the terminal window on primary core:

RPMsg demo starts Primary core.
Copy CORE1 image to address: 0x20600000, size: 102860
RPMsg demo starts DSP core 'rt700_hifi4_RI23_11_nlib'.

RPMsg demo starts
Sending data to Secondary core...
Primary core sending  a cm_msg. Message: Size=4, DATA = 0
Primary core received a cm_msg. Message: Size=4, DATA = 1
...
...
Primary core sending  a cm_msg. Message: Size=4, DATA = 98
Primary core received a cm_msg. Message: Size=4, DATA = 99
Sending data to HIFI4 core...
Primary core sending  a dsp_msg. Message: Size=4, DATA = 100
Primary core received a dsp_msg. Message: Size=4, DATA = 101
...
...
Primary core sending  a dsp_msg. Message: Size=4, DATA = 198
Primary core received a dsp_msg. Message: Size=4, DATA = 199

RPMsg demo ends

The log below shows the output of the RPMsg-Lite pingpong demo in the terminal window on secondary core:

RPMsg demo starts Secondary core.
RPMsg demo starts DSP core 'rt700_hifi1_RI23_11_nlib'.
Sending data to HIFI1 core...
Secondary core sending  a dsp_msg. Message: Size=4, DATA = 200
Secondary core received a dsp_msg. Message: Size=4, DATA = 201
...
...
Secondary core sending  a dsp_msg. Message: Size=4, DATA = 298
Secondary core received a dsp_msg. Message: Size=4, DATA = 299

RPMsg demo ends