Skip to main content
Associate
February 27, 2024
Question

Changing desired torque at run time

  • February 27, 2024
  • 2 replies
  • 1277 views

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

 

2 replies

Gael A
ST Employee
February 28, 2024

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.
nonameXAuthor
Associate
March 1, 2024

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
March 1, 2024

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.
Visitor II
November 19, 2024

What are the units of that Final torque in that function, any idea?