> ## Documentation Index
> Fetch the complete documentation index at: https://docs.embedder.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Serial transports

> Monitor UART, SEGGER RTT, ARM ITM and SWO, and XMOS xSCOPE output from Embedder Debug mode and route them into logs, plots, and dashboards.

Use the Monitor's serial view for text and byte streams from a target. Debug mode can wait for new output, read buffered history immediately, or send data on transports that support input.

Run `serial_config` or refresh `hardware_status` when you are unsure which ports, probes, targets, or XMOS artifacts are available.

## Compare the transports

| Transport   | Port form                               | Input                 | Main requirement                                    |
| ----------- | --------------------------------------- | --------------------- | --------------------------------------------------- |
| UART        | `/dev/tty...`, `COM...`, or bridge port | Yes                   | Serial device and baud rate                         |
| SEGGER RTT  | `rtt://...`                             | Yes, on down channels | J-Link software, probe, target device               |
| ITM/SWO     | `itm://`                                | No                    | Supported OpenOCD probe, target, CPU and SWO clocks |
| XMOS xSCOPE | `xscope://host:port`                    | No                    | XTC Tools, `xrun`, and a built `.xe`                |

CAN mode also uses a serial port, but it applies a CAN transport codec instead of treating bytes as UART text. See [CAN Monitor](/debug-mode/can).

## Monitor UART

Select the port, baud rate, and newline convention in the serial view. The standard picker includes rates from `300` through `921600`, including `74880` for boot logs.

```text theme={"system"}
Open /dev/tty.usbmodem2101 at 115200 baud, reset with DTR, and wait up to
30 seconds for READY.
```

UART supports:

* `LF`, `CR`, `CRLF`, or no newline when sending
* DTR, RTS, or the ESP-style DTR/RTS reset sequence
* A command-based reset through a flasher or debugger
* Baud detection from observed traffic when the port is not in CAN mode

When you monitor after a flash, Embedder prepends up to 100 buffered lines that arrived since the last connection. Use history when you only need data already captured:

```text theme={"system"}
Read only the new UART history from the active port and return the last 50
lines. Do not wait for more data.
```

## Monitor SEGGER RTT

RTT reads target memory through J-Link, so it does not consume a UART peripheral or pin. Select:

* The J-Link target device name
* `SWD` or `JTAG`
* The probe clock
* An RTT up channel to read
* A down channel when you need to send

Embedder starts the managed J-Link GDB server with RTT enabled when necessary. It uses the selected probe and target across the serial view and GDB.

```text theme={"system"}
Monitor RTT up channel 0 on nRF52840_xxAA over SWD until the text "boot ok"
appears. Do not reset the target.
```

The Monitor can expose several RTT channels. Up channels are readable, down channels are writable, and channel metadata can identify text, binary, CTF, or SystemView data. Split the view when you want one column per up channel.

For control-block discovery, choose a map file containing `_SEGGER_RTT` or enter its address. Leave both unset to let J-Link search.

In a hardware script, `rtt_read`, `rtt_read_history`, and `rtt_send` use channel 0. `rtt_send` appends CRLF.

<Warning>
  Changing the selected J-Link device or interface can restart the managed
  server and disconnect an active GDB session.
</Warning>

## Monitor ITM and SWO

ITM is a read-only Cortex-M trace transport carried over SWO. Embedder starts OpenOCD with ITM enabled and connects the `itm://` view to its TCP output.

The USB detector recognizes these ITM probe families:

* ST-Link V1, V2, V2-1, and V3
* DAPLink
* NXP LPC-Link2
* NXP MCU-Link

Your OpenOCD build and target configuration must also support SWO for the selected MCU.

Configure:

1. The OpenOCD target
2. The CPU clock in hertz
3. The SWO frequency in hertz

The SWO frequency must not exceed the CPU clock. A wrong clock usually produces missing or garbled output.

```text theme={"system"}
Monitor itm:// for five seconds with a 168 MHz CPU clock, 2 MHz SWO, and the
stm32f4x OpenOCD target.
```

ITM output is prefixed by stimulus channel:

```text theme={"system"}
ch0: boot complete
ch1: DE AD BE EF
```

Channel 0 is line-buffered UTF-8. Firmware must write a newline before the text appears. Channels 1 through 31 are uppercase hexadecimal byte streams, and TCP chunks do not preserve application frame boundaries.

The serial ITM parser surfaces software stimulus packets only. It drops timestamps, overflow and extension packets, DWT hardware events, exception trace, PC sampling, and data trace. Use the trace recording workflow only when firmware emits Embedder's compact event packets on the configured ITM stimulus port.

## Monitor XMOS xSCOPE

Embedder exposes an `xscope://localhost:12345` endpoint when it detects an XMOS board or xTAG adapter.

Before connecting:

1. Install XMOS XTC Tools so `xrun` is available.
2. Build the project to produce a `.xe` file.
3. Set `xmos_xe` in `EMBEDDER.md` if the project has more than one candidate.

```text EMBEDDER.md theme={"system"}
xmos_xe = build/my_app.xe
```

The default monitor runs:

```bash theme={"system"}
xrun --xscope build/my_app.xe
```

Use `stop_string` and timeout as you would for UART. Baud rate is ignored. DTR and RTS resets are rejected; use a command reset when the target needs one.

xSCOPE is read-only in the Monitor. Sending text is blocked because an xSCOPE print stream is not a UART shell.

For realtime server mode, configure a host decoder:

```text EMBEDDER.md theme={"system"}
xscope_client_command = my_xscope_client --host {host} --port {port}
```

Embedder then launches `xrun --xscope-port {endpoint} {xe}` and streams the decoder's stdout. Keep the `.xe` path in `xmos_xe`, not in the client command.

## Wait for output without losing history

`serial_monitor` has two useful modes:

* With a stop string, it waits up to 30 seconds by default.
* Without a stop string, it captures for three seconds by default.

Set a longer timeout for slow boot or an intermittent event. Use `serial_read_history` between probes so you do not reopen a port just to read buffered output.

## Fix transport problems

<AccordionGroup>
  <Accordion title="UART opens at the wrong baud">
    Disconnect every view using the port, then reconnect at one rate. A shared serial session cannot change baud while another subscriber owns it.
  </Accordion>

  <Accordion title="RTT has no target device">
    Select a J-Link device in the RTT configuration or pass the device name in the request. Confirm that the firmware contains an RTT control block.
  </Accordion>

  <Accordion title="ITM is silent">
    Verify the OpenOCD target, target support for SWO, CPU clock, SWO frequency, probe wiring, and firmware ITM initialization.
  </Accordion>

  <Accordion title="xSCOPE cannot start">
    Check that `xrun` is in the XTC environment and that the selected `.xe` exists. A build without xSCOPE support will not emit xSCOPE output.
  </Accordion>
</AccordionGroup>

<CardGroup cols={2}>
  <Card title="CAN Monitor" icon="car" href="/debug-mode/can">
    Switch a serial port from UART text to CAN frame handling.
  </Card>

  <Card title="Coverage and trace" icon="timeline" href="/debug-mode/coverage-and-trace">
    Record structured RTT, ITM, or ETM trace sessions.
  </Card>
</CardGroup>
