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: user parameters update

Part Number: TMS320F28069


Hello,

As far as I understand, the user parameters used by InstaSPIN are defined based on the definitions in user.h and using the following function:

  • CTRL_setParams

Can you please confirm that the whole InstaSPIN system only relies on parameters sets using the function CTRL_setParams? In other words, is there any part of the InstaSPIN system that relies directly on user.h static definitions without using dynamic parameters set using CTRL_setParams function?

Thank you in advance.

Regards

  • Yes, you just need to call this CTRL_setParams() function to set up the parameters for InstaSPIN from the use.h, the function will call other related functions.

  • Hello,

    Thank you for your answer. This is what I thought.

    One more question: so if I understand well, as soon as the FOC controller is disabled, we can update the FOC controller parameters using CTRL_setParams, right?

    In other words, is the following process correct?

    1. FOC controller is "Online".
    2. New parameters are received. We disable the FOC controller using the function CTRL_setFlag_enableCtrl(m_ctrlHandle, false).
    3. We wait until the FOC controller is "Idle".
    4. We set the new parameters of the FOC controller using the function CTRL_setParams.
    5. We enable the FOC controller.

      My concern here is that, in my case, during development, we want to optimize some parameters without having to recompile the project and flash the target.

      Regards.

    1. Which example lab did you reference? Did you only use the InstaSPIN controller without the FAST estimator?

      Yes, you can use the CTRL_setParams() to set up both the controller and estimator with new parameters (these new parameters must be set in gUserParams object), and you must stop the motor by using CTRL_setFlag_enableCtrl(ctrlHandle, false) before calling CTRL_setParams() again.

      All the controller parameters including the controller state will be reset after calling the CTRL_setParams(). You can control the motor with these new parameters without re-programming the code, just do this "online" as you want.

      You don't need to call CTRL_setParams() to reset all parameters if you didn't use the estimator or the motor parameters (Rs, Ls, Flux, Pole pairs) are not changed.  You just need to change the gains of the PI controller directly if you only want to optimize the controller like tuning the PI controller.

    2. This is a custom firmware based on Lab12b: I thus only use the InstaSPIN controller without the FAST estimator.

      Thank you for your clear answer which confirms what I thought.

      We will certainly need to fine tune motor parameters such as Ls.

      One more question:

      • Is it necessary to disable the FOC controller as well as the velocity controller if we want to modify the following parameters? Or can we modify them "online"?
        • USER_SYSTEM_INERTIA
        • USER_SYSTEM_FRICTION

      Regards,
      Johann

    3. You have to call the CTRL_setParams() function to re-setup the controller and estimator since the Ls is changed.

      You need to call below two functions to re-setup the SpinTAC if the USER_SYSTEM_INERTIA and USER_SYSTEM_FRICTION are modified. The current example lab12b doesn't support modify these parameters online. You have to re-write these two functions by replacing these constants with the related variables, and then call these two functions online by setting the new parameters to the related variables. But I don't think you need to do this since these two parameters of a motor should be the fixed values in a system.

      ST_setupVelCtl(stHandle);
      ST_setupPosConv(stHandle);

    4. Thank you for your answer.

      Regards,
      Johann

    5. I've found that the following function directly uses definitions from user.h:

      inline _iq CTRL_angleDelayComp(CTRL_Handle handle, const _iq angle_pu)     (line 1846 in ctrlQEP.h)

      The definition USER_IQ_FULL_SCALE_FREQ_Hz is used to compute angleDelta_pu. However, this definition is linked to the motor which, in my case, should be defined in a "user parameters" structure that would reside in RAM.

      Can I safely set the USER_IQ_FULL_SCALE_FREQ_Hz to a value that can fit several different motors?

      In other words, let assume that I wand to have only one FW for two different motors:

      • Motor 1 frequency = 400 Hz
      • Motor 2 frequency = 600 Hz

      Is that OK to set USER_IQ_FULL_SCALE_FREQ_Hz to Motor 2 frequency (600 Hz)? Or could this lead to problems with Motor 1?

      Regards,
      Johann

    6. Yes, you can, replace all the USER_IQ_FULL_SCALE_FREQ_Hz parameter with a variable in all of the functions.

      Actually, you don't need to change the USER_IQ_FULL_SCALE_FREQ_Hz for different motors if the value of both USER_IQ_FULL_SCALE_FREQ_Hz parameters don't have a very big error as you mentioned above since the resolution of the speed is enough.