Skip to main content
KKrag.1
Associate
October 30, 2020
Solved

How to run motor in Open Loop

  • October 30, 2020
  • 6 replies
  • 4451 views

Hi

I am running on a STM32G071 board, with my own custom HW (standard 3 phase halfbridge). The control is FOC sensorless with 1 shunt

I am having problems tuning the motor, but for starters I would like to run the motor at low speed in open loop

I can find a parameter in the IOC file name Open_Loop_FOC which I can set to "true"

But how do I set the operating conditions and how do I start the motor in Open loop mode?

(I am running MCWB 5.4.1.19309 (I have tried 5.4.4, but it seems to be unstable. STM32CubeIDE 1.4.2 and STM32CubeMX 6.0.1)

Regards

Klaus

This topic has been closed for replies.
Best answer by AntoineC

Hello,

I think you have this issue due to the use of an old version of the MC Workbench.

The issue is in drive_parameters.h, be sure to have these declarations:

0693W000005A4MkQAK.png 

Best Regards,

Antoine

6 replies

AntoineC
ST Employee
November 2, 2020

Hello KKrag.1,

To run a motor in open loop, as you said you need to set "OPEN_LOOP_FOC" to true in the IOC file and generate the project with STM32CubeMx.

In your project, you can find:

  • in drive_parameters.h: open loop parameters
  • in mc_task.c, in the medium frequency task, at START state, the open loop algorithm is performed

To control your application, you can use functions in mc_api.c.

For example, to start your motor, you can call MC_StartMotor1(void).

Let me know if you need more detailed explanation.

Best Regards,

Antoine

KKrag.1
KKrag.1Author
Associate
November 2, 2020

Hi Antoine

Thanks for the answer

When I change the Open_Loop_FOC to "true", I get compile time errors:

mc_config.c:135:67: error: 'PHASE2_FINAL_SPEED_UNIT' undeclared here (not in a function); did you mean 'PHASE1_FINAL_SPEED_UNIT'?

                             {(uint16_t)PHASE2_DURATION,(int16_t)(PHASE2_FINAL_SPEED_UNIT),(int16_t)PHASE2_FINAL_CURRENT,&RevUpControlM1.ParamsData[2]},

                                                                  ^~~~~~~~~~~~~~~~~~~~~~~

                                                                  PHASE1_FINAL_SPEED_UNIT

mc_config.c:136:67: error: 'PHASE3_FINAL_SPEED_UNIT' undeclared here (not in a function); did you mean 'PHASE2_FINAL_SPEED_UNIT'?

                             {(uint16_t)PHASE3_DURATION,(int16_t)(PHASE3_FINAL_SPEED_UNIT),(int16_t)PHASE3_FINAL_CURRENT,&RevUpControlM1.ParamsData[3]},

                                                                  ^~~~~~~~~~~~~~~~~~~~~~~

                                                                  PHASE2_FINAL_SPEED_UNIT

mc_config.c:137:67: error: 'PHASE4_FINAL_SPEED_UNIT' undeclared here (not in a function); did you mean 'PHASE3_FINAL_SPEED_UNIT'?

                             {(uint16_t)PHASE4_DURATION,(int16_t)(PHASE4_FINAL_SPEED_UNIT),(int16_t)PHASE4_FINAL_CURRENT,&RevUpControlM1.ParamsData[4]},

Any hint to how to avoid those?

Thanks

Klaus

AntoineC
AntoineCBest answer
ST Employee
November 2, 2020

Hello,

I think you have this issue due to the use of an old version of the MC Workbench.

The issue is in drive_parameters.h, be sure to have these declarations:

0693W000005A4MkQAK.png 

Best Regards,

Antoine

Cristiana SCARAMEL
Technical Moderator
November 9, 2020

Hello @Community member​,

Antoine’s answers finally solved your problem?

If yes please click on the 'Select as Best' button in the proper reply.

"If you feel a post has answered your question, please click ""Accept as Solution"""
SpinKernel
Associate III
July 15, 2022

Looking for this OPEN_LOOP_FOC, but not finding it. Runing 5.y.4

0693W00000QLIUoQAP.png

ALedi.1
Associate III
July 20, 2022

you need to open the .ioc file in editor and search for OPEN_LOOP_FOC 0693W00000QLc9lQAD.png

SpinKernel
Associate III
July 20, 2022

Thank you! I did find this and have it functioning. Curious why this isn't in the gui?