Skip to main content
Visitor II
July 7, 2026
Question

Migration issue: MCAlignEncoderMotor1() replacement

  • July 7, 2026
  • 1 reply
  • 28 views

Hi everyone,

I am new to the MCSDK environment and currently working on a porting project from MCSDK 5.4.8 to 6.4.1. I have been stuck on this for weeks and I am honestly getting desperate as I cannot find a way forward.

I need a functional routine to handle encoder alignment that is compatible with the 6.4.1 framework. The alignment must be performed solely upon user request, and it is critical that the motor does not start running after the alignment sequence. I am looking for a direct replacement for the legacy MCAlignEncoderMotor1() API.

I have already attempted the implementation suggested in this thread: 
MCSDK 6.3 - Correct way to restart / retrigger encoder alignment

Unfortunately, this solution does not work for my setup. Could you please provide guidance on how to trigger this alignment in isolation within the 6.4.1 architecture?

Best regards,

bolla_bo

1 reply

GMA
ST Technical Moderator
July 8, 2026

Hello ​@bolla_bo,

If the goal is to perform encoder alignment without spinning the motor, clear the EncAligned flag, and start and stop the motor with the target speed set to zero.

   /* Reset alignment state */
EncAlignCtrlM1.EncAligned = false;
/* Zero Speed target start to process the encoder alignment */
MC_ProgramSpeedRampMotor1_F(0, 0);
MC_StartMotor1();
HAL_Delay(2000);
MC_StopMotor1();

 

If you agree with the answer, please accept it by clicking on 'Best answer'.Best regards.GMA