cancel
Showing results for 
Search instead for 
Did you mean: 

How to run motor in Open Loop

KKrag.1
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions
AntoineC
ST Employee

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

View solution in original post

7 REPLIES 7
AntoineC
ST Employee

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
Associate II

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
ST Employee

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
ST Employee

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
Senior

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

0693W00000QLIUoQAP.png

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

SpinKernel
Senior

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