Hello,
Assuming the HW is working properly (MOSFETs switching as expected, Back-EMF measured as expected, current measured as expected), there is a need for tuning of:
- PI controllers (affects the dynamic behavior in the closed loop)
- motor speed scaling - please see this article: https://community.nxp.com/t5/S12-MagniV-Microcontrollers/BLDC-six-step-control-speed-scaling-using-S...
- start-up routine (to successfully go through the align-openLoop-closedLoop sequence). This is kind of tricky, because the sequence might be affected by the dynamics of your system. Motor at no-load situation behaves differently than with the load attached (friction and inertia). You would need to adjust at least ALIGNMENT_TIME, START_CMT_CNT, START_CMT_ACCELERATION, ALIGN_CURRENT_SCALED. It is very hard to say how to adjust it - please understand the SW and equations used in the start-up sequence first. It is very application- and motor-specific.
Also please consider the code as an example only. There are other ways how to run a BLDC motor in sensorless mode.
Best regards,
Matej