2025-07-09 2:09 AM
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:
------------------------------------
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!
2025-07-09 2:16 AM
Sorry, the 'step 2' in my last paragraph should be 'step 1'. Thanks.