mohitmishra786/low-level-dev-skills

protocol-analysis

Protocol analysis skill for serial bus debugging.

Ver código fuente

Cómo usar

  1. Copia el comando y revisa el paquete antes de instalarlo en tu entorno de agente.
  2. Consulta las herramientas, credenciales y entornos necesarios en el documento original.
  3. Describe las entradas y el resultado deseado; contrasta la salida con las fuentes.
npx skills add https://github.com/mohitmishra786/low-level-dev-skills --skill protocol-analysis

Antes de empezar

  • La instalación no incluye suscripción al modelo, cuota API ni permisos sobre tus archivos.
  • Las estrellas e instalaciones reflejan actividad, no una prueba independiente de calidad o seguridad.
Documento original del Skill

Contenido del repositorio de origen con títulos, ejemplos, código, tablas, enlaces e imágenes preservados.

Protocol Analysis (I2C / SPI / UART)

Purpose

Guide agents through software-side serial bus analysis: logic analyzer workflow, sigrok/PulseView decoding, correlating captures with firmware drivers, and Python-based parsing — bridging skills/baremetal/spi-i2c-baremetal and hardware bring-up.

When to Use

  • Sensor not responding — verify clock and data on bus
  • Compare kernel driver transactions vs datasheet
  • Document expected transaction format for CI/regression
  • Teaching protocol layers without expensive lab gear (sim + decode)

Workflow

1. Capture stack

Physical probe → logic analyzer hardware (or GPIO bit-bang)
├── sigrok-cli / PulseView GUI
├── Protocol decoder (i2c, spi, uart)
└── Export VCD/CSV for scripts

Open-source: sigrok with cheap FX2LA boards.

2. PulseView quick start

bash
# List devices
pulseview

# CLI capture (device-dependent)
sigrok-cli --driver fx2lafw --config samplerate=1MHz \
  --channels 0=SDA,1=SCL \
  --samples 1m \
  --protocols i2c

3. I2C decode expectations

PhaseLines
STARTSDA fall while SCL high
Address + R/W7 bits + ACK
Data bytesACK per byte
STOPSDA rise while SCL high

NACK at address → wrong 0x48 or device held in reset.

4. SPI decode

Check mode (CPOL/CPHA), bit order (MSB first typical), CS polarity, and word size. Compare to spi_setup() in skills/kernel-dev/bus-drivers-i2c-spi.

5. UART decode

Set baud (9600/115200), frame (8N1), and signal polarity. Async — sample rate must be ≥ 4× baud for LA.

6. Python post-process (csv)

python
import csv

with open("capture.csv") as f:
    for ts, ch0, ch1 in csv.reader(f):
        # edge detect, reconstruct bits
        pass

7. Correlate with firmware

Logic capture timestamp
├── Match driver reg write sequence
├── Compare inter-byte delay vs datasheet max
└── Flag extra clock pulses (mode fault)

8. Agent usage

/protocol-analysis Decode this I2C capture — device NACKs after register 0x0F write

Common Problems

SymptomCauseFix
Garbage decodeWrong samplerate≥ 4× bus speed
Floating linesMissing pull-upsEnable internal pull or external
SPI shifted bitsMode mismatchCPOL/CPHA table from RM
UART framing errorsBaud driftMeasure actual bit time
No decoderMissing sigrok buildInstall sigrok-cli + decoders

Related Skills

  • skills/baremetal/spi-i2c-baremetal — firmware-side protocol
  • skills/baremetal/uart-serial-baremetal — UART config
  • skills/kernel-dev/bus-drivers-i2c-spi — kernel transactions
  • skills/profilers/strace-ltrace — userspace syscall trace analog
  • skills/embedded/openocd-jtag — scope alongside SWD debug

Relacionados por tarea

del mismo repositorio

Más Skills

Todos los Skills
mohitmishra786
Comunidad

core-dumps

Core dump analysis skill for production crash triage. Use when loading core files in GDB or LLDB, enabling core dump generation on Linux/macOS, mapping symbols with debuginfo or debuginfod, or extracting backtraces from crashes without re-running the program. Activates on queries about core files, ulimit, coredumpctl, debuginfod, crash triage, or analyzing segfaults from production binaries.

instalaciones
2
GitHub Stars
267
Actualizado
27 jun
mohitmishra786
Comunidad

custom-allocators

Custom allocator skill for memory allocation strategies. Use when implementing pool/slab/arena allocators, tuning jemalloc/mimalloc, writing Rust GlobalAlloc, or benchmarking allocator performance. Activates on queries about jemalloc, mimalloc, tcmalloc, arena allocator, GlobalAlloc, or fragmentation.

instalaciones
2
GitHub Stars
267
Actualizado
27 jun
mohitmishra786
Comunidad

ebpf

eBPF skill for Linux observability and networking. Use when writing eBPF programs with libbpf or bpftrace, attaching kprobes/tracepoints/XDP hooks, debugging verifier errors, working with eBPF maps, or achieving CO-RE portability across kernel versions. Activates on queries about eBPF, bpftool, bpftrace, XDP programs, libbpf, verifier errors, eBPF maps, or kernel tracing with BPF.

instalaciones
2
GitHub Stars
267
Actualizado
27 jun
mohitmishra786
Comunidad

flamegraphs

Flamegraph generation and interpretation skill. Use when converting perf, Valgrind Callgrind, or other profiler output into SVG flamegraphs using Brendan Gregg's FlameGraph tools, or when reading flamegraphs to identify performance bottlenecks. Activates on queries about flamegraphs, stackcollapse, flamegraph.svg, identifying hot frames, wide vs tall frames, or performance visualisation.

instalaciones
2
GitHub Stars
267
Actualizado
27 jun