---
title: "microros-ros2-v2n (micro-ROS M33 → ROS 2 A55)"
description: "A micro-ROS node on the RZ/V2N Cortex-M33 (Zephyr) publishes a std_msgs/Int32 counter that ROS 2 on the Cortex-A55 (Yocto) can ros2 topic echo. The XRCE-DDS traffic between the micro-ROS client and an unmodified micro-ROS agent rides the same RPMsg channel as rpmsg-v2n, through a custom Micro XRCE-DDS transport."
source: https://docs.alplab.ai/sdk/examples/microros-ros2-v2n
---

# `microros-ros2-v2n`

A **micro-ROS node on the RZ/V2N Cortex-M33** (Zephyr) publishes a `std_msgs/Int32` counter that **ROS 2 on the Cortex-A55** (Yocto) can `ros2 topic echo`. The XRCE-DDS traffic between the micro-ROS client and an **unmodified** micro-ROS agent rides the same RPMsg channel as [`rpmsg-v2n`](https://docs.alplab.ai/sdk/examples/rpmsg-v2n), through a custom Micro XRCE-DDS transport.

Source: [`examples/multicore/microros-ros2-v2n/`](https://github.com/alplabai/alp-sdk/tree/main/examples/multicore/microros-ros2-v2n). New in alp-sdk v0.17.0.

:::warning[Status: the M33 slice builds and boots; no ROS 2 round-trip yet]
The A55 bridge compiles warning-free on a Linux host, and the M33 firmware builds for the V2N101 and V2M101 CM33 targets. On an E1M-V2M103 the image booted on the CM33 and wrote its RPMsg resource table. **Not proven:** a ROS 2 topic round-trip with a micro-ROS agent, the bridge running on the board, the XRCE MTU against the real RPMsg buffer size, and the CM33 RAM/flash cost of micro-ROS. Only the M33 → A55 publish direction exists.
:::

```text
   Cortex-M33 (Zephyr)                     Cortex-A55 (Yocto)
 +------------------------+          +---------------------------------+
 | rclc publisher         |          | alp-microros-bridge             |
 |   Micro XRCE-DDS client|  RPMsg   |   <alp/rpc.h> "xrce"  <-> UDP   |
 |   custom transport ----+----------+-> 127.0.0.1:8888 --> micro-ROS  |
 |   (open/close/write/   |          |                       agent     |
 |    read -> rpmsg_link) |          |                  ROS 2 / DDS    |
 +------------------------+          +---------------------------------+
```

## What it shows

- **The custom-transport hook.** `m33_sm/src/main.c` registers four callbacks (open / close / write / read) with `rmw_uros_set_custom_transport` and passes `framing = false`, because RPMsg already delimits messages. micro-ROS's `rmw_microxrcedds` is used as shipped — no RMW is written or forked.
- **One new method name over the existing RPC channel.** XRCE datagrams travel as [`<alp/rpc.h>`](https://docs.alplab.ai/sdk/api/rpc) frames with method `xrce`; neither side invents a wire schema.
- **The bridge** (`linux/src/bridge.c`) is the only A55 code: it forwards `xrce` frames between `alp_rpc_*` and a UDP socket the stock `udp4` agent listens on. It talks to the agent on loopback only, so the link stays on-SoM.
- **A start-order-independent session.** The M33 pings the agent until it answers and re-creates the XRCE session if a publish fails, so agent, bridge and M33 can start in any order.

## `board.yaml`

```yaml
libraries:
  - name: micro-ros
    cores: [m33_sm]

som:
  sku: E1M-V2N101
  hw_rev: r1

preset: e1m-x-evk
cores:
  a55_cluster:
    app: ./linux
    image: alp-image-edge
    peripherals: [ethernet, usb, emmc]
  m33_sm:
    app: ./m33_sm
    peripherals: [gpio]

ipc:
  - kind: rpmsg
    endpoints: [a55_cluster, m33_sm]
    carve_out_kb: 512
    name: alp_default_rpmsg

diagnostics:
  log_level: info
```

The `ipc:` block is deliberately identical to `rpmsg-v2n`'s, so the two examples share one carve-out and one M33 endpoint convention. Only one M33 image runs at a time — this example's replaces `rpmsg-v2n`'s.

## Prerequisites

1. The RPMsg path works on your board: [`rpmsg-v2n`](https://docs.alplab.ai/sdk/examples/rpmsg-v2n) echoes 4/4 round trips. This example uses the same UIO nodes and reserved window.
2. A ROS 2 **Humble** environment on the A55 that provides a micro-ROS agent and `ros2`. No agent is packaged in `alp-image-edge` yet, so use a Humble container on the board with host networking, or the `micro_ros_agent` package built from source.

## Build

```bash
cd alp-workspace/alp-sdk/examples/multicore/microros-ros2-v2n
tan build            # both slices; same flow as rpmsg-v2n
```

M33 only, for iteration (needs a west workspace, network access, and the ROS 2 colcon build prerequisites — the micro-ROS module cross-compiles rcl/rclc/rmw_microxrcedds at CMake configure time):

```bash
python3 scripts/gen_example_alp_conf.py examples/multicore/microros-ros2-v2n
west build -b alp_e1m_v2n101_m33_sm/r9a09g056n48gbg/cm33 \
    examples/multicore/microros-ros2-v2n/m33_sm -- \
    -DEXTRA_CONF_FILE=generated/alp.conf
```

The example carries two patches to the pinned `micro_ros_zephyr_module` (a bring-your-own-transport Kconfig choice, and a Zephyr 4.4 / picolibc build fix); its CMake applies them to a per-build copy, so the shared west checkout is never modified.

## Run

On the A55, three processes, in any order:

```bash
# 1. micro-ROS agent, stock UDP transport
docker run --rm --net=host microros/micro-ros-agent:humble udp4 --port 8888

# 2. the bridge (RPMsg <-> 127.0.0.1:8888); optional args: agent-ip agent-port
alp-microros-bridge

# 3. any ROS 2 Humble shell on the agent's DDS domain
ros2 topic list             # expect /alp_counter
ros2 topic echo /alp_counter std_msgs/msg/Int32
```

## Expected output

What a working round trip would show — **not yet captured on a board**:

```
data: 0
data: 1
data: 2
```

One message per second.

## See also

- [`rpmsg-v2n`](https://docs.alplab.ai/sdk/examples/rpmsg-v2n) — the RPMsg substrate this rides on
- [`v2n-ros2-som-temperature`](https://docs.alplab.ai/sdk/examples/v2n/v2n-ros2-som-temperature) — the smallest Alp SDK + ROS 2 node, A55 only
- [`v2n-m1-ros-perception`](https://docs.alplab.ai/sdk/examples/v2n/v2n-m1-ros-perception) — the ROS 2 perception node
- [`<alp/rpc.h>`](https://docs.alplab.ai/sdk/api/rpc) · [Heterogeneous builds](https://docs.alplab.ai/sdk/heterogeneous-builds)
- [Examples overview](https://docs.alplab.ai/sdk/examples/overview)
