AnasSarkiz/NEMA14_RP2040

A NEMA motor assembly concept with a controller board, four proposed M3 screws and spacers, motor lead splices, and a JST 4-pin connector harness.

Version
1.13.0
License
ISC
Stars
0

docs/firmware-interface.md

> Historical baseline document: this predates the opposite-edge v1.11.0 draft. See [current draft and blockers](opposite-edge-review.md) for current evidence.

# RP2040 firmware contract

Use the Pico SDK RP2040 target with 12 MHz XOSC and 2 MB flash. Select the generic JEDEC-compatible boot stage for GD25Q16E; do not assume a Winbond-specific quad-enable sequence. Flash boot and UF2 USB ROM boot require hardware validation.

| Function | RP2040 GPIO / physical pin |
| --- | --- |
| STEP | GPIO6 / 8 |
| DIR | GPIO7 / 9 |
| ENABLE_N | GPIO8 / 11 |
| SLEEP | GPIO9 / 12 |
| PD_GOOD (active low) | GPIO10 / 13 |
| VM_SENSE | ADC2 / GPIO28 / 40 |
| DATA_PRESENT | ADC3 / GPIO29 / 41 |
| SWCLK / SWDIO | 24 / 25 |
| RUN | 26 |
| USB DM / DP | 46 / 47, through 27 Ω resistors |

On reset, pull-ups/pull-downs disable the A4988. Initialize outputs disabled; require PG and measured VM within an accepted 15 V window, then wake the driver and respect its timing before enabling. Monitor supply loss and shut down immediately. Keep USB pull-up disconnected without DATA_PRESENT. Start with low speed; the 24 mH motor inductance and actual torque/load set speed limits.

Full steps: 400/revolution. Configured 1/16 microsteps: 6400/revolution. No USB protocol/application firmware is implemented.

The separate bare top-side pads are TP_3V3, TP_GND, TP_SWCLK, TP_SWDIO, TP_RUN, TP_BOOT and TP_BOOT_GND. Short TP_BOOT to TP_BOOT_GND to pull flash CS low through 1 kΩ; hold the short while asserting/releasing TP_RUN to enter ROM USB boot. Never leave the short during ordinary flash operation. The former J_DEBUG/J_BOOT strips are absent from v1.8.2.

For factory ROM USB boot entry, see [USB programming](usb-programming.md). This hardware contract does not supply a motor-control application.

Motor voltage conversion: `VM_V = VM_SENSE_V × 11` for the reviewed 100 kΩ/10 kΩ divider. Update/calibrate firmware accordingly; the former ×(122/22) conversion is obsolete.