LinuxCommandLibrary

pio-device

List connected PlatformIO (serial) devices

TLDR

List all available serial ports

$ pio device list
copy

List all available logical devices
$ pio device list --logical
copy

Start an interactive device monitor
$ pio device monitor
copy

Start an interactive device monitor and listen to a specific port
$ pio device monitor [[-p|--port]] [/dev/ttyUSBX]
copy

Start an interactive device monitor and set a specific baud rate (defaults to 9600)
$ pio device monitor [[-b|--baud]] [57600]
copy

Start an interactive device monitor and set a specific EOL character (defaults to CRLF)
$ pio device monitor --eol [CRLF|CR|LF]
copy

Go to the menu of the interactive device monitor
$ <Ctrl t>
copy

SYNOPSIS

The conceptual pio-device functionality is accessed via the pio device command within the PlatformIO CLI.

pio device <command> [OPTIONS]

Examples:
pio device list
pio device monitor -p /dev/ttyUSB0 -b 115200

PARAMETERS

-p, --port
    Specifies the serial port to use for monitoring or other operations, e.g., /dev/ttyUSB0 on Linux/macOS or COM1 on Windows.

-b, --baud
    Sets the baud rate for serial communication when monitoring, e.g., 9600, 115200.

-e, --echo
    Echoes local characters typed in the serial monitor back to the console.

-f, --filter
    Applies one or more filters to the serial monitor output, useful for processing or enhancing data, e.g., colorize, time, default.

--rts
    Controls the Request To Send (RTS) line state (0=off, 1=on) of the serial port.

--dtr
    Controls the Data Terminal Ready (DTR) line state (0=off, 1=on) of the serial port.

--exit-char
    Defines the character sequence to exit the serial monitor, defaults to Ctrl+C.

DESCRIPTION

The pio device command is a subcommand of the PlatformIO (PIO) Core command-line interface. It provides essential tools for interacting with serial ports and connected hardware devices, which are fundamental for embedded systems and IoT development. Developers primarily use it to list available serial ports on the system, and to monitor serial communication from microcontrollers or other devices. This command is crucial for debugging firmware, viewing runtime output, and verifying device connectivity within the PlatformIO ecosystem. It significantly simplifies the process of interacting with hardware targets by abstracting away low-level serial port configurations and offering a user-friendly interface.

CAVEATS

The pio-device command itself does not exist as a standalone executable in Linux. The functionality is provided by the pio device subcommand within the PlatformIO Core CLI. Users must have PlatformIO Core installed.

On Linux, access to serial ports typically requires the user to be part of the dialout or uucp group to prevent permission errors.

KEY SUBCOMMANDS

The pio device command is primarily used with specific subcommands to perform actions:

list: Lists all available serial ports on the system, providing details such as hardware ID, description, and vendor. This is useful for identifying the correct port for your device.

monitor: Opens a serial monitor connection to a specified device, displaying data received over the serial port. This is the most frequently used subcommand for debugging embedded applications by viewing their runtime output.

HISTORY

PlatformIO (PIO) was founded by Ivan Kravets and released its first public version around 2014. The pio device subcommand has been an integral part of the PIO Core CLI since its early stages, providing essential functionalities for interacting with hardware targets. Its development has mirrored the growth of embedded systems and IoT, continuously adapting to new hardware and communication protocols to support a wide range of development boards and frameworks.

SEE ALSO

pio(1), screen(1), minicom(1), stty(1)

Copied to clipboard