You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/hardware/02.uno/boards/uno-q/tutorials/01.user-manual/content.md
+129-3Lines changed: 129 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -821,7 +821,7 @@ The `Bridge` library provides a communication layer built on top of the `Arduino
821
821
822
822
#### The Arduino Router (Infrastructure)
823
823
824
-
Under the hood, the communication is managed by a background Linux service called the Arduino Router (`arduino-router`).
824
+
Under the hood, the communication is managed by a background Linux service called the **Arduino Router** (`arduino-router`).
825
825
826
826
While the `Bridge` library is what you use in your code, the Router is the traffic controller that makes it possible. It implements a **Star Topology** network using MessagePack RPC.
827
827
@@ -835,7 +835,22 @@ While the `Bridge` library is what you use in your code, the Router is the traff
835
835
836
836
-**Service Discovery:** Clients (like your Python® script or the MCU Sketch) "register" functions they want to expose. The Router keeps a directory of these functions and routes calls to the correct destination.
The Router manages the physical connection between the two processors. It is important to know which hardware resources are claimed by the Router to avoid conflicts in your own applications.
846
+
847
+
***Linux Side (MPU):** The router claims the serial device `/dev/ttyHS1`.
848
+
***MCU Side (STM32):** The router claims the hardware serial port `Serial`.
849
+
850
+
> **⚠️ WARNING: Reserved Resources**
851
+
> Do not attempt to open `/dev/ttyHS1` (on Linux) or `Serial` (on Arduino/Zephyr) in your own code. These interfaces are exclusively locked by the `arduino-router` service. Attempting to access them directly will cause the Bridge to fail.
852
+
853
+
#### Managing the Router Service
839
854
840
855
The arduino-router runs automatically as a system service. In most cases, you do not need to interact with it directly. However, if you are debugging advanced issues or need to restart the communication stack, you can control it via the Linux terminal:
841
856
@@ -923,7 +938,7 @@ To capture more detailed information in the logs, you can append the `--verbose`
923
938
-**Incoming Updates**: Handled by a dedicated background thread (`updateEntryPoint`) that continuously polls for requests.
924
939
-**Safe Execution**: The provide_safe mechanism hooks into the main loop (`__loopHook`) to execute user callbacks safely when the processor is idle.
925
940
926
-
#### Usage Example
941
+
#### Usage Example (Arduino App Lab)
927
942
928
943
This example shows the **Linux side (Qualcomm QRB)** toggling an LED on the **MCU (STM32)** by calling a remote function over the Bridge.
929
944
@@ -984,6 +999,117 @@ After pasting the Python script into your App’s Python file and the Arduino co
984
999
985
1000
***There are more advanced methods in the Bridge RPC library that you can discover by testing our different built-in examples inside Arduino App Lab.***
986
1001
1002
+
#### Interacting via Unix Socket (Advanced)
1003
+
1004
+
Linux processes communicate with the Router using a **Unix Domain Socket** located at:
1005
+
`/var/run/arduino-router.sock`
1006
+
1007
+
While the `Bridge` library handles this automatically for you, you can manually connect to this socket to interact with the MCUor other Linux services using any language that supports **MessagePack RPC** (e.g., Python, C++, Rust, Go).
1008
+
1009
+
#### Usage Example (Custom Python Client)
1010
+
1011
+
The following example demonstrates how to control an MCU function (`set_led_state`) from a standard Python script using the `msgpack` library, without using the Arduino App Lab helper classes. This is useful for integrating Arduino functions into existing Linux applications.
1012
+
1013
+
**Prerequisites:**
1014
+
1015
+
1. **Flash the MCU Sketch**
1016
+
1017
+
Upload the following code using the Arduino IDEor Arduino App Lab. This registers the function we want to call.
1018
+
1019
+
```cpp
1020
+
#include "Arduino_RouterBridge.h"
1021
+
1022
+
void setup() {
1023
+
pinMode(LED_BUILTIN, OUTPUT);
1024
+
1025
+
Bridge.begin();
1026
+
// We use provide_safe to ensure the hardware call runs in the main loop context
0 commit comments