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.

TMS320F28069M: Can the macro definition of motor parameters in lab13 be redefined as a variable?

Part Number: TMS320F28069M

Dear team:

One of my customers has the following questions:

In the routine lab13 project based on 28069m, the parameters of motor are defined in user.h, and some codes are as follows:

#define USER_MOTOR_NUM_POLE_PAIRS (4)
#define USER_MOTOR_Rr (NULL)
#define USER_MOTOR_Rs (0.135) 
#define USER_MOTOR_Ls_d (0.000335) 
#define USER_MOTOR_Ls_q (0.000335)
#define USER_MOTOR_RATED_FLUX (0.08) 

His question is: can the definition of motor parameters be changed to global variable definition instead of macro definition? In this way, it can assign values to the corresponding variables or change the assignment when necessary. For example, it is defined as follows:

float USER_MOTOR_Rr;
float USER_MOTOR_Rs;
float USER_MOTOR_Ls_d;
float USER_MOTOR_Ls_q;
float USER_MOTOR_RATED_FLUX;

Will this change affect the function of the original program and the normal operation of instaspin.

Best Regards

  • Yes, you can, but you need to call all of the initialization functions again that use the gUserParams object, like USER_setParams(), CTRL_setParams(), and CTRL_setESTParams() if these variables with motor parameters are changed.

  • Thank you.

    I modified the firmware as the your method, the Rs-recalibration (motor rotor align function) function before the motor start does not work, it always shows CTRL_EST_IDLE.  But not changed to CTRL_EST_Rs automatically as before. Why is it happen?

  • Set gMotorVars.Flag_Run_Identify to "false", and make sure that the " gMotorVars.EstState" is  "EST_State_Idle" and the " gMotorVars.Flag_enableRsRecalc" is set to "true" before you re-start the motor.

    Please the related codes show how did you do if you still have an issue with this.

  • Yes, I do those as your comments. I examined the opt-level, when the opt level is off, then the above mentioned condition happens. when the opt level is adjusted to 2, or higher, the the following will happens.

    I have changed opt-level to 3 or higher and loaded in flash, then the firmware runs ok only in JTAG connection CCS emulation condition. While the drive is powered off and powered on again, and no JTAG connection, the motor does not run and generate much large noise, even a velocity command is given the motor does not rotate. 

    Therefore, I guess there are some issues existed, can you help me to figure out how to solve that?

  • As replied to the other thread you posted. Just keep one please if you have further questions on this topic.

    e2e.ti.com/.../970008