rs485-modbuslisted
Install: claude install-skill HuMoran/tt-skills
# RS485 Modbus RTU — Operation Skill
Drives a USB-to-RS485 dongle as a Modbus RTU master via a bundled `modbus.py`. Pure pyserial + hand-rolled CRC — no `pymodbus`, no `mbpoll`. Two layers: **generic** (any port/slave/register) and **emst-core preset** (defaults baked in, version readout pretty-printed).
## When this skill applies
- Bringing up Modbus on new hardware
- Verifying a slave is alive (read VERSION / known input register)
- Inspecting holding/input register values
- Sending control commands to a Modbus slave
- Diagnosing CRC errors, no-response timeouts, slave-address mismatches
- Sanity-checking firmware UART/DMA RX path during emst-core bring-up
If the user is sniffing traffic between an existing master/slave pair (passive bus tap), this skill does not yet do that — say so and stop.
## Hardware assumption
USB-to-RS485 dongle with **automatic direction control** (most modern FT232/CH340-based "RS485 USB转串口" adapters). No DE/RE pin handling in software. If the user has a manual-DE adapter, this skill won't work — flag it.
## Bootstrap (first run on a new machine)
```bash
bash "$HOME/.claude/skills/rs485-modbus/scripts/setup.sh"
```
Creates `$HOME/.claude/skills/rs485-modbus/.venv/` with `pyserial`. Idempotent. Run it again any time you see `ModuleNotFoundError: No module named 'serial'`.
## Tool invocation
```bash
SKILL_DIR="$HOME/.claude/skills/rs485-modbus"
PY="$SKILL_DIR/.venv/bin/python $SKILL_DIR/scripts/modbus.py"
$PY <subcommand> [--preset emst-co