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.

TMS320F280049C: Lab2 Offset Calcs reset to zero - user experience feedback

Part Number: TMS320F280049C


Chris/Yanming,

I'm going through the labs on some fresh new HW I designed and I'm running the offset calc lab.  I'm following the instructions in the "MotorControl SDK Instaspin Lab Guide".  Step 6 in lab 2 seems incorrect.  It states I should change the enableOffsetCalibration flag to zero to finish the test, but the source code has a call that re-enables the flag in the ISR.  starting at line 760:

    if(motorVars.flagEnableOffsetCalc == true)
    {
        runOffsetsCalculation();

        //
        // Below two lines code only used in this lab for hardware verification
        // these two lines code will be removed for later lab projects
        //
        if(flagEnableOffsetCalibration == true)
        {
            motorVars.flagEnableOffsetCalc = true;
        }
    }

Fast forward 5 minutes, I figured it out what I was doing wrong.  There is the motorvars offsetcal enable flag and then the one that isn't in the motorvars struct.  If you change the motorvars one, the offsets get reset to zero since it re-enables offset cal.  Seems kinda wonky to implement it this way.  Could and very likely does lead to user confusion and unnecessary forum posts especially when both variables are populated in the expressions window by the lab's JS file.  Maybe give the one the user is supposed to mess with in this lab a different name, or call out the fact that there are two very similarly named variables in the user guide?  Maybe don't populate the struct one using the JS file for this example? 

Your call, just some feedback.  This tripped me up for a second.

Trey

  • Sorry for confusing you, we will try to have clear operation steps and description of this lab. Thanks! The offset calibration will enable always by writing the "flagEnableOffsetCalibration" to "true, otherwise, the offset calibration will not enter again since the process just does once in all of the labs except lab2.