This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28069: InstaSPIN: switching between velocity mode and torque mode

Part Number: TMS320F28069
Other Parts Discussed in Thread: MOTORWARE

Hello,

I need to implement a way to switch between velocity mode and torque mode (back and force). What I did is the following:

interrupt void
mainISR (void)
{
  // ...

  if (MOT_OP_MODE_Current != m_curMode)
  {
    stCnt++;
  }
  else
  {
    stCnt = 1U;
  }

  // Run the SpinTAC Components
  if (stCnt >= ISR_TICKS_PER_SPINTAC_TICK)
  {
    ST_runPosConv(m_stHandle, m_encHandle, m_ctrlHandle);
    ST_runVelCtl(m_stHandle, m_ctrlHandle);
    stCnt = 1U;
  }

  // Run the controller.
  CTRL_run(
    m_ctrlHandle,
    m_halHandle,
    &m_adcData,
    &m_pwmData,
    ENC_getElecAngle(m_encHandle)
  );

  // ...
}

In the code above, when the system is in current control mode, the counter stCnt is kept to 1 in order to avoid executing ST_runPosConv and ST_runVelCtl functions.

My questions are:

  • Is there any "cleaner" way to switch between velocity mode and torque mode (back and forth)
  • Do you have other suggestions?
  • Is there any other consideration to take into account?

Thank you.

Regards

  • We don't have torque mode and speed mode transition for InstaSPIN-Motion example in motorWare. 

    To switch between velocity mode and torque mode back and force, you will need to disable the speed controller by yourself and do your own transition process when switching back to speed mode.

  • Hello Han,

    I understand that there is no mode transition in examples. However, could you please answer my questions and guide me to do this?

    I would like to avoid some side effects by doing it in a wrong way.

    Regarding your points:

    • To switch between velocity mode and torque mode back and force, you will need to disable the speed controller by yourself:
      • Is STVELCTL_setEnable(stObj->velCtlHandle, false) sufficient to disable the speed controller?
      • I assume that I still need to avoid calling ST_runVelCtl function since it set the Iq_ref. Right?
    • Do your own transition process when switching back to speed mode
      • Could you please give more details about that?

    Thank you again for your help.

    Regards,

    Johann

  • Hi Johann,

    1. Yes, you will need to overwrite the Iq_ref (may and Id_ref) written by the ST_runVelCtl function or avoid this function being running.

    2. You would want to maintain the torque reference / Iq_ref being smooth when you are switching between torque and speed mode to avid jerky motion. As a result, you will need to have a function to handle the smooth transition.

    Please let me know with further questions.

    Han

  • Hi Johann,

    I will close this thread if you don't have further question. Please feel free to reply or start new post if you get further questions. Thanks.

    Han

  • Hello Han,

    Yes, you can close it.

    I'll create a new thread if I have any more questions.

    Regards,
    Johann