cancel
Showing results for 
Search instead for 
Did you mean: 

Changing desired torque at run time

nonameX
Associate

Dear all,

I have a NUCLEO-F302R8 and the X-NUCLEO-IHM07M1 motor driver expansion board. I have a three phase BLDC motor with an encoder attached to it. I want to implement a torque controller. I am able to use the workbench software to implement the torque controller and set the desired torque. This works fine. However, I want to be able to adjust the desired torque in the while loop of the main function. Unfortunately, I am not able to achieve this. Do you have any ideas on how to achieve it?

nonameX_0-1709053114559.png

 

3 REPLIES 3
Gael A
ST Employee

Hello nonameX,

In the mc_api.c file, you should be able to find the MC_ProgramTorqueRampMotor1(int16_t hFinalTorque, uint16_t hDurationms) function that will allow you to program a Torque ramp for your motor.

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

Hope this will help,
Gaël A.

If I use the function MC_ProgramTorqueRampMotor1 the ramp is done but then the motor stops spinning. Is there a possibility to set a constant reference torque that the motor tries to keep until a new command comes in? I am not able to find something

Gael A
ST Employee

Hello nonameX,

If the motor stops spinning at the end of the Torque Ramp, then I believe it is because a fault has occurred. Have you tried connecting the MotorPilot to see which error is returned ?

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

Hope this will help,
Gaël A.