2025-01-21 05:49 AM
Hello Everybody,
MCSDK:6.3.0
CubeMX: 6.3.0
Workbench : 6.3.0
Motor Pilot : 1.2.9
Power Board : IHM08M1(Rshunt=0.01Ω)
Control Board : NUCLEO-G431RB
Motor : BLDC 26w 24v/8 pole pairs / rpm=4k / rated current=1.8A/hall sensor
I am currently testing torque control, and I am a bit confused about the hFinalTorque setting in the MC_ProgramTorqueRampMotor1 API.
I would like to set the Target Torque to 0.02.
According to the formula provided in the API:
current(digit) = (0.02 * 65536 * 0.01Ω * 5.18) / 3.3 = 20.57 (rounded to 21)
Should hFinalTorque be set to 21 or 210?
Additionally, do I need to manually enable the timer and PWM? (I have already used the Workbench to generate code and CubeMX to generate the project.)
Solved! Go to Solution.
2025-02-03 12:17 AM
Hello Everybody,
The issue has been resolved, and the motor can now run continuously.
The root cause was that the torque value set during the initialization call to MC_ProgramTorqueRampMotor1_F() was too close to the torque value set inside the while loop.
As a result, the power supply showed that it was still drawing a small load (about 0.015A), and when holding the motor by hand, I could feel slight vibrations, but the motor was not rotating.
After increasing the torque value in the MC_ProgramTorqueRampMotor1_F() or MC_SetCurrentReferenceMotor1_F() call inside the while loop, the motor was finally able to run continuously.
For someone like me who is new to FOC and even motor control, this has been a valuable hands-on experience.
This issue might seem like a basic mistake, but I still want to share the cause behind it. Hopefully, it can help others who are in the same situation as I was!
2025-01-22 01:40 AM
Hello Everybody,
When I execute MC_ProgramTorqueRampMotor1(Set_FinalTor, Set_Duration), the motor runs for a few seconds and then shows fault code 32. According to online resources, it is said to be a software issue. However, I only executed the following commands:
MC_ProgramTorqueRampMotor1(Set_FinalTor,Set_Duration);
MC_StopMotor1();
The rest of the code is generated from the project. May I know which direction I should take to debug this issue?
2025-01-22 06:47 AM
Hello @Vincent7,
You can use MC_ProgramTorqueRampMotor1_F() that uses a float Ampere format as input parameter.
2025-01-22 07:00 AM
Hello @Vincent7,
I assume that you used MC_StartMotor1() api previously at MC_StopMotor1() call.
Fault code 32 (0x20) means Speed feedback (MC_SPEED_FDBK). Using HALL sensor feature, check that HALL sensor is correctly connected.
2025-01-22 07:38 AM
Hello GMA,
Thank you for your reply.
When I used the API to test torque mode, I first used Motor Pilot to tune the parameters. During the tuning process, I noticed that if the Torque Reference remained at 0 or around < 0.2, the "speed feedback" fault would indeed occur when starting, unless I increased the Torque Reference slightly higher.
Now that I am testing with the API, should I still consider the Torque Reference value set in Motor Pilot?
2025-01-22 07:54 AM
Hello @Vincent7,
FinalTorque of MC_ProgramTorqueRampMotor1_F() api or Motor Pilot "Torque Ramp/Target Torque" are aligned.
2025-01-22 04:55 PM
Hello GMA,
Thank you for your reply.
I will try increasing the current to test again.
Additionally, do I need to manually enable the timer and PWM? (I have already used the Workbench to generate code and CubeMX to generate the project.)I did not manually enable the timer and PWM, but the motor still rotates.(ven though fault code 32 occurred.)
2025-01-28 04:13 AM
Hello Everybody,
2025-01-28 07:50 AM
Hello @Vincent7,
As mentioned in MC_ProgramTorqueRampMotor1_F() function header: " A torque ramp is a linear change from the current torque reference to the FinalTorque target torque reference".
From boot, "Current Torque" is null. On other cases, the latest Trorque value command will be used.
Did you previously used another command before "MC_ProgramTorqueRampMotor1_F(0.02,2000);"?
2025-01-29 07:06 AM
Hello GMA,
Thank you for your reply.