Skip to main content
Associate II
March 18, 2026
Question

STSPIN32G4: No spin with encoder as main sensor

  • March 18, 2026
  • 3 replies
  • 381 views

[PN]: STSPIN32G4 (custom board), AMT103 encoder
[VERSION]: MCSDK v6.4.1
[TOOL]: MC WB

[DETAILS]:
I need to implement torque control for my custom board and BLDC motor using a quadrature encoder as the primary feedback sensor.

First, I successfully profiled my motor in sensorless mode using the SDK and incorporated those values into my Workbench project. When using this sensorless configuration outside of the Profiler, I can reliably drive my motor in both torque and speed control modes (using MC_FOC_SDK.qml). At this point I have also configured the encoder as an auxillary sensor, and can see its measured RPM in Motor Pilot match the sensorless RPM feedback. This encoder has an index pin, but I am not using it in my configuration since I do not want to run in Position Control mode.

Now, I have reconfigured my project to use the encoder as the primary sensor and "sensorless" as the auxillary. The result in torque control mode is that the rotor locks into place and resists manual spinning. This resistance increases alongside increased torque reference. If I use the Motor Pilot GUI to switch to sensorless mode, then the motor finally spins up. Switching back again to the encoder will make the motor stop and lock into place. In speed control mode the torque reference will creep up towards the motor's maximum rated current while the rotor remains locked into place.

I believe my problem lies in the encoder's "Start-up parameters", but adjusting the alignment angle or current ramp value does not seem to make a difference. Happy to test again if someone has insight to share here.

Any suggestions on what might be missing (or incorrect) in my configuration?

[EXPECTED BEHAVIOR]: When starting the motor with an encoder as the primary sensor, the motor should spin up in a way comparable to sensorless mode.

[HOW TO REPRODUCE]: The MC Workbench project file is attached to this post.

3 replies

GMA
Technical Moderator
March 18, 2026

Hello @ClyneModa,

Check that the motor phase U, V, and W, and the encoder phase A and B are correctly connected.
Using the speed sensor main as STO-PLL and the auxiliary encoder, plot both EL_ANGLE signals. Check that both signals are aligned.

If you agree with the answer, please accept it by clicking on 'Accept as solution'.Best regards.GMA
federico.rodighiero87
Explorer
March 19, 2026

motor profiler has its limit, try to tune motor manually and set encoder pulse correctly, remember the se the right pulse number, there are the typical x2,x4 scaling of CPR,PPR what front you read and so on.

HW/FW Motor Control Engineerhttps://www.linkedin.com/in/federicorodighiero/
ClyneModaAuthor
Associate II
March 27, 2026

Hi @GMA ,

Can you confirm if MCSDK is able to spin up a motor with an encoder as the main sensor?

I need the motor to be able to maintain constant torque at low or zero RPM, and be able to spin back up once the load is removed. I hope that this is something MCSDK is able to support using an encoder since sensorless control does not handle low/zero RPM well.

Any advice would be appreciated. Encoder RPM matches STO-PLL during sensorless operation, so I am confused as to why the motor halts when I attempt to switch sensors during RUN.

Thanks,
Clyne

GMA
Technical Moderator
March 27, 2026

Hello ,

When using the STO-PLL as the main sensor and the auxiliary encoder, decreasing the motor encoder pulses per mechanical revolution parameter by one results in the same drift on the electrical angles. The encoder speed appears correct; however, the motor magnetic field and the encoder are no longer aligned. Switching sensors, the motor stops.

If you agree with the answer, please accept it by clicking on 'Accept as solution'.Best regards.GMA
ClyneModaAuthor
Associate II
March 30, 2026

Hi @GMA ,

Okay.

Can you provide direction on how to spin up a motor with the encoder as the main sensor?

I have disabled the auxiliary sensor, so the firmware should only rely on the encoder now. When I press START, the motor begins to spin slowly, then decays to zero RPM with no fault. If I manually turn the motor, it begins to spin very slowly again, but still decays to zero RPM. On occasion, the motor will spin up again on its own again for a few seconds before stalling.

What are the relevant parameters for maintaining spin based on only the encoder? Can you make some recommendations on possible solutions to this problem?

ClyneModaAuthor
Associate II
April 14, 2026

Hi @GMA,

To the best of my knowledge, there is no issue with my encoder hardware or its configuration in MCSDK.

Do you have any explicit recommendations for achieving angle alignment and correct field generation? Should I re-evaluate the motor's Rs, Ls, Bemf characteristics (obtained from the Motor Profiler), or focus on tuning Kp/Ki values? Any resources or guides beyond the MCSDK documentation would be greatly appreciated.

This issue is now top priority for my client's project. If there is another path for direct product support from ST apart from this forum, then please let me know.

Thank you,
Clyne