Skip to main content
Access UART serial ports through the Lager net abstraction for simplified device path resolution and connection management.

Import

Methods

Method Reference

Net.get(name, type=NetType.UART)

Get a UART net by name.
Parameters: Returns: UARTNet instance

get_path()

Get the device path for the UART net.
Returns: str - Device path like /dev/ttyUSB0 Raises: FileNotFoundError if the UART device is not connected

connect(**overrides)

Connect to the UART serial port with pyserial.
Parameters: Returns: serial.Serial - Connected pyserial object

get_baudrate()

Get the configured baudrate for this net.
Returns: int - Configured baudrate (default: 115200)

get_config()

Get the raw net configuration dictionary.
Returns: dict - Configuration dictionary

Properties

Examples

Basic UART Communication

Using Device Path Directly

Interactive Console

Command/Response Pattern

Production Test with UART

Multi-Net UART Test

UART vs Serial Module

The Lager Python SDK provides two ways to work with serial communication: Use UART Net when:
  • Device paths may change between reboots
  • You need to identify devices by USB serial number
  • You’re using Lager’s net configuration system
  • Running automated production tests
Use raw pyserial when:
  • You know the exact device path
  • You need maximum flexibility
  • You’re doing quick debugging

Hardware Integration

Notes

  • UART nets resolve device paths using USB serial numbers for consistent identification
  • The connect() method returns a standard pyserial Serial object
  • Default baudrate is 115200 if not specified in configuration
  • Device paths are cached after first resolution
  • Use get_path() if you need the raw device path for other tools
  • Serial parameters from net configuration can be overridden in connect()