How gab-k/rp2040-decoder works
RP2040-Decoder is an open-source dual-core DCC locomotive decoder, with USB and Legacy board revisions. Its principal workflow receives DCC commands, interprets speed and configuration instructions on Core 0, and controls motor speed on Core 1 using PWM and back-EMF feedback. Core 0 also handles CV programming and persistent configuration; shared state supports coordination. The README documents auxiliary outputs and flexible GPIO, though their implementation was not sampled. Firmware relationships below follow the README and source index; unsampled details are left unconnected.
Main entry points: core0.c Core 0 processing · core1.c Motor controller · shared.c Shared core state · CV.h CV defaults
Components 14
Decoder firmware
- Core 0 processing
Software/core0.c - Packet decoding
Software/core0.c - CV programming
Software/core0.c - CV defaults
Software/CV.h - Persistent CVs
Software/core0.c - Shared core state
Software/shared.c - Core 1 control
Software/core1.c - Motor controller
Software/core1.c - Back-EMF feedback
Software/core1.c - Auxiliary I/O
Software/RP2040-Decoder-board-USB.h
Board designs
- USB revision
KiCad/USB/RP2040-Decoder.kicad_sch - Legacy revision
KiCad/Legacy/RP2040-Decoder.kicad_sch
Other components
- DCC signal
- Motor outputs
Connections 14
- DCC signal → Packet decoding: supplies signal
README.md - Core 0 processing → Packet decoding: decodes packets
README.md - Core 0 processing → CV programming: handles programming
README.md - CV programming → Persistent CVs: persists configuration
README.md - CV defaults → CV programming: defines defaults
- Core 0 processing → Shared core state: coordinates through
- Core 1 control → Shared core state: coordinates through
- Core 1 control → Motor controller: runs control
README.md - Motor controller → Back-EMF feedback: uses feedback
README.md - Motor controller → Motor outputs: drives PWM
README.md - Core 0 processing → Core 1 control: separate core tasks
README.md - Core 0 processing → Auxiliary I/O: manages outputs
- USB revision → Core 0 processing: hosts firmware
- Legacy revision → Core 0 processing: hosts firmware