Skip to main content
Angelo Quattrociocchi
Associate III
April 30, 2025
Solved

STM32 Motor Control - need help finding/adjusting motion parameters

  • April 30, 2025
  • 2 replies
  • 706 views

[VERSION]: MCWB v6.3.2
[TOOL]: STM32CubeMX v6.13.0, STM32CubeIDE v1.11.5
[BOARD]: STEVAL-PTOOL1V1
[PROJECT]: STEVAL-PTOOL1V1_6S_SL

I have the code generated by MotorControl Workbench compiling in STM32CubeIDE and it programs and runs the motor.  I managed to get the motor running at the speed I want, but I've been having a hard time making some adjustments to the parameters which are distributed through various folders and files.  In particular, I want to change the initial acceleration rate after boot up.  How/where is this controlled?

Thanks

2 replies

Associate II
April 30, 2025

Hey @Angelo Quattrociocchi .

You can refer to drive_parameters.h (see this screenshot)

Regards!

Screenshot 2025-04-30 102400.jpg

Angelo Quattrociocchi
Associate III
April 30, 2025

Thanks for your reply.  I've been trying to adjust many of the values in that file as well as many others, but am not able to change the acceleration.

ADAVE.1
ST Employee
May 2, 2025

Hello @Angelo Quattrociocchi 

In drive_parameters.h file, you can change the acceleration by acting on the below table with the following considerations:

- Phase 1 is the alignment step: its final speed must be 0

- At least three steps must be configured

- OBS_MINIMUM_SPEED_RPM must be less than the final speed of the last acceleration step

 

/****************************** START-UP PARAMETERS **********************/

/* Phase 1 */
#define PHASE1_DURATION 500 /* milliseconds */
#define PHASE1_FINAL_SPEED_UNIT (0*SPEED_UNIT/U_RPM)
#define PHASE1_VOLTAGE_RMS 4.15

/* Phase 2 */
#define PHASE2_DURATION 1000 /* milliseconds */
#define PHASE2_FINAL_SPEED_UNIT (600*SPEED_UNIT/U_RPM)
#define PHASE2_VOLTAGE_RMS 10.41

/* Phase 3 */
#define PHASE3_DURATION 500 /* milliseconds */
#define PHASE3_FINAL_SPEED_UNIT (600*SPEED_UNIT/U_RPM)
#define PHASE3_VOLTAGE_RMS 10.41

Regards

Angelo Quattrociocchi
Associate III
May 2, 2025

Thank you ADAVE.1, I have been adjusting those values to try to get it working smoother, but don't really know what I am doing.  Is there some documentation or reference information on how these phases work?

I also still get the motor just stopping sometimes.  Adjusting the tuning parameters can help, but it's still happening sometimes.  I tried to look through the code and headers to see where or why but haven't been able to get rid of it.  The serial Motor Pilot application doesn't seem to show values from the board correctly so it's not helpful.

Thanks