MustafaMulla29/rp2040-bldc-motor-controller-new

73×72 mm 4-layer USB‑C PD (5/9/15/20 V) RP2040 controller PCB with protected power switching, MCT8329A sensorless BLDC three-phase MOSFET bridge, USB data/programming, onboard controls, and three motor outputs feeding a 2212 motor through rigid bullet adapters.

Version
0.3.100
License
unset
Stars
0

manufacturing/prototype-programming.md

# Programming plan for the two assembled prototypes

**Factory delivery state: unprogrammed.** No tested motor image is supplied for
production flashing. The three bare PCBs receive no programming or parts.
The included `firmware-reference/` files are development source for the engineer,
not a factory programming job or a promise of a working motor on delivery.

## First power-up and PD provisioning

1. Record a unit ID, board revision and the package manifest hash. Inspect solder
   joints/orientations and check for supply shorts before applying power.
2. Disconnect the motor, set POWER/SW4 OFF and RV1 to zero. Use J1 DATA and a
   **5 V-only source** at J19 during initial checks. Verify the logic rail and
   VMOTOR with a meter; follow `bringup-acceptance.md`.
3. Install an RP2040-compatible MicroPython build through BOOTSEL/USB DATA or
   SWD, recording its version and binary hash. Copy the supplied Python modules
   into the MicroPython filesystem. Do not create an automatic `main.py`.
   Keep `motor_setup.PROFILE = None`.
4. Execute `provision_pd.py` from the REPL. It holds SPEED/ARM low, requires
   5 V-only input and a discharged motor bus, preserves the chip's original
   NVM as `pd-nvm-original.bin`, and programs/readbacks the default 9 V profile.
   Save the original NVM backup with this unit's records.
5. Remove **all** USB power. Reconnect only the same 5 V-only sources and run
   `verify_pd_boot.py` in a new interpreter session. Retain its result. Only
   after that passes proceed to an ordinary PD source with the motor disconnected.
6. Use the motor-disabled `power_manager.py` diagnostic for the documented PD
   checks. Verify 9 V cold startup and selected 5/9/15/20 V contracts with actual
   measurement. POWER stays OFF during voltage changes. Do not infer a successful
   contract from the requested value or the charger's maximum rating.

The scripts have host tests; these steps have **not** been executed on a board.
Do not treat a factory-default STUSB4500 as already programmed for our 9 V default.

## Knob preview and commissioning

With `PROFILE=None`, `import knob_app; knob_app.run()` reports knob movement
but leaves drive disabled. Run one application at a time. This is the initial
knob/ARM software state supplied in this package.

Before allowing motor operation, follow `knob-firmware.md`: identify the actual
motor, commission the MCT8329A configuration, measure ADC/current calibration,
establish phase-current and command limits, and record qualified voltage
profiles. Populate the profile only with these measured/validated values.
The firmware reads and verifies the driver configuration; it does not supply a
commissioned EEPROM image. Never fill these fields with guesses to enable ARM.

Record for each prototype: programmed binaries/source hashes, original PD NVM,
post-power-cycle PD readback, motor identity, all 24 MCT configuration words,
calibration measurements, voltage/phase-current limits and test results.
Use `bringup-acceptance.md` for OFF/ARM/fault, USB, power, temperature and stopping
checks. There is no qualified phase-current rating or guaranteed 5 V motor-load
envelope yet. SW4 has no direct position-feedback GPIO; its rapid OFF/ON behavior
is an explicit commissioning test in `knob-firmware.md`.

Firmware source is unchanged in this package refresh. The motor-enable lockout
remains intentional until commissioning is completed.