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.

How to handle errors from CTRL?

Other Parts Discussed in Thread: MOTORWARE

Hi,

I don't know how to handle errors from the CTRL module. In the labs example, the only thing I can find is :

if(CTRL_isError(ctrlHandle))
{
// set the enable controller flag to false
CTRL_setFlag_enableCtrl(ctrlHandle,false);

// set the enable system flag to false
gMotorVars.Flag_enableSys = false;

// disable the PWM
DRV_disablePwm(drvHandle);
}

So the motor is stopped if there is an error but what's happen if we want to try to restart after several seconds? Do I need to clear the error state? Or perhaps those errors are not clearable and I need to power off the board?

Is there a doc wich explain this (The user guide is quite light)?

Regards.

Emmanuel

  • Manu,

    This is referenced in the Doxygen documentation.

    Through MotorWare.exe --> Modules --> API Documenation --> CTRL_OBJ

     

    it is also described in the Software Architecure document chapter 8 which can be found through Resources

    "If an error is identified, the module reports an error and changes its state to an error state, which will prevent the module from functioning....

    If an error is found by the CTRL_checkForErrors() function, a flag is set which is read by the CTRL_isError() function. Once an error is detected, the control system is disabled and the PWM driver is disabled.

    Currently, there are only two types of errors identified by the controller, clipping of the Id current and an estimator. Clipping of the Id current can happened during parameter estimation and is reported by the controller. To determine the type of estimator error, the estimator must be queried using the EST_getErrorCode() function."

     

  • Hello,

    I have already read those documentations but I can't see if we need to reset manually the error flag or if the error is self resetted.

    If an error that will stop the motor is possible, I need to know how to restart automatically.

    Regards.

    Emmanuel

  • Manu,

    this is a good question. The state errors are not really discussed fully in the Software Architecture Guide.  When I read that section it makes it seem like certain action is automatically taken to the control system, and that is not the case actually.

    First it is important to understand that the State Error portion of the software is not wholistic for the estimator nor an entire control system. It does not do everything, and it is not really fixed.  InstaSPIN-FOC is meant to be a very flexible, user controlled solution.

    There are two types of errors from the InstaSPIN-FOC MotorWare system (note that InstaSPIN-MOTION has an additional error reporting for the SpinTAC suite):

    1. EST errors: modules\est\src\est_states.h in
    2. CTRL errors: sw\modules\ctrl\src\32b\ctrl_obj.h

    EST

    First a definition, the EST is the interface to the FAST observer (for sensorless closed loop control) and the Motor Parameter Identification capability.

    Note that the EST ErrorCodes are ONLY for the Motor Parameter Identification, they will never tell you during sensorless closed loop if data input is bad, if the angle is incorrect, etc.  These errors only occur during the motor ID process:
      EST_ErrorCode_Flux_OL_ShiftOverFlow,   //!< flux open loop shift overflow error code
      EST_ErrorCode_FluxError,               //!< flux estimator error code
      EST_ErrorCode_Dir_ShiftOverFlow,       //!< direction shift overflow error code
      EST_ErrorCode_Ind_ShiftOverFlow,       //!< inductance shift overflow error code

    When there is an Estimator Error it does not interrupt the system or otherwise notify you of a problem, the status can only be polled.  A restart of the full control system is required for proper operation.  Notice that in the logic for doing Motor ID in ctrl.h we are checking the states, and when there is an error we have written software to bring the system to a safe idle state.

    CTRL

    When there is a CTRL error no action is taken. The upper level user software (proj_lab##.c)  is responsible for polling the CTRL for error and taking action.  Typically the action would be a restart of the full control system.

    How do we see the states of the EST and CTRL?
    Note in the updateGlobalVariables_motor() functions of the proj_lab##.c we have these lines that pull the state into a global variable

      // get the controller state
      gMotorVars.CtrlState = CTRL_getState(handle);

      // get the estimator state
      gMotorVars.EstState = EST_getState(obj->estHandle);

    How do we use the states in error checking?
    - Notice the CTRL_updateState function is included in the user software of the proj_lab##.c, for example as part of the "if(CTRL_isError(ctrlHandle)) else" logic in proj_lab02a.c line 200  (and used in all following labs)
    - CTRL_updateState() is defined in ctrl.c and calls CTRL_checkForErrors() which is defined in ctrl.h
    - notice CTRL_checkForErrors is only checking the EST_isError() function

    Note that CTRL_ErrorCode_IdClip is only set in private code that exists in ROM.

    If you want to know the specific Error of the Estimator Error State you must use the function
    EST_ErrorCode_e EST_getErrorCode(EST_Handle handle);

    When you have an error and need to do a full restart of the full control system:
    - Notice lines 202 - 209 of proj_lab02a.c, as part of the CTRL_isError checking logic:

                // set the enable controller flag to false
                CTRL_setFlag_enableCtrl(ctrlHandle,false);

                // set the enable system flag to false
                gMotorVars.Flag_enableSys = false;

                // disable the PWM
                DRV_disablePwm(drvHandle);

     

    And then you will notice that by setting Flag_enableSys = false this puts you in the state at the end of the for();; loop where the reset is fully invoked when CTRL_setParams() is run, putting the controller system into it's fully reset / fresh start state.

        // disable the PWM
        DRV_disablePwm(drvHandle);

        // set the default controller parameters (Reset the control to re-identify the motor)
        CTRL_setParams(ctrlHandle,&gUserParams);
        gMotorVars.Flag_Run_Identify = false;

      } // end of for(;;) loop

     


  • " InstaSPIN-FOC is meant to be a very flexible, user controlled solution."

    If it isn't obvious to you, since you have the source to ctrl.c and ctrl.h, you can make all your own error states as well, and decide how to take action upon them.

    If you want to treat the entire InstaSPIN-FOC solution as nearly a black box, which you just activate and speeed speed and acceleration commands to, you can.  But it can also be extremely customized if you are so inclined. 

     

  • OK thanks for the answer, this will be very helpfull for me.

    Another question, i've found some online training around INSTASPIN :

    http://focus.ti.com/docs/training/catalog/events/event.jhtml?sku=OLT213013

    http://focus.ti.com/docs/training/catalog/events/event.jhtml?sku=OLT213001

    http://focus.ti.com/docs/training/catalog/events/event.jhtml?sku=OLT213002

    http://focus.ti.com/docs/training/catalog/events/event.jhtml?sku=OLT111008

    http://focus.ti.com/docs/training/catalog/events/event.jhtml?sku=OLT210201

    http://focus.ti.com/docs/training/catalog/events/event.jhtml?sku=OLT100022

    Is there any seminars, workshop, etc..., i didn't find anything related to instaspin at the following link : http://focus.ti.com/general/docs/traininghome.tsp

    Regards.

    Emmanuel

  • Manu,

    Regarding InstaSPIN-FOC / -MOTION and MotorWare training:

    1. To be able to support more customers we tried to write extremely thorough documentation for the UG and create step by step self-paced lab exercises where the core software is explained and functionality is built on top of each other.  This is the main way we will provide training to a global audience that speaks many different languages.

    2. As InstaSPIN grows we hope to increase the number of companies who offer support for InstaSPIN designs.  As an example, here in the USA we have D3 Engineering on the East Coast and Pentad on the west coast.  The idea is local training events for customers which act as opportunity generation for the consulting / engineering services companies.

    3. We have a 2/3-day workshop that will premier this summer in Europe and run a few times in the fall. If successful we will run at more locations in 2015.  This course is focused on drive design and how to use simulation/abstraction tools to build a system, with a strong focus on InstaSPIN.  It is NOT a course on the inner workings of MotorWare / the InstaSPIN software APIs.

    BTW - there are more trainign videos in the InstaSPIN Video Player here:
    http://www.ti.com/ww/en/mcu/instaspin/support_community.shtml