linux-tty
The linux-tty driver talks to any serial port or character device the bench's
Linux kernel exposes: USB-to-serial cables and adapters, USB CDC devices such as
a board's bootloader, and on-board UARTs. One device file is one peripheral.
| Property | Value |
|---|---|
kind | linux-tty |
| Interfaces | uart, chardev, tty |
location | A device path, such as /dev/serial/by-id/usb-... |
Example
A hardware UART with full line settings and a terminal on top of it:
dut_console:
kind: linux-tty
name: "DUT console"
description: "Primary UART to the device under test"
location: /dev/serial/by-id/usb-FTDI_FT232R_A50285BI-if00-port0
interfaces:
- type: uart
channel: 0
config:
baud_rate: 115200
data_bits: 8
parity: none
stop_bits: 1
- type: tty
channel: 0
config:
cols: 120
rows: 35
backed_by:
type: uart
channel: 0
A USB CDC device read as raw bytes, with no line settings:
bootloader:
kind: linux-tty
name: "Arduino bootloader"
location: /dev/serial/by-id/usb-Arduino_Bootloader-if00
interfaces:
- type: chardev
channel: 0
- type: tty
channel: 0
config:
cols: 80
rows: 24
backed_by:
type: chardev
channel: 0
Location
Use the device's /dev/serial/by-id/ path. It stays the same across replugs and
reboots, while a name such as /dev/ttyUSB0 can change. mimick peripheral list
shows the by-id path of every USB serial device the bench detects.
An on-board UART has no by-id path. Enter its device path, such as
/dev/ttyS1, by hand.
Interfaces
A serial port exposes either uart or chardev, never both, and optionally a
tty on top. Each type appears at most once, always on channel 0.
| Type | Use it for |
|---|---|
uart | A real serial line, where the bench sets the baud rate, parity, and stop bits. |
chardev | A device that carries raw bytes with no line settings, such as a USB CDC port. |
tty | An interactive terminal session on top of the uart or chardev interface. |
Without a tty interface, the port serves one-shot reads and exchanges
(uart read, uart transfer) straight from the device. Declare a tty to
share the port with several sessions or to stream its bytes.
uart settings
| Key | Default | Allowed values |
|---|---|---|
baud_rate | 115200 | Any positive integer |
data_bits | 8 | 5, 6, 7, or 8 |
parity | none | none, even, or odd (lowercase) |
stop_bits | 1 | 1, 1.5, or 2 |
initial_dtr | unchanged | asserted, released, or unchanged |
initial_rts | unchanged | asserted, released, or unchanged |
log_delimiter | \n with a tty, none without | Text that ends a row of the data recorder, such as "\r\n". Not empty. |
log_delimiter_hex | none | The same as a byte sequence in hex, such as "7e". Set this or log_delimiter, not both. |
The data recorder logs every byte the port receives or sends. A row ends at the
delimiter, after 2 ms with no new bytes, or at 4 KiB, whichever comes first.
Set a delimiter to get one row per frame of a binary protocol, such as 7e for
HDLC. An empty or malformed delimiter shows the port as missing.
A parity or stop_bits value outside the list doesn't reject the file.
Instead, the port fails to open and shows as missing.
To change line settings for good, edit the file and deploy it again. The port
closes and reopens with the new settings. To change them for a single session,
for example to talk to a bootloader that needs even parity, use
mimick uart config.
Initial DTR and RTS
Linux asserts DTR and RTS whenever a program opens a serial port. On a board
where those lines drive reset or boot mode, that holds the board in reset or in
its bootloader for as long as the bench has the port open. Set initial_dtr and
initial_rts to released to release both lines as soon as the port opens, and
again each time the port reopens after a replug. unchanged keeps what Linux
does, which is to assert the line.
The kernel asserts both lines for a few microseconds before the bench releases them. If your board reacts to a pulse that short, add a pull-up to the line.
chardev settings
A chardev takes only the write settings.
Write settings
A port with a tty interface sends every write through one writer, so bytes
from several sessions never mix inside one write. The uart or chardev config
that the tty is backed_by takes two keys that choose when a write counts as
done:
| Key | Default | Meaning |
|---|---|---|
queued_writes | true with a tty interface, false on a port without one | true returns once the write is queued. false returns after the device took it. |
queue_depth | 64 | How many writes can wait. Used only when queued_writes is true. Must be above 0. |
With queued_writes: false, mimick uart write and mimick uart exec report
how many bytes the device took, and the device's error if it refused them. With
queued_writes: true, a full queue makes the next write wait for room instead
of losing it. A write that fails at the device is logged on the bench and, when
the data recorder is on, recorded as a mimick.peripheral.write error row
(PERIPHERAL_IO_ERROR) for the bytes the device did not take.
queued_writes: true needs a tty interface, because the queue belongs to the
terminal. A port without one writes straight to the device.
tty settings
| Key | Required | Default | Description |
|---|---|---|---|
cols | No | 80 | Terminal width in columns. |
rows | No | 24 | Terminal height in rows. |
backed_by | Yes | The uart or chardev interface on this peripheral, as { type, channel }. |
backed_by sits beside config, not inside it. The terminal size is fixed:
resizing your local terminal doesn't change it.
Use it
Open the terminal from the CLI:
mimick connect dut_console.tty0
In the web UI, select Open terminal on the peripheral's row in the bench's Inventory tab.