Stuck Sensor
You inherited a fixed-point field-oriented speed controller for a three-phase PMSM drive. Every 100 microseconds it reads the phase currents and the rotor's electrical sector, rotates the currents into the rotor frame, runs a cascaded current/speed control law, and rotates the commanded voltages back out to the three phase modulations. The inner dq current loops regulate the winding current toward the torque the outer speed loop asks for.
On the bench it holds its commanded speed cleanly. But a colleague reports that on a longer soak the machine sometimes goes haywire — the windings run far hotter than the torque should ever demand, the shaft speed sags well off the setpoint, and the inverter eventually trips its overcurrent protection — and nothing is ever reported about why. The failure is intermittent: it only shows up once a run has been going for a while.
The culprit is a current sensor that fails STUCK: partway through a run it freezes at a fixed reading while the true winding current moves on, and the controller feeds that frozen value straight into the current loop, which then chases a phantom error. The commanded speed is delivered in an SRAM mailbox at 0x2000FF00 in milli-RPM (8,000,000 mRPM is 8,000 RPM). The sensed phase currents are reported in IA/IB/IC, the rotor's electrical sector in SECTOR, and the measured speed in SPEED. The FAULT register carries a report path: writing its REPORT strobe (bit 16) latches a SENSE_DETECTED flag so a supervisor can see the drive noticed the fault. The bring-up, the angle estimation, the transforms, the control tuning, and the reporting path are all correct.
Find how the firmware can tell a phase-current sensor has gone stuck, and fix it so the drive detects the fault, reports it, AND keeps the machine running safely at the commanded speed — do not just trust the frozen reading until the winding current runs away.