I'm still working on a sensorless (HFI) IPMSM which should run between 0-90RPM with a STM32F4xx. The HFI algorithm estimates the angle successfully and I can control the motor quite ok (both in Torque mode and Speed mode).
The problem I'm having right now is that the motor sometimes starts running in the wrong direction. If I apply a positive torque, the motor turns in the right direction and returns a positive speed, but if I give it zero torque (not necessarily a Stop Motor command) and then again a positive torque, after a couple of attempts it goes in the opposite direction. The algorithm detects a negative speed in this case, the angle evolution is shown as it actually is, but stays in this direction until I give it zero torque and try the procedure again a couple of times. And if I increment the torque, it applies it correctly (I can feel the torque in the motor is increased) but in the wrong direction.
What I've tried so far is applying the torque as a ramp or changing the Current PI gains, and that does not solve the problem. That's why I'm doubting again of some issue in the HFI algorithm, which might not be correctly tuned. That something is introducing a considerable offset in the estimated angle or so.
Even though the HFI angle estimation seems to be ok after the motor is started, I got some doubts when I tuned it.
For example, in step 4)b) I could manage to get a proper evolution in HFI Debug angle signal, but even though the signal seems to converge in the first stage of initialization, it is interrupted and gives a Speed Feedback Error. I couldn't solve this by changing the PI gains, so I left it this way for now and have to retry initialization two or three times in the worst case (in certain rotor positions).
Then, step 4)c) might have some issues as well. The HFI Saturation Difference shows very different values after different start commands (-400, 2200, -600, 1800, etc). I don't know what this number means (how it is related to the current. Is this a percentage? 32767 would be 100% of the nominal current set? Is this relative to the value the ADC "can" read in its whole range?), and I don't get the described results when incrementing Amplitude Boost, so I can not fill the "Min saturation difference" field.
Might these issues be related to the motor not running in the commanded direction?
Are there some extra references I could get about HFI? I couldn't find any in ST's pdfs. I did find some papers which introduce and explain the method, but they are not so useful for tuning it or understanding these aspects. The UM1052 and the other pdfs are not so accurate in some details.
Could I get some assistance here? Thank you in advance.
EDIT: Confirmed, at least one of the problems seems to be a 180 deg offset in the estimated angle (I changed the subject). If I run the motor in Debug Mode (rotor still) and observe in the oscilloscope the estimated angle, after a couple of Run-Stop attempts the angle changes from the "correct value" to one moved 180 electrical deg. If I try again, the angle returns to the correct value once again after one or more attempts.