cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure the motor open loop mode?

DF_MC
Associate III

hello everybody:

    l'm currently debugging the FOC motor with MC Workbench. Now I have generate the code with the open loop configuration. According to the user mannual, I can use the APIs in the code as follows:

------------------------------------

Firmware Usage via APIs

Step 1 : Choose Open Loop mode using MCI_SetOpenLoopVoltageMode(&Mci[motorID]) or MCI_SetOpenLoopCurrentMode(&Mci[motorID]) functions (MCI_SetOpenLoopCurrent and MCI_SetOpenLoopVoltage should be considered as deprecated there will be removed in the future).

Step 2 (Open Loop Voltage Mode only) : Set Voltage reference via OL_UpdateVoltage(&OpenLoop_ParamsMx,((Voltage_Reference * 32767) / 100)) function.

Step 2 bis (Open Loop Current Mode only) : Set Current reference via MCI_SetCurrentReferences(&Mci[motorID], Iqd) function. Mind that Iqd is a qd_t struct that needs to be given Id and Iq as parameters. Id is Flux Reference, whereas Iq is usually 0.

Step 3 : Set speed ramp via MCI_ExecSpeedRamp(&Mci[motorID],(int16_t)((Speed_rpm * SPEED_UNIT) / U_RPM), Duration_ms) function.

Step 4 : Start motor via MC_StartMotor**x**().

Bold pieces of text in functions are to be set by user according to his needs and system.

------------------------------

But I feel puzzled at the conflict between step 2 and step 3,  step 2 calls the api STC_SetControlMode(pHandle->pSTC, MCM_OPEN_LOOP_VOLTAGE_MODE) and sets the working mode to open loop, while step 3 calls the api STC_SetControlMode(pHandle->pSTC, MCM_SPEED_MODE) and sets the working mode to speed mode, it overwrites the setting of step 2. 

Could you please tell me how can I test the board and the motor under the open loop mode? Thanks a lot!

1 ACCEPTED SOLUTION

Accepted Solutions
Gael A
ST Employee

Hello DF_MC,

I understand this behaviour is strange, but in this case, the mode taken into account is the one set in LastModalitySetByUser, and not the STC mode. You should have no problem using the steps depicted in the User Manual.
I thank you for your report, and we will make sure to work on how the clarity of our code can be improved.

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

Hope this will help,
Gaël A.

View solution in original post

3 REPLIES 3
DF_MC
Associate III

Sorry, the 'step 2' in my last paragraph should be 'step 1'. Thanks.

Gael A
ST Employee

Hello DF_MC,

I understand this behaviour is strange, but in this case, the mode taken into account is the one set in LastModalitySetByUser, and not the STC mode. You should have no problem using the steps depicted in the User Manual.
I thank you for your report, and we will make sure to work on how the clarity of our code can be improved.

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,

OK, I have tried to use the code with the steps depicted in the User Manual. Thanks a lot.