cancel
Showing results for 
Search instead for 
Did you mean: 

How can I use the API for HSO to set the new speed and accelerat duration?

JGrap.1
Associate III

Hello,

I've use

X-CUBE-MCSDK v6.4.1

B-G473E-ZEST1S + STEVAL-LVLP01 + B-MOTOR-PMSMA1

with the HSO.

I can make it run with the GUI. But can't start the motor with API.

In the legacy, I use MC_ProgramSpeedRampMotor1(100, 1000); for 600 rpm within 1000 ms.

For HSO, I can't find the same API, but found that may need to use these:

MC_SetAccelerationMotor1()
MC_SetSpeedReferenceMotor1()

The question is how to calculate the value passing to these API, I found it different from the legacy.

 

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions

Hello Gael,

I'd like to inform you that the API you recommend are working for me.

I use:

MC_SetSpeedReferenceMotor1_F(95);

MC_SetAccelerationMotor1_F(3000);

MC_StartMotor1();

HAL_Delay(8000);

 

MC_StopMotor1();

HAL_Delay(2000);

 

MC_SetSpeedReferenceMotor1_F(-95);

MC_SetAccelerationMotor1_F(3000);

MC_StartMotor1();

HAL_Delay(8000);

 

MC_StopMotor1();

HAL_Delay(2000);

to test running motor forward and reverse.

 

Thank you.

View solution in original post

3 REPLIES 3
Gael A
ST Employee

Hello JGrap.1,

I recommend using MC_SetSpeedReferenceMotor1_F() and MC_SetAccelerationMotor1_F().
The first one takes Electrical Hz as speed argument, and the second one takes Electrical Hz per Second as ramp argument.

 

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,

I'll try it.

Thank you.

Hello Gael,

I'd like to inform you that the API you recommend are working for me.

I use:

MC_SetSpeedReferenceMotor1_F(95);

MC_SetAccelerationMotor1_F(3000);

MC_StartMotor1();

HAL_Delay(8000);

 

MC_StopMotor1();

HAL_Delay(2000);

 

MC_SetSpeedReferenceMotor1_F(-95);

MC_SetAccelerationMotor1_F(3000);

MC_StartMotor1();

HAL_Delay(8000);

 

MC_StopMotor1();

HAL_Delay(2000);

to test running motor forward and reverse.

 

Thank you.