1

Install on MicroPython

Use mpremote mip to install directly from GitHub, or copy the repository's urst/ directory to the board filesystem.

Install URST-mpy from GitHub
mpremote mip install github:simonl65/URST-mpy
2

Create a UART transport

Pass an initialized UART object toUrst. Pin numbers vary by board; this example uses UART0 on a Raspberry Pi Pico-style layout.

Create the UART transport
from machine import UART, Pin
from urst import Urst

uart = UART(
    0,
    baudrate=57600,
    tx=Pin(0),
    rx=Pin(1),
)
transport = Urst(uart)
3

Send and read complete messages

Work with byte strings. URST-mpy handles frame boundaries, acknowledgements, retransmission, and reassembly under the API.

Send and read a message
transport.send(b"Hello from Pico!")

message = transport.read()
if message:
    print(message.decode())
4

Use desktop Python for gateways

For PC-side testing or bridge applications, installpyserial and open the transport with a serial port name.

Install desktop serial support
pip install pyserial
Open a desktop gateway
from urst import Urst

transport = Urst(port="/dev/ttyUSB0", baud=57600)
transport.send(b"Hello from Desktop!")

Protocol notes

What URST-mpy adds to serial

Read the URST specification