Skip to content

Commit bf37f33

Browse files
committed
Portenta X8 RPC Links and example update
1 parent d1f921a commit bf37f33

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

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

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ While RPC aims to closely replicate local procedure calls, complete equivalence
4848
- **`At most once` semantics** ensures that a remote call may fail but will not be run multiple times.
4949
- **`At least once` semantics** guarantees that the call is made at least once, even if it results in multiple activations.
5050

51-
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:
51+
The Portenta X8 uses **MessagePack-RPC** for its communication (see the [library repository](https://github.com/msgpack-rpc/msgpack-rpc-python) for details). *MessagePack-RPC* relies on *MessagePack* as the serialization protocol, encoding data in *MsgPack* format, and is supported over:
5252

5353
- OpenAMP via Shared Memory
5454
- SPI
@@ -117,7 +117,7 @@ Alternatively, you could bind the name to an existing, named function instead. T
117117

118118
![The iMX8 and the STM32H747 processor communicate via SPI](assets/component-placement.svg)
119119

120-
You can find the sketch in the software package [here](assets/python-sensor-rpc.zip). You may need to change the sketch depending on the choice of the sensor to read from. If you're using an I<sup>2</sup>C sensor, you can connect SCL to **PWM6** and SDA to **PWM8** on the Portenta breakout.
120+
You can find the sketch and complete example [here](https://github.com/arduino/portenta-containers/tree/main/python-rpc-sensors). You may need to change the sketch depending on the choice of the sensor to read from. If you're using an I<sup>2</sup>C sensor, you can connect SCL to **PWM6** and SDA to **PWM8** on the Portenta breakout.
121121

122122
That is because the labeled I<sup>2</sup>C pins on the Portenta Breakout are only available on the Linux side. If you are using an analog sensor, you can connect it to any analog pin. Please refer to the pinout diagram on the Portenta Breakout [documentation page](/hardware/portenta-breakout).
123123

@@ -129,16 +129,16 @@ Make sure you have installed the **Arduino Mbed OS Portenta Boards** core and up
129129

130130
To check if the Arduino sketch is working correctly, you may want to read the messages from the `Serial.println` statements. You cannot currently read them directly in the serial monitor of the Arduino IDE. Instead, you can use a simple service called **`py-serialrpc`**, which listens for those messages and prints them to the console.
131131

132-
This service needs to run on the Linux side of the X8. You can get the files [here](assets/py-serialrpc.zip). The compressed file will have every file needed to build a container as the docker compose app. From the command prompt of your local machine, navigate to the adb tool folder and upload the files to the X8 with command:
132+
This service needs to run on the Linux side of the X8. You can get the files [here](https://github.com/arduino/portenta-containers/tree/main/python-rpc-serial). Clone or download the repository to your local machine, then from the command prompt, navigate to the adb tool folder and upload the files to the X8 with command:
133133

134134
```bash
135-
adb push <local directory path>/py-serialrpc /home/fio
135+
adb push <local directory path>/python-rpc-serial /home/fio
136136
```
137137

138-
Log into the X8 shell with `adb shell` and navigate into the `serialrpc` folder. Build the container using
138+
Log into the X8 shell with `adb shell` and navigate into the `python-rpc-serial` folder. Build the container using
139139

140140
```bash
141-
docker build . -t py-serialrpc
141+
docker build . -t python-rpc-serial
142142
```
143143

144144
The `-t` flag assigns a tag to the container. Then run the container by executing `cd..` and then:
@@ -181,16 +181,16 @@ rpc_client = RpcClient(rpc_address)
181181
temperature = rpc_client.call('temperature')
182182
```
183183

184-
The complete Python® application files are in the same package as the Arduino sketch (see above). Like in the previous step, upload the `python-sensor-rpc` folder to the Portenta X8 via:
184+
The complete Python® application files are available in the repository [here](https://github.com/arduino/portenta-containers/tree/main/python-rpc-sensors). Clone or download the repository to your local machine, then upload the `python-rpc-sensors` folder to the Portenta X8 via:
185185

186186
```bash
187-
adb push <local directory path>/python-sensor-rpc /home/fio
187+
adb push <local directory path>/python-rpc-sensors /home/fio
188188
```
189189

190-
Log into the X8 via `adb shell`. Then navigate into the `python-sensor-rpc` folder and execute:
190+
Log into the X8 via `adb shell`. Then navigate into the `python-rpc-sensors` folder and execute:
191191

192192
```bash
193-
docker build . -t python-sensor-rpc
193+
docker build . -t python-rpc-sensors
194194
```
195195

196196
When it has finished, you can run the container with:
@@ -202,22 +202,22 @@ docker compose up
202202
After a few seconds, you should see the output from the Python application featuring the sensor readings on the M4 that exchanges through the RPC mechanism. The output should look similar to the following:
203203

204204
```bash
205-
python-sensor-rpc_1 | ============================================
206-
python-sensor-rpc_1 | == Portenta X8 Sensor reading ==
207-
python-sensor-rpc_1 | ============================================
208-
python-sensor-rpc_1 |
209-
python-sensor-rpc_1 | Temperature: 25.904266357421875
210-
python-sensor-rpc_1 | Humidity: 25.564695358276367
211-
python-sensor-rpc_1 | Pressure: 976.4400024414062
212-
python-sensor-rpc_1 | Gas: 136.496
213-
python-sensor-rpc_1 | Altitude: 311.0769348144531
205+
python-rpc-sensors_1 | ============================================
206+
python-rpc-sensors_1 | == Portenta X8 Sensor reading ==
207+
python-rpc-sensors_1 | ============================================
208+
python-rpc-sensors_1 |
209+
python-rpc-sensors_1 | Temperature: 25.904266357421875
210+
python-rpc-sensors_1 | Humidity: 25.564695358276367
211+
python-rpc-sensors_1 | Pressure: 976.4400024414062
212+
python-rpc-sensors_1 | Gas: 136.496
213+
python-rpc-sensors_1 | Altitude: 311.0769348144531
214214
```
215215

216216
Whenever you change anything in the Python® script on your computer, you will have to resync and push the new script to the Portenta X8 and rebuild the container. Following command sequence will help you to do this process:
217217

218218
```bash
219219
# On your computer
220-
adb push python-sensor-rpc /home/fio
220+
adb push python-rpc-sensors /home/fio
221221
```
222222

223223
```bash
@@ -227,7 +227,7 @@ docker compose down
227227

228228
```bash
229229
# On the Portenta X8
230-
docker build . -t python-sensor-rpc
230+
docker build . -t python-rpc-sensors
231231
```
232232

233233
```bash

0 commit comments

Comments
 (0)