Standstill

A colleague wrote the first pass at the drive firmware for a small brushless motor running six-step (trapezoidal) commutation, and it does not work. This is bring-up: a brushless motor only makes torque when the bridge energizes the voltage vector that leads the rotor, so every 100 microseconds the loop is meant to read the rotor's electrical sector (0 through 5), look up the phase-sign pattern to drive in a six-entry commutation table, scale it by a duty the speed loop eases toward the commanded speed, and write the three phase modulations.

Commanded to speed, the motor never turns. The shaft twitches, locks in place, and buzzes. The windings heat up fast and the drive trips its overcurrent protection, all without the rotor ever spinning up. It behaves the same no matter where the rotor happens to be resting when it starts. The commutation table is the standard six-step sequence and the speed law is fine.

The commanded speed arrives in an SRAM mailbox at 0x2000FF00 in milli-RPM (4,000,000 mRPM is 4,000 RPM). The rotor's present electrical sector is reported in SECTOR (0 through 5) and the measured speed in SPEED. The bring-up, the SysTick arming, the speed loop, and the reporting are all correct — a healthy drive prints "MOTOR" at start and "DONE" when the run ends.

Find why the motor locks up and pulls so much current instead of spinning, and fix it so it spins up smoothly to the commanded speed from whatever position the rotor starts in.

Loading the interactive arena.