Skip to content

saikumar-mandaji/uart-debug-tools

Repository files navigation

UART Debug Tools

Python utilities for real-time embedded device analysis over UART. Built during IoT firmware development at Niltech to replace generic terminal emulators with project-specific tooling.

Tools

Script Purpose
serial_reader.py Threaded UART reader — no dropped bytes
packet_parser.py Binary packet decoder (sync byte, CRC8, structured logs)
realtime_plotter.py Live matplotlib sensor data plotter
calibration_tool.py Automated multi-point sensor calibration with NVS write

Usage

pip install -r requirements.txt

# Live plot sensor data
python realtime_plotter.py COM3 --baud 115200 --channels 2

# Run calibration
python calibration_tool.py COM3 --points 5 --channel 0

Packet Format

[0xAA] [LEN] [TYPE] [PAYLOAD ...] [CRC8]
Type Description
0x01 Sensor data — float32 ch0, float32 ch1, uint16 raw ADC, uint8 flags
0x02 Device status
0x03 Alarm event
0x04 Debug log string
0x05 Calibration response

Structured Log Format

Text-mode log parsing for firmware that outputs:

[12345][INFO][SENSOR] SpO2: 98% HR: 72bpm

Notes

  • SerialReader runs on a background daemon thread — the main thread never blocks on readline()
  • packet_parser.py validates CRC8 before processing; malformed packets are silently dropped and counted
  • Calibration coefficients (gain + offset) are computed via least-squares and written directly to device NVS over UART command

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages