cancel
Showing results for 
Search instead for 
Did you mean: 

6-step commutation with hall-effect sensors not updating PWM in v6.4.1

jovijuan
Associate III

I was testing a BLDC motor with Hall-effect sensors at very low speed. This worked ok with v6.3.2, but with v6.4.1, if the speed reference is low, the motor don't even start.

If I manually move the motor, sometimes it starts and sometimes it throws an overcurrent error.

It looks like the PID is integrating, but not actual PWM's are being sent to the motor.

I checked that, when movement starts, HALL_ReadState (called via multiple functions from TSK_MediumFrequencyTaskM1 when State is CHARGE_BOOT_CAP) sets pHandle->SensorIsReliable = false because the hall state was the same as previous call to ReadState so I modified ReadState so that, when the state is the same as before, it was not labeled as unreliable, but motor still doesn't start.

I'm going to dig deeper on it. 

1 REPLY 1
jovijuan
Associate III

Ok, it was quick. It looks like the bridge PWM is only updated on movement start and, later, on Hall-effect sensor commutations. So if initial duty cycle is low, the motor never starts unless it is manually moved.

But this is wrong even at higher speeds, as duty cycle calculated in control loop is not updated into PWM until the next Hall-sensor state change.

This is actual code for State == RUN inside TSK_MediumFrequencyTaskM1() in mc_tasks_sixstep.c file:

        case RUN:
        {
          if (MCI_STOP == Mci[M1].DirectCommand)
          {
            TSK_MF_StopProcessing(M1);
          }
          else
          {
            /* USER CODE BEGIN MediumFrequencyTask M1 2 */

            /* USER CODE END MediumFrequencyTask M1 2 */

            MCI_ExecBufferedCommands(&Mci[M1]); /* Exec the speed ramp after changing of the speed sensor */
            SixStepVars[M1].DutyCycleRef = SDC_CalcSpeedReference(pSDC[M1]);

            if(!IsSpeedReliable)
            {
              MCI_FaultProcessing(&Mci[M1], MC_SPEED_FDBK, 0);
            }
            else
            {
              /* Nothing to do */
            }
          }
          break;
        }

 

 

If I just add:

PWMC_SetPhaseVoltage(pwmcHandle[M1], SixStepVars[M1].DutyCycleRef);

right under the line where DutyCycleRef was calculated, the motor starts correctly.

I'm not sure if this is the best way to fix it, though.

It still bothers me that, when the motor is completely stopped, the reported speed is still 30 rpm.