cancel
Showing results for 
Search instead for 
Did you mean: 

Six-Step Bug

Leo4
Associate II

Hello,

i found a bug in the code generated by the Motor Control Workbench usign the 6-step algorithm. Even with Open Loop mode enabled, the code is still using the PID for the initial duty cycle computation (state CHARGE_BOOT_CAP in the TSK_MediumFrequencyTaskM1()). If the PID isn't set up right and starts with a low duty cycle, the motor won't turn. This means the Hall sensors don't trigger, the duty cycle never updating, and the motor just sits there even if you set a high duty cycle value. The Open Loop mode shall bypass the PID controller, otherwise it is useless. 

I fixed it by changing row 174 of mc_tasks_sixstep.c as follows:

from: 

MCI_ExecBufferedCommands(&Mci[M1]); /* Exec the speed ramp after changing of the speed sensor */

to:

if (SDC_GetOpenLoopFlag(pOLS[M1]))
{
  SDC_SetControlMode(pSDC[M1], MCM_DUTY_MODE);
}
else
{
  MCI_ExecBufferedCommands(&Mci[M1]); /* Exec the speed ramp after changing of the speed sensor */
}

Leo

Edited to apply source code formatting - please see How to insert source code

1 REPLY 1
Fabrice LOUBEYRE
ST Employee

Hi @Leo4 , thank you for your observation regarding the open-loop feature of the 6-step firmware. We will consider it for future releases.

Best regards.

Fabrice