2024-12-05 07:33 AM
Hi everyone, I am seeing MC library doesnt support Position/Speed/Torque Mode in same application. Is it true? Or library support but user app functions are produced for spesific mode?
2024-12-05 07:58 AM
It looks like Position mode contains Speed and Speed mode contains torque mode. To be able to use all modes, using position mode. I compared a few .c files between Position and Speed modes, and I have seen some extra functions have been added on speed mode.
2024-12-05 08:23 AM
For example,
**************mc_tasks_foc.c **************
=====Position Mode
MCI_ExecSpeedRamp(&Mci[M1],
STC_GetMecSpeedRefUnitDefault(pSTC[M1]),0); /* First command to STC */
=====Speed Mode
MCI_ExecSpeedRamp(&Mci[M1],
STC_GetMecSpeedRefUnitDefault(pSTC[M1]),0); /* First command to STC */
=====Torque Mode
MCI_ExecTorqueRamp(&Mci[M1], STC_GetDefaultIqdref(pSTC[M1]).q, 0);
But for torque mode, contaning functions is not valid. Assume Position Mode in project, then I can use position/speed together also torque mode is coming naturally with this modes. Is it true? My Motor control knowledge little limited which I am learning with this way.
2024-12-10 06:22 AM
Hello @Zek_De,
As mentioned on Release Notes for X-Cube-MCSDK 6.3.2 available through "Workbench tool">About>Documentations>Documentation>"Release Notes":
Position Control Mode. Position Control is possible for motor control applications using encoders for speed and position measurement (Project Build time feature. No switch to/from Torque or Speed Control modes is possible at run time when Position control mode is enabled)
2024-12-11 10:53 AM
interesting I thought this is possible because of code below.
mc_api.c
__weak void MC_ProgramSpeedRampMotor1(int16_t hFinalSpeed, uint16_t hDurationms)
{
MCI_ExecSpeedRamp(pMCI[M1], hFinalSpeed, hDurationms);
}
__weak void MC_ProgramTorqueRampMotor1(int16_t hFinalTorque, uint16_t hDurationms)
{
MCI_ExecTorqueRamp(pMCI[M1], hFinalTorque, hDurationms);
}
__weak void MC_ProgramPositionCommandMotor1(float_t fTargetPosition, float_t fDuration)
{
MCI_ExecPositionCommand(pMCI[M1], fTargetPosition, fDuration);
}
This project created as position mode and I compared every .c files and I have seen position mode involve the speed mode(it means position mode include speed mode functions as extra. Why I cant call the "MC_ProgramSpeedRampMotor1" and "MC_ProgramPositionCommandMotor1" functions in the same application.