cancel
Showing results for 
Search instead for 
Did you mean: 

how to use speed_pos_fdbk.c to get current speed of motor ( development board EVALKIT-ROBOT-1)

CYu-X.1
Associate

Hello everyone, How to get current speed of motor,useing  speed_pos_fdbk.c  ,i try to use the functions in fig2 SPD_GetElSpeedDpp but I don't Know how to get the control Period ,It is written in the comments to use the SPD_CalcElectricalAngle ,but i can't find it 。or is there another way to get current speed of motor。

Thank you very much

0693W00000aH8zZQAS.png

0693W00000aH8yvQAC.jpg​ (fig1)​ motor Specification

0693W00000aH8z0QAC.jpg(fig2)​

3 REPLIES 3
FouadB
ST Employee

We would like to sincerely apologize for the delay in replying to your post.
If your point is still relevant, all of the APIs are defined in the mc_api.[c,h] file.
To obtain the current average speed of the motor, use the following API: MC_GetMecSpeedAverageMotor1().
This API returns the most recent calculated average mechanical rotor speed, expressed in the unit specified by #SPEED_UNIT.
For instance, if RPM is the chosen unit, SPEED_UNIT should be defined as 60.

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

Hi @FouadB ,

When I use MC_GetMecSpeedReferenceMotor1(), I get the values up until 65, and then rolls over to 0 and starts fresh (even though the RPM is going north of 3500). 

How, can I convert MC_GetMecSpeedReferenceMotor1() into RPM values.

Hi MMoha.10,

If you want to retrieve your reference speed directly in RPM units without any conversion, you can use the following API: MC_GetMecSpeedReferenceMotor1_F().
For the average mechanical rotor speed in RPM units, you can also use the following API: MC_GetAverageMecSpeedMotor1_F().

I hope this answers your question.
Regards

 

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