Skip to content

Commit 6972edb

Browse files
committed
Documentation content update RPC
1 parent b0dffd7 commit 6972edb

File tree

2 files changed

+17
-24
lines changed

2 files changed

+17
-24
lines changed
54.4 KB
Loading

content/hardware/04.pro/boards/portenta-x8/tutorials/04.python-arduino-data-exchange/content.md

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -34,41 +34,34 @@ You will be guided on how to achieve this setup. It is recommendable to familiar
3434

3535
## Remote Procedure Call - RPC
3636

37-
**REWORK THE TEXT**
37+
The two processors within the Portenta X8 require a communication mechanism to exchange data, known as an **RPC (Remote Procedure Call)**.
3838

39-
The two processors inside Portenta X8 need a communication mechanism to exchange data. The communication mechanism is called **RPC (Remote Procedure Call)**.
39+
**RPC** allows a program to trigger a **`procedure`** or **`function`** on another computer over a network rather than locally. It lets a program execute procedures **remotely**, with the details of network communication hidden to maintain transparency, making the remote call appear similar to a local one.
4040

41-
The expression RPC refers to activating a "procedure" or "function" by a program on a computer other than the one on which the program is executed. In other words, RPC allows a program to execute procedures "remotely" on "remote" computers (but accessible through a network).
41+
It is particularly useful for distributed computing in a client-server model. The **`procedure call`** behaves as a **`request`** from the client, and the **`return value`** serves as the server's **`response`**. This model uses multiple computers connected over a network (often the Internet) to solve large computational tasks.
4242

43-
The idea of transparency is also essential to the concept of RPC. The remote procedure call must be performed in a way similar to that of the traditional "local" procedure call; the details of the network communication must, therefore, be "hidden" (i.e., made transparent) for the user.
43+
While RPC aims to closely replicate local procedure calls, complete equivalence is not possible due to network communication challenges, which can introduce communication failures. To manage these issues, different RPC mechanisms adopt distinct semantics:
4444

45-
The RPC paradigm is particularly suitable for distributed computing based on the client-server model: the "call procedure" corresponds to the "request" sent by the "client," and the "return value" of the procedure corresponds to the "response" sent by the "server." Distributed computing uses the resources of several computers connected to a network (usually via the Internet) to solve large-scale computational problems.
45+
- **`At most once` semantics** ensures that a remote call may fail but will not be run multiple times.
46+
- **`At least once` semantics** guarantees that the call is made at least once, even if it results in multiple activations.
4647

47-
Although the ultimate goal of the RPC paradigm is to provide a remote procedure call mechanism whose semantics are essentially equivalent to that of the local procedure call (hence the aforementioned transparency of the mechanism), this equivalence is never fully achieved due to difficulties that can arise in network communication (always subjected to failure).
48+
The Portenta X8 uses **MessagePack-RPC** for its communication (see the [library repository](https://github.com/msgpack-rpc/msgpack-rpc) for details). *MessagePack-RPC* relies on *MessagePack* as the serialization protocol, encoding data in *MsgPack* format, and is supported over:
4849

49-
Since there is no single obviously "right" way to handle these complications, RPC mechanisms can differ subtly in the exact semantics of the remote call. Some mechanisms, for example, have "at most once" semantics: in other words, a remote procedure call can fail (i.e., not be executed), but it is guaranteed not to result in multiple activations.
50-
51-
The opposite approach is represented by the "at least once" semantics, which guarantees that the procedure is called at least once (it could therefore happen that it is activated several times).
52-
53-
As a consequence, there are multiple types of RPC implementations. In the case of Portenta X8, **MessagePack-RPC** is used (check the [library repository](https://github.com/msgpack-rpc/msgpack-rpc) to get more details). It is an RPC implementation that uses MessagePack as a serialization protocol, i.e., data exchange is encoded in MsgPack format.
54-
55-
It is transported over different protocols:
56-
57-
* OpenAMP via Shared Memory
58-
* SPI
59-
* Linux Char Device
60-
* TCP/IP
50+
- OpenAMP via Shared Memory
51+
- SPI
52+
- Linux Char Device
53+
- TCP/IP
6154

6255
![Linux Arduino RPC](assets/linux_arduino_RPC.png "Linux Arduino RPC")
6356

64-
As you can see in the image above, the **M7 core** of **STM32H7** simplifies communication between the Linux and the Arduino environments. If an Arduino sketch runs on the **M4 core**, the **M7 core** will hand over any data/request between the M4 core and the Linux side. Due to this hardware design, traditional dual-core processing is not supported in the Portenta X8.
57+
In the image above, the **M7 core** of the **STM32H7** manages communication between the Linux and Arduino environments. If an Arduino sketch runs on the **M4 core**, the **M7 core** acts as an intermediary, handling data requests between the M4 core and the Linux environment. Due to this setup, traditional dual-core processing is not supported on the Portenta X8.
6558

66-
At the same time, on the Linux side, a service sends data between the two worlds, `m4-proxy`.
59+
On the Linux side, a service called `m4-proxy` handles data transfer between Linux and Arduino.
6760

68-
So, the communication between Arduino and Linux side will proceed as follows:
61+
The communication process works as follows:
6962

70-
* A program registers as the RPC server on port X for a list of procedures that the M4 may call
71-
* `m4-proxy` will forward the calls from the M4 to the registered program/port
63+
- A program registers as the RPC server on port X, listing the procedures available for the M4 to call.
64+
- `m4-proxy` then forwards the calls from the M4 to the appropriate program/port.
7265

7366
![RPC M4 proxy](assets/m4-proxy.png "RPC M4 proxy")
7467

@@ -244,7 +237,7 @@ Alternatively, you could modify the files directly on the X8 using an editor suc
244237
If you wonder how to specify the Python® script that is executed when running a container, have a look at the `Dockerfile` file. There you will find the `ENTRYPOINT` command that takes multiple arguments. In our example:
245238

246239
```python
247-
ENTRYPOINT [ "python3", "m4_to_python.py"]`
240+
ENTRYPOINT ["python3", "m4_to_python.py"]
248241
```
249242

250243
## Conclusion

0 commit comments

Comments
 (0)