Hello everyone,
We’re working on a large project where we need to handle a high volume of API requests via LAN in our company. Our setup involves using the Linux chip on the Portenta X8 with the HAT Carrier to retrieve these requests quickly in Docker. The goal is to then process these requests on the Arduino chip of the Portenta X8.
Based on the documentation, we understand we need to communicate through the M4 Proxy. However, after spending four days trying to get the M4 Proxy up and running, we’ve hit a wall. Our attempts haven’t been successful, and after searching online, we found several forum threads describing similar issues, with some suggesting that the new firmware may be the culprit.
We’ve since flashed the Portenta to firmware version 746, but the problem persists. We’re unable to establish a connection between the Docker container and the Arduino sketch. We’re sharing our configuration files here.
We have also reached out to support and will provide updates here if there are any developments.
Could anyone advise if there’s a misconfiguration on our end or if this function is indeed currently unavailable? Additionally, does anyone know of an alternative firmware version that could solve this issue?
Docker-compose.yml:
py-serialrpc:
build: ./serialrpc
image: py-serialrpc
restart: unless-stopped
environment:
- PYTHONUNBUFFERED=1
extra_hosts:
- "m4-proxy:host-gateway"
ports:
- "5005:5005"
command: m4-proxy 5000
Dockerfile:
FROM python:3.9-alpine AS Build
WORKDIR /app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY serialrpc.py .
ENTRYPOINT [ "python3", "serialrpc.py" ]
requirements.txt:
Tornado==3.1
msgpack-rpc-python
certifi
paho-mqtt
serialrpc.py:
import msgpackrpc
import sys
from time import time
from datetime import datetime
server = sys.argv[1]
port = int(sys.argv[2])
print(f'server: {server}, port: {port}')
client = msgpackrpc.Client(msgpackrpc.Address(server, port))
result = client.call('register', 5005, ['tty'])
class Server(object):
def tty(self, msg):
print("Received message:", msg)
m = msg.decode().rstrip() if msg else ''
if m:
now = datetime.now()
dt = now.strftime("%Y-%m-%d %H:%M:%S.%f")
print("[", dt, "]", m)
return len(msg)
print(result)
rpc_server = msgpackrpc.Server(Server())
rpc_server.listen(msgpackrpc.Address("localhost", 5005))
rpc_server.start()
The image is built with the following command: docker build -t py-serialrpc .
The Docker container is started with this command: docker compose up
After that, we receive the following output:
[+] Running 2/2
⠿ Network proxyversuch_default Created 0.1s
⠿ Container proxyversuch-py-serialrpc-1 Created 0.1s
Attaching to proxyversuch-py-serialrpc-1
proxyversuch-py-serialrpc-1 | server: m4-proxy, port: 5000
proxyversuch-py-serialrpc-1 | b''
Thanks in advance for any insights!
------------UPDATE 13.11.2024-------------
The Arduino support team confirmed via email that it is not an issue with the correct firmware but rather a problem with the functionality of the M4 proxy, which is currently not operational. However, they are actively working on a solution.
Email:
Thank you for contacting Arduino Technical Support and explaining your situation.
We are sorry you are experiencing issues with Portenta X8 and the m4-proxy functionalities. This is a known issue in different Portenta's X8 image versions, so this is directly related to this function and not specifically to your settings.
From Arduino, we apologize for this situation. We understand that this is an inconvenience for your current project. Nonetheless, our team is actively working on a solution to improve this process.
We are still in contact with support and have asked for an alternative communication method, as otherwise, the Arduino chip would be completely unusable—what else could be done with it? It cannot communicate with the SD card, it doesn't have SoftwareSerial, and it cannot connect via USB port or LAN either.