cancel
Showing results for 
Search instead for 
Did you mean: 

STOPPING PMSM MOTOR

jocelync
Associate II

Hi,

We are using MCSDK_v5.Y.4. 

We would like to implement Stall Detection and are considering using the measured iq current (used in FOC) for detecting a motor stall. We intend to use a Stall_Detection_Threshold, which is just below the "Current_Limit" to detect when the iq current exceeds this threshold for a given duration of time: stall_time.

 

We would like to know if the following function, TSK_MF_StopProcessing(), is recommended to use for stopping the motor,

 

/**

 * @brief Performs stop process and update the state machine.This function

 *    shall be called only during medium frequency task

 */

void TSK_MF_StopProcessing( MCI_Handle_t * pHandle, uint8_t motor)

{

#ifdef REV_1

 R3_2_SwitchOffPWM(pwmcHandle[motor]);

#else

 ICS_SwitchOffPWM(pwmcHandle[motor]);

#endif

 FOC_Clear(motor);

 MPM_Clear((MotorPowMeas_Handle_t*) pMPM[motor]);

 TSK_SetStopPermanencyTimeM1(STOPPERMANENCY_TICKS);

 Mci[motor].State = STOP;

 return;

}

or is there a more immediate "process" or function to use to stop the motor.

From the description in the code, "the MCI_StopMotor() command is used just to begin the

stop motor procedure moving the state to ANY_STOP ". 

 

Thanks and Best wishes,

Jocelyn

1 ACCEPTED SOLUTION

Accepted Solutions
Gael A
ST Employee

Hello jocelync2,

Despite what you said concerning the MCI_StopMotor() command is true, it is nonetheless the safest way (and intended way) to stop a motor. You should have no delay issue and you will be able to easily restart your motor afterwards using the MCI_StartMotor() command.

On a different note, have you tried the latest MCSDK 6.2 version for your project ? It contains many firmware improvement both in stability and performance.

If you agree with my answer, please consider accepting it by clicking on 'Accept as solution'.

Hope this will help,
Gaël A.

View solution in original post

3 REPLIES 3
Gael A
ST Employee

Hello jocelync2,

Despite what you said concerning the MCI_StopMotor() command is true, it is nonetheless the safest way (and intended way) to stop a motor. You should have no delay issue and you will be able to easily restart your motor afterwards using the MCI_StartMotor() command.

On a different note, have you tried the latest MCSDK 6.2 version for your project ? It contains many firmware improvement both in stability and performance.

If you agree with my answer, please consider accepting it by clicking on 'Accept as solution'.

Hope this will help,
Gaël A.

Hello Gael,

Thank-you very much for your response and your suggestion to upgrade to MCSDK 6.2.

 

A further question regarding stopping PMSM motors:

          We would like to monitor the angular speed of the PMSM motor:  When the speed increases above a given limit, we would like to stop the motor immediately.

 

Further Question:   We were wondering where in the MCSDK_v5.Y.4 code, we should perform this monitoring task and then stop the motor when its angular speed exceeds upper limit.    We were thinking of performing this within the function:

                                                 FOC_CurrControllerM1(void),

in mc_tasks.c file, specifically, just before the application of the Torque PI_Controller stage.    The motivation is to perform this check, in a single location in the code (this monitoring of the speed and possibly stopping the motor), where the implementation is applicable for all modes (STC_TORQUE_MODE ,  STC_SPEED_MODE).

Would this be a good location to implement the monitoring and subsequently, stopping of the motor?  or is there a more appropriate location in the code to perform this?

 

Thanks-in-advance!

Best wishes,

Jocelyn

 

 

Hello jocelync,

The shaft speed is calculated during the MediumFrequencyTask and not the HighFrequencyTask, so I think it would be better to perform your monitoring around (or inside) the CalcAvrgMecSpeedUnit function at the beginning of the MediumFrequencyTask.

If you agree with my answer, please consider accepting it by clicking on 'Accept as solution'.

Hope this will help,
Gaël A.