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.

Lab5f instaspin main loop

I am trying to modify lab5f for my requirement and am not clear as to why following lines are used

All lines in proj_lab05.c

1.line 278 -> CTRL_setFlag_enableSpeedCtrl(ctrlHandle, false); why current loop reference is killed?

2.line 287 -> gCounter_updateGlobals++; why is this variable used?

3.Lines 367 to 373 -> what is the purpose of these lines?

if((CTRL_getFlag_enableUserMotorParams(ctrlHandle) == true) &&
(ctrlState > CTRL_State_Idle) &&
(gMotorVars.CtrlVersion.minor == 6))
{
// call this function to fix 1p6
USER_softwareUpdate1p6(ctrlHandle);
}

There are also couple of codes which are unclear further, is there a proper flowchart explanation of the same anywhere?

  • why are you using 5f? 5f is a lab which lets you switch back and forth between the PI and SpinTAC speed controllers. I would use a different lab to start your own project with.

    1. this is because both a speed PI and SpinTAC controller will be used to feed the IqRef torque controller. This logic is handled later in the code.

    2. see like 438. This is just a counter used to determine when to update global variables.

    3. this is a SW patch to fix a bug in v1p6 of the ROM (F2806x devices only)

    the InstaSPIN_labs.pdf is the only SW document describing the labs. There are flowcharts included.
  • In line 436

    NUM_MAIN_TICKS_FOR_GLOBAL_VARIABLE_UPDATE is set to one, which means variables are updated every single time, can this value be set to much higher say 100 so that update is slowed down?

    Secondly where is code which sets IQ update from PI or Spintac? I could not locate the code patch...

    I will also check possibility to use other lab for my work...

    Thanks

  • Mika,

    Look for the function CTRL_setIq_ref_pu. This sets the Iq reference.