Showing results for 
Search instead for 
Did you mean: 

Understanding PLL State Observer

Associate III

Hardware: EVSPIN32G4-Dual

Motors: 2x Moons BLDC R57BLB50L2, Hall-effect sensors not connected or desired.

Application - 2x BLDC on shared timing pulley (no slip) system.  1:1 pulley ratio between motors.  Goal: equal load distribution between the two motors

Current Sense model: single shunt PLL for each motor


I currently rev-up with Motor 1, and after Motor1 is running and stable, I use the second motor in torque mode, driving torque reference with feedback from the Motor 1.

I would like to be able to perform a calibration that would read the electrical angle difference of the mounting of the two motors, then use that offset to perform a startup procedure with both motors at the same time.  While both rotors are running, I read use MC_GetElAngledppMotor1() and MC_GetElAngledppMotor2().  I take a measurement every 50ms, find the difference, and store it in a buffer.  For development, I am using the debugger to break the code and read from the buffer.  I expect to get a consistent angle difference, as the two motors are unable to spin relative to each other, but I get wildly varying values.

I was reading in sto_pll_speed_pos_fdbk.c, and am trying to make sense of the detection algorithm reasoning.  From reading about single-shunt topology, I understand that the hardware should be able to extract all three phase currents from a single shunt resistor, and these currents are used as speed/position feedback, and I assume that the rotor position and speed should be able to be inferred from that information.

What I see is that the position is not calculated directly from the momentary currents, but rather computed integral of the calculated speed.  This process may cause drift and may be causing my inconsistent angle measurements.

So, here are my questions regarding your PLL state observer:
1: How do I convert from the int16 output of MC_GetElAngledppMotor2 to an angle in degrees (0-360)

2: What is the reasoning behind calculating the rotor position as the integral of the calculated speed, rather than directly.  Is this a hardware limitation?  If so, would other hardware give a more reliable angle measurement.

Gael A
ST Employee

Hello ccut93,

You can find the PLL theory description in the MCSDK User Manual (Open WorkBench -> About -> Documentations -> Documentation -> in the newly open browser window click on User Manual -> Speed & position feedback sensorless algorithms
I don't really understand what you mean by calculating angle directly. Using dpp units, the integration becomes a single addition, and this is more than enough for most use cases. Applications such as the one you are describing would benefit greatly from sensors, as I doubt you can achieve such precision using STO PLL algorithm.

Concerning the conversion from int16 to degrees, you can check the User Manual, in Measurement Units used by the firmware.

If you agree with my answer, please consider accepting it by clicking on 'Accept as solution'.

Hope this will help,
Gaël A.