seveibar/nema17-stepper-motor-driver-tmc2209-usb-pd
RP2040-based USB-C PD stepper-motor controller with TMC2209 drive, AS5600 position feedback, TMP102 thermal shutdown, current/voltage telemetry, RGB status LED, and protected buzzer alarm circuitry.
- Version
- 0.2.0
- License
- unset
- Stars
- 0
scripts/report-build.py
"""Write an honest build status report without modifying circuit/DRC records."""
from pathlib import Path
import json
from collections import Counter
p=Path('dist/index/circuit.json')
j=json.loads(p.read_text()); errors=[e for e in j if e['type'].endswith('_error')]
counts=Counter(e['type'] for e in errors)
Path('reports').mkdir(exist_ok=True)
Path('reports/drc-errors.json').write_text(json.dumps(errors,indent=2)+'\n')
s='''# Verification — RP2040 TMC2209 variant
- TypeScript: passes `bun run typecheck`.
- Schematic: renders all seven sheets with zero source/schematic error records.
- Electrical connectivity: physical-pin regression passes (see `reports/connectivity.log`).
- Firmware: 29 mocked tests pass, covering temperature/encoder/alarm policy, active-high DIAG, UART CRC, echo handling, rejected writes, counter rollover, resets, driver faults, ADC conversion, PD fallback, supply overcurrent and dim RGB formatting/timing.
- Saved-route guard: accepts the exact routing input and rejects changed routing rules.
- Hardware, thermal performance and motion: not tested.
- Full PCB build: '''+('**FAIL — layout is not fabrication-ready.**' if errors else '**passes built-in DRC; still requires manufacturing and thermal review.**')+'\n\n'
s+=f"The generated board contains {sum(e['type']=='pcb_trace' for e in j)} PCB traces and {sum(e['type']=='pcb_via' for e in j)} vias. "
s+='Its unfiltered circuit JSON and detailed DRC records are included. No checks were disabled and no error records were deleted.\n\n'
if errors:
s+='## Remaining build errors\n\n| Error type | Count |\n|---|---:|\n'
s+=''.join(f'| `{t}` | {n} |\n' for t,n in counts.items())
s+='\n'+ '\n'.join('- '+e.get('message',e['type']).replace('\n',' ') for e in errors)+'\n'
s+='''
## Review limits
The motor driver, its support parts and sensor placement differ from the source; the source's saved routing is intentionally excluded. Ground/thermal vias at the exposed pad, filled/capped via-in-pad manufacturing for the SMT-pad vias, short local charge-pump and bypass loops, sense-resistor return routing, trace current capacity and temperature coupling need engineering review. The 15 mm decoupling routing ceiling is an exploration setting for supply-network paths, not proof of adequate local decoupling.
Motor power now requests fixed 12 V USB-PD, with SMBJ13CA protection and a 100 µF / 25 V bulk capacitor. Verify the added current shunt uses separate Kelvin sense branches at its pads, calibrate both ADC channels, and scope RGB timing and power transitions. No fabrication outputs or assembly-ready BOM are released. The AS5600 remains DNP; the supplied monitor requires it to be populated and its magnet valid before arming. No firmware was flashed and no physical board was tested.
'''
Path('verification.md').write_text(s)
print(dict(counts))