cancel
Showing results for 
Search instead for 
Did you mean: 

How can I drive the motor with the open loop APIs

DF_MC
Associate III

Hello Everybody,

MCSDK:6.3.2

CubeMX: 6.1.4

Workbench : 6.3.2

 

I want to test the motor first with the open loop APIs. I follow the instructions of the user mannual and write the code as follows:

code1.jpg

My question is: I captured the U, V, and W three-phase waveforms using an oscilloscope and found that the duty cycle settings are correct. However, the waveforms remain stuck in only one section (they never change) and fail to drive the motor through all six sections. Could you help analyze what might be causing this issue? Thanks!

5 REPLIES 5
Gael A
ST Employee

Hello DF_MC,

I am not sure I understand your case. Could you please provide the oscilloscope's waveform and explain it again with the data you provide ?

In addition, I tried your piece of code for a single motor with MCSDK 6.3.2, and a custom setup, and everything works on my side. Could you please also provide info on the setup you are using (board(s) and motor) ?

If you agree with my answer, please consider accepting it by clicking on 'Accept as solution'.

Hope this will help,
Gaël A.

Hello Gaël,

Thank you for your reply. The oscilloscope waveform is attached. The generated PWM signal appears to be fixed in a specific section and does not change. The blue waveform represents the U-phase signal, while the yellow waveform represents the W-phase signal. The U-phase waveform differs from those of V and W, whereas the V and W waveforms are identical. I also observed the PWM signal pins on the MCU using an oscilloscope. The MCU's signal indeed remains unchanged, which causes the three-phase U/V/W signals from the motor driver to remain unchanged as well. Therefore, I believe the issue lies within the program. Could you please help analyze what might be causing this? 

Thanks a lot!

yellow_W_blue_U.jpg

Hello Gaël,

After reviewing the MCSDK-generated code, I found that the FOC_CurrControllerM1 function handles PWM generation. However, on line 28, the used macro REV_PARK_ANGLE_COMPENSATION_FACTOR is defined as 0, which prevents hElAngle from updating throughout the process. This explains why the PWM signal remains unchanged.

Could you advise what value should be assigned to REV_PARK_ANGLE_COMPENSATION_FACTOR to resolve this issue?

Thanks a lot!

code2.jpg

Gael A
ST Employee

Hello DF_MC,

The REV_PARK_ANGLE_COMPENSATION_FACTOR is a parameter set to 0 by default as it corresponds at a specific feature which is not relevant for Open Loop. This factor is meant to be used when the speed is so high that the movement of the rotor between the sampling and the setting of the command needs to be taken into account.


To be able to understand your issue more precisely, could you please have a look at the following questions ?

Can you please have a look at a broader picture of the duty cycles to make sure the duties always stay identical ?Can you have a look at the current waveforms to be sure ?
Are you sure your reference speed is taken into account ? Have you tried increasing the target speed ?

If you agree with my answer, please consider accepting it by clicking on 'Accept as solution'.

Hope this will help,
Gaël A.

Hello Gaël,

Thanks for your reply. I will check it again! 

Thanks a lot!