Skip to content

simonl65/URST-MicroPython

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

URST-MicroPython

License Status

MicroPython implementation of the Universal Reliable Serial Transport (URST) protocol - a robust serial communication solution.

Status: 0.1.1

Overview

URST provides reliable, error-checked data transmission over serial data links, with the following features:

  • Reliable Delivery: Acknowledgment-based protocol with automatic retries
  • Error Detection: Built-in CRC16 validation for data integrity
  • Frame Synchronization: COBS encoding for reliable frame delimiting
  • Flow Control: Sequence numbers and timeouts for reliable data transfer
  • Configurable: Adjustable timeouts, retries, and buffer sizes

See full specification for more details.

Other Implementations

  • Python - Coming Soon!
  • Arduino - TBA

Installation

Using mpremote (recommended)

If you haven't got mpremote installed see details here

mpremote mip install github:simonl65/URST-micropython

Manual Installation

  1. Clone or download this repository
  2. Copy the urst directory to your MicroPython device's filesystem

Installation with example

Use the deploy_with_demo script to install URST along with a minimal example.

Note: This will install URST to the device's lib directory and add a demo_lib directory, config.py and main.py.

uv run deploy_with_demo.py

or...

python deploy_with_demo.py

Usage

Basic Setup

from machine import UART
import time
from urst.handler import URSTHandler

# Initialize UART
uart = UART(0, baudrate=115200)

# Create URST handler instance
comms = URSTHandler(uart)

# Example: Sending data
success = comms.send(b'Hello, World!')
print("Message", "acknowledged" if success else "failed")

# Example: Receiving data
while True:
    result = comms.receive()
    if result:
        print(f"Received: {result}")
    time.sleep(0.1)  # Prevent tight loop

Testing

Run the test suite with:

uv run tests/testrunner.py

or...

python tests/testrunner.py

Contributing

We welcome contributions! Here's how you can help:

  1. Check for any open issues that cover what you want to change. Open a new issue if there are none.
  2. Fork the repository.
  3. Create a new feature branch.
  4. Make your changes.
  5. Add/update tests as appropriate.
  6. Run the test suite to ensure all tests pass.
  7. Commit and push your branch to your fork.
  8. Create a pull request with a clear description of your changes.

License

This code is released under the Sustainable Use License detailed in LICENSE.md.

TL;DR ( NOT forming part of the license )

In essence the license is one of Fair-code. It effectively prohibits you from making profit from this code if I haven't given you a specific license to do so. If I give you such a separate license then I'm happy for us both to profit off this code.

About

MicroPython implementation of Universal Reliable Serial Transport

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages