Maybe a mixed control will work.
Low revs
Stepper motor (SVPWM)
High revs
6 step commutation
I understand the control in 6 step commutation, but in low revs I can not figure it out (using SVPWM).
In a stepper motor the switching frequency is related to the speed of rotation, but I can not understand how to make the PWM duty cycle adjustment ...
(please don't confuse terms - SVPWM is just describing a way to create three 120°-spaced sinusodial phase voltages. That's what FOC is using, and that's what is used in the video. FOC calculates the amplitude and orientation/frequency to turn the motor into a motor, and the guy from the video gives fixed amplitude (100%) and programmable frequency.)
At high revs, there is no advantage of 6-step commutation over FOC.
The problem with a stepper motor is that you always have to run it at maximum current, as it does not have a mechanism to detect its shaft load. If current is too low for the given load, it will "jump". If current is always max, it will quickly heat up. I don't think that this is a good strategy.
You can try this out by turning the ST FOC into a stepper controller:
a) forced rotor angle (here you can set the speed by changing the increment step) as already explained:
uint16_t FOC_CurrController(uint8_t bMotor)
{
Curr_Components Iab, Ialphabeta, Iqd;
#if defined(HFINJECTION) || (defined(DUALDRIVE) && defined(HFINJECTION2))
Curr_Components IqdHF = {0,0};
#endif
Volt_Components Valphabeta, Vqd;
int16_t hElAngledpp;
uint16_t hCodeError;
hElAngledpp = SPD_GetElAngle(STC_GetSpeedSensor(oSTC[bMotor]));
// <<<<<<<<<<<<<<<<<
if( StateM1 == RUN )
{
static int16_t k=0; k+=10; hElAngledpp=k;
}
// <<<<<<<<<<<<<<<<<
...
}
b) set controller to torque mode in STMCWB, and apply current.
This way the FOC algorithm will just create three sinusodial phase currents, rotating at a given frequency, no matter what the motor is doing. The encoder feedback is not used here.
Then, try to stop the output shaft and see how the motor "jumps".
I still think that the problem is neither the motor nor the control scheme, but a remaining problem with the voltage/current/mech_position relationships. I'm sure that you can find it.
One hint: when you try to turn the motor to do the Hall sensor measurements I proposed, can you extend the shaft with locking pliers or similar? I did that with the Maxxon motor, it had a similar output gear as your motor. You can attach the permanent magnet for the Hall sensor to its arm then.