cancel
Showing results for 
Search instead for 
Did you mean: 

Speed Mode in MCSDK (custom board, software of B-G431B-ESC1) is not working

SRedd.5
Senior III

Hi all,

I am using the software generated from MCSDK motor control and a custom board, I am able to successfully make it work for the torque control mode, for different Iq values the DC power supply current is varying.

But i am facing problem with speed control mode, i gave the following command in closed loopMC_ProgramSpeedRampMotor1(((int16_t)g_targetspeed_s16 * ((int16_t)SPEED_UNIT)) / (int16_t)U_RPM, 0);

Any value i give for g_targetspeed_s16 the motor settles to the same speed for example if i give 10, 50 it goes and settles to the same speed. Why? I am finding some invalid switching. Is it because of that?

1 ACCEPTED SOLUTION

Accepted Solutions
Gael A
ST Employee

Hello SRedd.5,


The MC_ProgramSpeedRampMotor1 function should work as intended. However I have a few remarks :

- The name g_targetspeed_s16 is startling me, as how you wrote it, this value should be in RPM unit, and not in s16 unit (it is then converted to SPEED_UNIT with the small calculus you wrote). 

- I don't know what kind of motor you are using but be aware that in closed loop the FW does not cope well with small speed values. You usually need a much bigger speed command than 10 or 50 rpm.

- Please make sure via debugging that the function is indeed called at some point by firmware, because I see no problem on the latest MCSDK version (6.1.2) when writing the function in main.c in the while(1) loop.


Hoping this will help,
Gaël A.

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

1 REPLY 1
Gael A
ST Employee

Hello SRedd.5,


The MC_ProgramSpeedRampMotor1 function should work as intended. However I have a few remarks :

- The name g_targetspeed_s16 is startling me, as how you wrote it, this value should be in RPM unit, and not in s16 unit (it is then converted to SPEED_UNIT with the small calculus you wrote). 

- I don't know what kind of motor you are using but be aware that in closed loop the FW does not cope well with small speed values. You usually need a much bigger speed command than 10 or 50 rpm.

- Please make sure via debugging that the function is indeed called at some point by firmware, because I see no problem on the latest MCSDK version (6.1.2) when writing the function in main.c in the while(1) loop.


Hoping this will help,
Gaël A.

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

Hope this will help,
Gaël A.