README.rst
1.. zephyr:code-sample:: ipm-imx
2 :name: IPM on NXP i.MX
3 :relevant-api: ipm_interface
4
5 Implement inter-processor mailbox (IPM) on i.MX SoCs containing a Messaging Unit peripheral.
6
7Overview
8********
9This simple example can be used with multicore i.MX SoCs containing a
10Messaging Unit peripheral. It reads the received data from the Messaging Unit
11using the IPM and transmits it back unchanged. The information about
12the received data is printed to the console. When sending the data back,
13it blocks until the data are read by the remote side.
14
15The i.MX Messaging Unit peripheral consists of four 32-bit transmit and receive
16registers. The sample uses the option :kconfig:option:`CONFIG_IPM_IMX_MAX_DATA_SIZE_4`,
17which effectively creates four IPM channels. Selecting the option
18:kconfig:option:`CONFIG_IPM_IMX_MAX_DATA_SIZE_8` or
19:kconfig:option:`CONFIG_IPM_IMX_MAX_DATA_SIZE_16` would result in two 64-bit channels
20or a single 128-bit channel respectively.
21
22Note that this is just a simple demo to demonstrate the i.MX IPM functionality
23and blocking sending of the data back is done in the interrupt handler, which
24would not be appropriate for a real world application.
25
26Building and Running the Zephyr Code
27************************************
28
29The sample requires that data are being sent by the remote core so it can echo
30it back. The other core is usually not running Zephyr but Linux on i.MX
31multicore processors.
32
33This project outputs data to the console.
34It can be built as follows:
35
36.. zephyr-app-commands::
37 :zephyr-app: samples/drivers/ipm/ipm_imx
38 :board: udoo_neo_full_m4
39 :goals: build flash
40 :compact:
41
42Follow the instructions in the :ref:`udoo_neo_full_m4` board documentation
43for how to load the Zephyr binary to the desired core and execute it.
44
45Building and Running the Linux Code
46***********************************
47
48The remote code is in the form of a loadable Linux kernel module. It creates
49four character devices /dev/mu0 till /dev/mu3, which are used to read data from
50and write data into the Messaging Unit.
51
52The remote code and the instructions how to build and run it are located at:
53
54https://source.codeaurora.org/external/imxsupport/imx-mu/
55
56Sample Output
57=============
58
59Typing this in the Linux console:
60
61.. code-block:: console
62
63 # cat > /dev/mu0
64 abcdefgh
65 ^D
66
67Results in the following output on the Zephyr side:
68
69.. code-block:: console
70
71 ***** Booting Zephyr OS v1.12.0-291-g8cc508b *****
72 IPM initialized, data size = 4
73 ipm_callback: id = 0, data = 0x03323130
74 ipm_callback: id = 0, data = 0x03353433
75 ipm_callback: id = 0, data = 0x03383736
76 ipm_callback: id = 0, data = 0x02000a39
77