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.

DRV8301-HC-C2-KIT: Current Measurement, Appropriate Limits, and Scaling

Part Number: DRV8301-HC-C2-KIT

I have a high-current motor drive application (up to 50A into the supply). The DRV8301-HC-C2-KIT does not include InstaSPIN-FOC, so I have plugged in an F28069M control card and been able to successfully interface with the motor and drive board using some modified code and the projects. I've updated the user.h files with various tuned motor parameters and made sure the current and span levels are sufficiently high, testing values between 40A and 80A via these variables USER_IQ_FULL_SCALE_CURRENT, USER_ADC_FULL_SCALE_CURRENT, USER_MOTOR_CURRENT. 

Unfortunately, although the system identifies and spins up my PMSM, it abruptly stops when loaded above 3-5A on the supply. Increasing the above variables up to 80A helps, but I've never been able to pull more than 5A before it stops. I've followed the guidance from Motorware ("DRV830x-HC-C2-KIT_HWGuide.pdf" and "InstaSPIN-FOC™ and InstaSPIN-MOTION™ (Rev. G).pdf") in configuring these values and am not able to get the full current span that the board is rated to handle.

Please help:

1. Explain why I'm unable to drive up to the limits established in IQ_FULL_SCALE_CURRENT, or anywhere near the ADC limit of 82.5A?

2. Explain whether IQ_FULL_SCALE_CURRENT needs to be 1/2 of ADC_FULL_SCALE_CURRENT, since the former is peak-to-peak and the latter is 0 to max? Other C2000 posts have recommended values up to the limit, but in either case, I get limited.

3. Explain what variable I can monitor in CCS to track the total current and phase current levels? I am unable to find anything within gMotorVars that tracks current. 

4. Confirm which PIN/test port I can probe with a scope to monitor phase currents and total supply current and explain how I would scale these voltages to get currents. TP12,13,14 seem to correspond to phase shunts. TP23 refers to I-TOTAL. Are these the right ports? What's the scale for this board to get A? I think I'm measuring large numbers like ~40V for very low current operation.

I've attached my user.h file in the chance you might be able to help me find what's wrong with my configuration that's limiting my current.

5808.user.h

  • 1. USER_ADC_FULL_SCALE_CURRENT is calculated based on the h/w board, and USER_IQ_FULL_SCALE_CURRENT can be set to any value, just need to limit (USER_ADC_FULL_SCALE_CURRENT_A)/(USER_IQ_FULL_SCALE_CURRENT_A) is less than 127. It is recommended to set the value between 0.1 and 1 times of USER_ADC_FULL_SCALE_CURRENT_A.
    2. gAdcData.I.value[0], gAdcData.I.value[1], and gAdcData.I.value[2] are the 3-phase current, they are PU value, you might multiply USER_IQ_FULL_SCALE_CURRENT_A to get the real value with "A" unit.

    3. You'd better monitor the phase or dc-bus current by a current probe with an oscilloscope if it's possible. You might connect a generic voltage probe on TP24, TP25, TP27, and TP23 to get the current sampling signals which are the output of the amplifier. TP12, TP13, and TP14 are used to monitor the phase voltage. You might have to look at lab01b or lab01c lab guide using PWMDAC or DATALOG to monitor the current or voltage, and you may find more information in instaSPIN lab guide and user's guide, there is a detailed description about the parameters you mentioned.
  • Re. 1: I've tried many combinations with USER_IQ_FULL_SCALE_CURRENT_A set from 10, 42.25, 82.5, while maintaining the USER_ADC_FULL_SCALE_CURRENT_A set at 82.5, which is where the hardware is set based on the gains and shunt resistors. Nothing seems to work for getting the system to operate above 5A. Please help me identify what's wrong - do you see anything wrong in my user.h file?

    Re. 2: The values I'm getting from gAdcData.I.value are on the order of +/- 360000. Dividing this by the USER_IQ_FULL_SCALE_CURRENT_A doesn't get us the current in "A". 

    Re. 3: What are TP24,TP25,TP27 and how do I scale them? I only have TP24 and TP25 exposed on my board. The HW guide also only lists up to TP23 (DRV830x-HC-C2-KIT_HWGuide.pdf). Also, I'm reading 1.68V off TP23 at zero current, shouldn't current scale linearly from 0V across the 3.3V ADC? Would the same external op-amp gain of 20 across the 0.002mOhm scaling apply for 0.04 V/A or is there a different relationship for this output?

  • For your reference, I've also attached the modified version of proj_lab05b.c - the user.h file was attached earlier. Thanks for your help debugging.

    proj_lab05b_modified.c
    {\rtf1\ansi\ansicpg1252\cocoartf1561\cocoasubrtf600
    {\fonttbl\f0\fswiss\fcharset0 Helvetica;}
    {\colortbl;\red255\green255\blue255;\red63\green127\blue95;\red127\green0\blue85;\red42\green0\blue255;
    \red0\green80\blue50;\red100\green40\blue128;\red0\green0\blue192;}
    {\*\expandedcolortbl;;\csgenericrgb\c24706\c49804\c37255;\csgenericrgb\c49804\c0\c33333;\csgenericrgb\c16471\c0\c100000;
    \csgenericrgb\c0\c31373\c19608;\csgenericrgb\c39216\c15686\c50196;\csgenericrgb\c0\c0\c75294;}
    \margl1440\margr1440\vieww10800\viewh8400\viewkind0
    \deftab720
    \pard\pardeftab720\partightenfactor0
    
    \f0\fs20 \cf2 /* --COPYRIGHT--,BSD\cf0 \
    \cf2  * Copyright (c) 2012, Texas Instruments Incorporated\cf0 \
    \cf2  * All rights reserved.\cf0 \
    \cf2  *\cf0 \
    \cf2  * Redistribution and use in source and binary forms, with or without\cf0 \
    \cf2  * modification, are permitted provided that the following conditions\cf0 \
    \cf2  * are met:\cf0 \
    \cf2  *\cf0 \
    \cf2  * *  Redistributions of source code must retain the above copyright\cf0 \
    \cf2  *    notice, this list of conditions and the following disclaimer.\cf0 \
    \cf2  *\cf0 \
    \cf2  * *  Redistributions in binary form must reproduce the above copyright\cf0 \
    \cf2  *    notice, this list of conditions and the following disclaimer in the\cf0 \
    \cf2  *    documentation and/or other materials provided with the distribution.\cf0 \
    \cf2  *\cf0 \
    \cf2  * *  Neither the name of Texas Instruments Incorporated nor the names of\cf0 \
    \cf2  *    its contributors may be used to endorse or promote products derived\cf0 \
    \cf2  *    from this software without specific prior written permission.\cf0 \
    \cf2  *\cf0 \
    \cf2  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"\cf0 \
    \cf2  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\cf0 \
    \cf2  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\cf0 \
    \cf2  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\cf0 \
    \cf2  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\cf0 \
    \cf2  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\cf0 \
    \cf2  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;\cf0 \
    \cf2  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\cf0 \
    \cf2  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\cf0 \
    \cf2  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\cf0 \
    \cf2  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\cf0 \
    \cf2  * --/COPYRIGHT--*/\cf0 \
    \cf2 //! \\file   solutions/instaspin_foc/\ul src\ulnone /proj_lab05b.c\cf0 \
    \cf2 //! \\brief Adjusting the speed current controller\cf0 \
    \cf2 //!\cf0 \
    \cf2 //! (C) Copyright 2011, Texas Instruments, Inc.\cf0 \
    \
    \cf2 //! \\\ul defgroup\ulnone  PROJ_LAB05b PROJ_LAB05b\cf0 \
    \cf2 //@\{\cf0 \
    \
    \cf2 //! \\\ul defgroup\ulnone  PROJ_LAB05b_OVERVIEW Project Overview\cf0 \
    \cf2 //!\cf0 \
    \cf2 //! Adjusting the supplied speed controller\cf0 \
    \cf2 //!\cf0 \
    \
    \cf2 // **************************************************************************\cf0 \
    \cf2 // the includes\cf0 \
    \
    \cf2 // system includes\cf0 \
    \pard\pardeftab720\partightenfactor0
    
    \b \cf3 #include
    \b0 \cf0  \cf4 <math.h>\cf0 \
    
    \b \cf3 #include
    \b0 \cf0  \cf4 "main.h"\cf0 \
    
    \b \cf3 #include
    \b0 \cf0  \cf4 <stdio.h>\cf0 \
    \
    
    \b \cf3 #ifdef
    \b0 \cf0  FLASH\
    
    \b \cf3 #pragma
    \b0 \cf0  CODE_SECTION(mainISR,\cf4 "\ul ramfuncs\ulnone "\cf0 );\
    
    \b \cf3 #endif
    \b0 \cf0 \
    \
    \pard\pardeftab720\partightenfactor0
    \cf2 // Include header files used in the main function\cf0 \
    \
    \
    \cf2 // **************************************************************************\cf0 \
    \cf2 // the defines\cf0 \
    \
    \pard\pardeftab720\partightenfactor0
    
    \b \cf3 #define
    \b0 \cf0  LED_BLINK_FREQ_Hz   5\
    \
    
    \b \cf3 float
    \b0 \cf0  SPEED_BASE_KRPM  = 8.0;  \cf2 // Max motor speed for DJI E300 920 \ul Kv\ulnone  at 11 V\cf0 \
    \
    
    \b \cf3 float
    \b0 \cf0  gSpeedRef_duty = 0.000;   \cf2 // Speed reference from external controller\cf0 \
    \
    
    \b \cf3 float
    \b0 \cf0  PwmDuty = 0.0;\
    \
    
    \b \cf3 float
    \b0 \cf0  gSpeedRef_Ok = 0;       \cf2 // Safety check for speed reference signal\cf0 \
    \
    
    \b \cf3 float
    \b0 \cf0  Smax = 2;     \cf2 // Maximum Speed\cf0 \
    \
    
    \b \cf3 float
    \b0 \cf0  Smin = 0;       \cf2 // Minimum Speed\cf0 \
    \
    
    \b \cf3 float
    \b0 \cf0  tmax = 2;        \cf2 // max pulse width in \ul ms\cf0 \ulnone \
    \
    
    \b \cf3 float
    \b0 \cf0  tmin = 1.1;       \cf2 //\ul min\ulnone  pulse width in \ul ms\cf0 \ulnone \
    \
    
    \b \cf3 float
    \b0 \cf0  Cmax;    \cf2 // \ul ecap\ulnone  maximum count\cf0 \
    \
    
    \b \cf3 float
    \b0 \cf0  Cmin;    \cf2 // \ul ecap\ulnone  counter time relating 1ms \ul pwm\ulnone  input\cf0 \
    \
    \
    \pard\pardeftab720\partightenfactor0
    \cf2 // **************************************************************************\cf0 \
    \cf2 // the globals\cf0 \
    \
    \pard\pardeftab720\partightenfactor0
    \cf5 uint_least16_t\cf0  gCounter_updateGlobals = 0;\
    \
    bool Flag_Latch_softwareUpdate = true;\
    \
    \cf5 CTRL_Handle\cf0  ctrlHandle;\
    \
    \cf5 HAL_Handle\cf0  halHandle;\
    \
    \cf5 USER_Params\cf0  gUserParams;\
    \
    \cf5 HAL_PwmData_t\cf0  gPwmData = \{_IQ(0.0), _IQ(0.0), _IQ(0.0)\};\
    \
    \cf5 HAL_AdcData_t\cf0  gAdcData;\
    \
    \cf5 _iq\cf0  gMaxCurrentSlope = _IQ(0.0);\
    \
    \pard\pardeftab720\partightenfactor0
    
    \b \cf3 #ifdef
    \b0 \cf0  FAST_ROM_V1p6\
    \pard\pardeftab720\partightenfactor0
    \cf5 CTRL_Obj\cf0  *controller_obj;\
    \pard\pardeftab720\partightenfactor0
    
    \b \cf3 #else
    \b0 \cf0 \
    CTRL_Obj ctrl;              \cf2 //v1p7 format\cf0 \
    
    \b \cf3 #endif
    \b0 \cf0 \
    \
    \pard\pardeftab720\partightenfactor0
    \cf5 uint16_t\cf0  gLEDcnt = 0;\
    \
    \pard\pardeftab720\partightenfactor0
    
    \b \cf3 volatile
    \b0 \cf0  \cf5 MOTOR_Vars_t\cf0  gMotorVars = MOTOR_Vars_INIT;\
    \
    
    \b \cf3 #ifdef
    \b0 \cf0  FLASH\
    \pard\pardeftab720\partightenfactor0
    \cf2 // Used for running BackGround in flash, and ISR in RAM\cf0 \
    \pard\pardeftab720\partightenfactor0
    
    \b \cf3 extern
    \b0 \cf0  uint16_t *RamfuncsLoadStart, *RamfuncsLoadEnd, *RamfuncsRunStart;\
    
    \b \cf3 #endif
    \b0 \cf0 \
    \
    \
    
    \b \cf3 #ifdef
    \b0 \cf0  DRV8301_SPI\
    \pard\pardeftab720\partightenfactor0
    \cf2 // Watch window interface to the 8301 SPI\cf0 \
    \pard\pardeftab720\partightenfactor0
    \cf5 DRV_SPI_8301_Vars_t\cf0  gDrvSpi8301Vars;\
    \pard\pardeftab720\partightenfactor0
    
    \b \cf3 #endif
    \b0 \cf0 \
    \
    
    \b \cf3 #ifdef
    \b0 \cf0  DRV8305_SPI\
    \pard\pardeftab720\partightenfactor0
    \cf2 // Watch window interface to the 8305 SPI\cf0 \
    DRV_SPI_8305_Vars_t gDrvSpi8305Vars;\
    \pard\pardeftab720\partightenfactor0
    
    \b \cf3 #endif
    \b0 \cf0 \
    \
    \pard\pardeftab720\partightenfactor0
    \cf5 _iq\cf0  gFlux_pu_to_Wb_sf;\
    \
    \cf5 _iq\cf0  gFlux_pu_to_VpHz_sf;\
    \
    \cf5 _iq\cf0  gTorque_Ls_Id_Iq_pu_to_Nm_sf;\
    \
    \cf5 _iq\cf0  gTorque_Flux_Iq_pu_to_Nm_sf;\
    \
    \pard\pardeftab720\partightenfactor0
    \cf2 // **************************************************************************\cf0 \
    \cf2 // the functions\cf0 \
    \
    \pard\pardeftab720\partightenfactor0
    
    \b \cf3 void
    \b0 \cf0  
    \b main
    \b0 (
    \b \cf3 void
    \b0 \cf0 )\
    \{\
      \cf5 uint_least8_t\cf0  estNumber = 0;\
      \cf2 //\ul printf\ulnone ("\ul Miccheck\ulnone \\n");\cf0 \
    
    \b \cf3 #ifdef
    \b0 \cf0  FAST_ROM_V1p6\
      \cf5 uint_least8_t\cf0  ctrlNumber = 0;\
    
    \b \cf3 #endif
    \b0 \cf0 \
    \
      \cf2 // Only used if running from FLASH\cf0 \
      \cf2 // Note that the variable FLASH is defined by the project\cf0 \
      
    \b \cf3 #ifdef
    \b0 \cf0  FLASH\
      \cf2 // Copy time critical code and Flash setup code to RAM\cf0 \
      \cf2 // The RamfuncsLoadStart, RamfuncsLoadEnd, and RamfuncsRunStart\cf0 \
      \cf2 // symbols are created by the linker. Refer to the linker files.\cf0 \
      memCopy((uint16_t *)&RamfuncsLoadStart,(uint16_t *)&RamfuncsLoadEnd,(uint16_t *)&RamfuncsRunStart);\
      
    \b \cf3 #endif
    \b0 \cf0 \
    \
      \cf2 // initialize the hardware abstraction layer\cf0 \
      halHandle = 
    \b \cf6 HAL_init
    \b0 \cf0 (&hal,
    \b \cf3 sizeof
    \b0 \cf0 (hal));\
    \
    \
      \cf2 // check for errors in user parameters\cf0 \
      
    \b \cf6 USER_checkForErrors
    \b0 \cf0 (&gUserParams);\
    \
    \
      \cf2 // store user parameter error in global variable\cf0 \
      gMotorVars.\cf7 UserErrorCode\cf0  = 
    \b \cf6 USER_getErrorCode
    \b0 \cf0 (&gUserParams);\
    \
    \
      \cf2 // do not allow code execution if there is a user parameter error\cf0 \
      
    \b \cf3 if
    \b0 \cf0 (gMotorVars.\cf7 UserErrorCode\cf0  != 
    \i \cf7 USER_ErrorCode_NoError
    \i0 \cf0 )\
        \{\
          
    \b \cf3 for
    \b0 \cf0 (;;)\
            \{\
              gMotorVars.\cf7 Flag_enableSys\cf0  = false;\
            \}\
        \}\
    \
    \
      \cf2 // initialize the user parameters\cf0 \
      
    \b \cf6 USER_setParams
    \b0 \cf0 (&gUserParams);\
    \
    \
      \cf2 // set the hardware abstraction layer parameters\cf0 \
      
    \b \cf6 HAL_setParams
    \b0 \cf0 (halHandle,&gUserParams);\
    \
    \
      \cf2 // initialize the controller\cf0 \
    
    \b \cf3 #ifdef
    \b0 \cf0  FAST_ROM_V1p6\
      ctrlHandle = 
    \b \cf6 CTRL_initCtrl
    \b0 \cf0 (ctrlNumber, estNumber);        \cf2 //v1p6 format (06xF and 06xM devices)\cf0 \
      controller_obj = (\cf5 CTRL_Obj\cf0  *)ctrlHandle;\
    
    \b \cf3 #else
    \b0 \cf0 \
      ctrlHandle = CTRL_initCtrl(estNumber,&ctrl,
    \b \cf3 sizeof
    \b0 \cf0 (ctrl)); \cf2 //v1p7 format default\cf0 \
    
    \b \cf3 #endif
    \b0 \cf0 \
    \
    \
      \{\
        \cf5 CTRL_Version\cf0  version;\
    \
        \cf2 // get the version number\cf0 \
        
    \b \cf6 CTRL_getVersion
    \b0 \cf0 (ctrlHandle,&version);\
    \
        gMotorVars.\cf7 CtrlVersion\cf0  = version;\
      \}\
    \
    \
      \cf2 // set the default controller parameters\cf0 \
      
    \b \cf6 CTRL_setParams
    \b0 \cf0 (ctrlHandle,&gUserParams);\
    \
    \
      \cf2 // setup faults\cf0 \
      
    \b \cf6 HAL_setupFaults
    \b0 \cf0 (halHandle);\
    \
    \
      \cf2 // initialize the interrupt vector table\cf0 \
      HAL_initIntVectorTable(halHandle);\
    \
    \
      \cf2 // enable the ADC interrupts\cf0 \
      
    \b \cf6 HAL_enableAdcInts
    \b0 \cf0 (halHandle);\
    \
    \
      \cf2 // enable global interrupts\cf0 \
      
    \b \cf6 HAL_enableGlobalInts
    \b0 \cf0 (halHandle);\
    \
    \
      \cf2 // enable debug interrupts\cf0 \
      
    \b \cf6 HAL_enableDebugInt
    \b0 \cf0 (halHandle);\
    \
    \
      \cf2 // disable the PWM\cf0 \
      HAL_disablePwm(halHandle);\
    \
    \
    
    \b \cf3 #ifdef
    \b0 \cf0  DRV8301_SPI\
      \cf2 // turn on the DRV8301 if present\cf0 \
      
    \b \cf6 HAL_enableDrv
    \b0 \cf0 (halHandle);\
      \cf2 // initialize the DRV8301 interface\cf0 \
      
    \b \cf6 HAL_setupDrvSpi
    \b0 \cf0 (halHandle,&gDrvSpi8301Vars);\
    
    \b \cf3 #endif
    \b0 \cf0 \
    \
    
    \b \cf3 #ifdef
    \b0 \cf0  DRV8305_SPI\
      \cf2 // turn on the DRV8305 if present\cf0 \
      HAL_enableDrv(halHandle);\
      \cf2 // initialize the DRV8305 interface\cf0 \
      HAL_setupDrvSpi(halHandle,&gDrvSpi8305Vars);\
    
    \b \cf3 #endif
    \b0 \cf0 \
    \
    \
      \cf2 // enable DC bus compensation\cf0 \
      CTRL_setFlag_enableDcBusComp(ctrlHandle, true);\
    \
    \
      \cf2 // compute scaling factors for \ul flux\ulnone  and torque calculations\cf0 \
      gFlux_pu_to_Wb_sf = 
    \b \cf6 USER_computeFlux_pu_to_Wb_sf
    \b0 \cf0 ();\
      gFlux_pu_to_VpHz_sf = 
    \b \cf6 USER_computeFlux_pu_to_VpHz_sf
    \b0 \cf0 ();\
      gTorque_Ls_Id_Iq_pu_to_Nm_sf = 
    \b \cf6 USER_computeTorque_Ls_Id_Iq_pu_to_Nm_sf
    \b0 \cf0 ();\
      gTorque_Flux_Iq_pu_to_Nm_sf = 
    \b \cf6 USER_computeTorque_Flux_Iq_pu_to_Nm_sf
    \b0 \cf0 ();\
    \
    \
      
    \b \cf3 for
    \b0 \cf0 (;;)\
      \{\
        \cf2 // Waiting for enable system flag to be set\cf0 \
        
    \b \cf3 while
    \b0 \cf0 (!(gMotorVars.\cf7 Flag_enableSys\cf0 ));\
    \
        \cf2 // Enable the Library internal PI.  \ul Iq\ulnone  is referenced by the speed PI now\cf0 \
        CTRL_setFlag_enableSpeedCtrl(ctrlHandle, true);\
    \
        \cf2 // loop while the enable system flag is true\cf0 \
        
    \b \cf3 while
    \b0 \cf0 (gMotorVars.\cf7 Flag_enableSys\cf0 )\
          \{\
            \cf5 CTRL_Obj\cf0  *obj = (\cf5 CTRL_Obj\cf0  *)ctrlHandle;\
    \
            \cf2 // increment counters\cf0 \
            gCounter_updateGlobals++;\
    \
            \cf2 // enable/disable the use of motor parameters being loaded from user.h\cf0 \
            CTRL_setFlag_enableUserMotorParams(ctrlHandle,gMotorVars.\cf7 Flag_enableUserParams\cf0 );\
    \
            \cf2 // enable/disable \ul Rs\ulnone  \ul recalibration\ulnone  during motor startup\cf0 \
            
    \b \cf6 EST_setFlag_enableRsRecalc
    \b0 \cf0 (obj->\cf7 estHandle\cf0 ,gMotorVars.\cf7 Flag_enableRsRecalc\cf0 );\
    \
            \cf2 // enable/disable automatic calculation of bias values\cf0 \
            CTRL_setFlag_enableOffset(ctrlHandle,gMotorVars.\cf7 Flag_enableOffsetcalc\cf0 );\
    \
    \
            
    \b \cf3 if
    \b0 \cf0 (CTRL_isError(ctrlHandle))\
              \{\
                \cf2 // set the enable controller flag to false\cf0 \
                CTRL_setFlag_enableCtrl(ctrlHandle,false);\
    \
                \cf2 // set the enable system flag to false\cf0 \
                gMotorVars.\cf7 Flag_enableSys\cf0  = false;\
    \
                \cf2 // disable the PWM\cf0 \
                HAL_disablePwm(halHandle);\
              \}\
            
    \b \cf3 else
    \b0 \cf0 \
              \{\
                \cf2 // update the controller state\cf0 \
                bool flag_ctrlStateChanged = 
    \b \cf6 CTRL_updateState
    \b0 \cf0 (ctrlHandle);\
    \
                \cf2 // enable or disable the control\cf0 \
                CTRL_setFlag_enableCtrl(ctrlHandle, gMotorVars.\cf7 Flag_Run_Identify\cf0 );\
    \
                
    \b \cf3 if
    \b0 \cf0 (flag_ctrlStateChanged)\
                  \{\
                    \cf5 CTRL_State_e\cf0  ctrlState = CTRL_getState(ctrlHandle);\
    \
                    
    \b \cf3 if
    \b0 \cf0 (ctrlState == 
    \i \cf7 CTRL_State_OffLine
    \i0 \cf0 )\
                      \{\
                        \cf2 // enable the PWM\cf0 \
                        HAL_enablePwm(halHandle);\
                      \}\
                    
    \b \cf3 else
    \b0 \cf0  
    \b \cf3 if
    \b0 \cf0 (ctrlState == 
    \i \cf7 CTRL_State_OnLine
    \i0 \cf0 )\
                      \{\
                        
    \b \cf3 if
    \b0 \cf0 (gMotorVars.\cf7 Flag_enableOffsetcalc\cf0  == true)\
                        \{\
                          \cf2 // update the ADC bias values\cf0 \
                          HAL_updateAdcBias(halHandle);\
                        \}\
                        
    \b \cf3 else
    \b0 \cf0 \
                        \{\
                          \cf2 // set the current bias\cf0 \
                          HAL_setBias(halHandle,
    \i \cf7 HAL_SensorType_Current
    \i0 \cf0 ,0,_IQ(I_A_offset));\
                          HAL_setBias(halHandle,
    \i \cf7 HAL_SensorType_Current
    \i0 \cf0 ,1,_IQ(I_B_offset));\
                          HAL_setBias(halHandle,
    \i \cf7 HAL_SensorType_Current
    \i0 \cf0 ,2,_IQ(I_C_offset));\
    \
                          \cf2 // set the voltage bias\cf0 \
                          HAL_setBias(halHandle,
    \i \cf7 HAL_SensorType_Voltage
    \i0 \cf0 ,0,_IQ(V_A_offset));\
                          HAL_setBias(halHandle,
    \i \cf7 HAL_SensorType_Voltage
    \i0 \cf0 ,1,_IQ(V_B_offset));\
                          HAL_setBias(halHandle,
    \i \cf7 HAL_SensorType_Voltage
    \i0 \cf0 ,2,_IQ(V_C_offset));\
                        \}\
    \
                        \cf2 // Return the bias value for currents\cf0 \
                        gMotorVars.\cf7 I_bias\cf0 .\cf7 value\cf0 [0] = HAL_getBias(halHandle,
    \i \cf7 HAL_SensorType_Current
    \i0 \cf0 ,0);\
                        gMotorVars.\cf7 I_bias\cf0 .\cf7 value\cf0 [1] = HAL_getBias(halHandle,
    \i \cf7 HAL_SensorType_Current
    \i0 \cf0 ,1);\
                        gMotorVars.\cf7 I_bias\cf0 .\cf7 value\cf0 [2] = HAL_getBias(halHandle,
    \i \cf7 HAL_SensorType_Current
    \i0 \cf0 ,2);\
    \
                        \cf2 // Return the bias value for voltages\cf0 \
                        gMotorVars.\cf7 V_bias\cf0 .\cf7 value\cf0 [0] = HAL_getBias(halHandle,
    \i \cf7 HAL_SensorType_Voltage
    \i0 \cf0 ,0);\
                        gMotorVars.\cf7 V_bias\cf0 .\cf7 value\cf0 [1] = HAL_getBias(halHandle,
    \i \cf7 HAL_SensorType_Voltage
    \i0 \cf0 ,1);\
                        gMotorVars.\cf7 V_bias\cf0 .\cf7 value\cf0 [2] = HAL_getBias(halHandle,
    \i \cf7 HAL_SensorType_Voltage
    \i0 \cf0 ,2);\
    \
                        \cf2 // enable the PWM\cf0 \
                        HAL_enablePwm(halHandle);\
                      \}\
                    
    \b \cf3 else
    \b0 \cf0  
    \b \cf3 if
    \b0 \cf0 (ctrlState == 
    \i \cf7 CTRL_State_Idle
    \i0 \cf0 )\
                      \{\
                        \cf2 // disable the PWM\cf0 \
                        HAL_disablePwm(halHandle);\
                        gMotorVars.\cf7 Flag_Run_Identify\cf0  = false;\
                      \}\
    \
                    
    \b \cf3 if
    \b0 \cf0 ((CTRL_getFlag_enableUserMotorParams(ctrlHandle) == true) &&\
                      (ctrlState > 
    \i \cf7 CTRL_State_Idle
    \i0 \cf0 ) &&\
                      (gMotorVars.\cf7 CtrlVersion\cf0 .\cf7 minor\cf0  == 6))\
                      \{\
                        \cf2 // call this function to fix 1p6\cf0 \
                        
    \b \cf6 USER_softwareUpdate1p6
    \b0 \cf0 (ctrlHandle);\
                      \}\
    \
                  \}\
              \}\
    \
    \
            
    \b \cf3 if
    \b0 \cf0 (
    \b \cf6 EST_isMotorIdentified
    \b0 \cf0 (obj->\cf7 estHandle\cf0 ))\
              \{\
                \cf2 // set the current ramp\cf0 \
                
    \b \cf6 EST_setMaxCurrentSlope_pu
    \b0 \cf0 (obj->\cf7 estHandle\cf0 ,gMaxCurrentSlope);\
                gMotorVars.\cf7 Flag_MotorIdentified\cf0  = true;\
    \
                \cf2 // set the speed reference\cf0 \
                
    \b \cf6 CTRL_setSpd_ref_krpm
    \b0 \cf0 (ctrlHandle,gMotorVars.\cf7 SpeedRef_krpm\cf0 );\
    \
                \cf2 // set the speed acceleration\cf0 \
                CTRL_setMaxAccel_pu(ctrlHandle,_IQmpy(MAX_ACCEL_KRPMPS_SF,gMotorVars.\cf7 MaxAccel_krpmps\cf0 ));\
                
    \b \cf3 if
    \b0 \cf0 (Flag_Latch_softwareUpdate)\
                \{\
                  Flag_Latch_softwareUpdate = false;\
    \
                  
    \b \cf6 USER_calcPIgains
    \b0 \cf0 (ctrlHandle);\
    \
                  \cf2 // initialize the watch window \ul kp\ulnone  and \ul ki\ulnone  current values with \ul pre\ulnone -calculated values\cf0 \
                  gMotorVars.\cf7 Kp_Idq\cf0  = CTRL_getKp(ctrlHandle,
    \i \cf7 CTRL_Type_PID_Id
    \i0 \cf0 );\
                  gMotorVars.\cf7 Ki_Idq\cf0  = CTRL_getKi(ctrlHandle,
    \i \cf7 CTRL_Type_PID_Id
    \i0 \cf0 );\
    \
                  \cf2 // initialize the watch window \ul kp\ulnone  and \ul ki\ulnone  values with \ul pre\ulnone -calculated values\cf0 \
                  gMotorVars.\cf7 Kp_spd\cf0  = CTRL_getKp(ctrlHandle,
    \i \cf7 CTRL_Type_PID_spd
    \i0 \cf0 );\
                  gMotorVars.\cf7 Ki_spd\cf0  = CTRL_getKi(ctrlHandle,
    \i \cf7 CTRL_Type_PID_spd
    \i0 \cf0 );\
    \
                  \cf2 // TIDA-00643 custom values for speed controller\cf0 \
                  gMotorVars.\cf7 Kp_spd\cf0  = _IQ(2.000);\
                  gMotorVars.\cf7 Ki_spd\cf0  = _IQ(0.059);\
                \}\
    \
              \}\
            
    \b \cf3 else
    \b0 \cf0 \
              \{\
                Flag_Latch_softwareUpdate = true;\
    \
                \cf2 // the \ul estimator\ulnone  sets the maximum current slope during identification\cf0 \
                gMaxCurrentSlope = 
    \b \cf6 EST_getMaxCurrentSlope_pu
    \b0 \cf0 (obj->\cf7 estHandle\cf0 );\
              \}\
    \
    \
            \cf2 // when appropriate, update the global variables\cf0 \
            
    \b \cf3 if
    \b0 \cf0 (gCounter_updateGlobals >= NUM_MAIN_TICKS_FOR_GLOBAL_VARIABLE_UPDATE)\
              \{\
                \cf2 // reset the counter\cf0 \
                gCounter_updateGlobals = 0;\
    \
                updateGlobalVariables_motor(ctrlHandle);\
              \}\
    \
    \
            \cf2 // update \ul Kp\ulnone  and \ul Ki\ulnone  gains\cf0 \
            updateKpKiGains(ctrlHandle);\
    \
            \cf2 // enable/disable the forced angle\cf0 \
            
    \b \cf6 EST_setFlag_enableForceAngle
    \b0 \cf0 (obj->\cf7 estHandle\cf0 ,gMotorVars.\cf7 Flag_enableForceAngle\cf0 );\
    \
            \cf2 // enable or disable power warp\cf0 \
            CTRL_setFlag_enablePowerWarp(ctrlHandle,gMotorVars.\cf7 Flag_enablePowerWarp\cf0 );\
    \
    
    \b \cf3 #ifdef
    \b0 \cf0  DRV8301_SPI\
            
    \b \cf6 HAL_writeDrvData
    \b0 \cf0 (halHandle,&gDrvSpi8301Vars);\
    \
            
    \b \cf6 HAL_readDrvData
    \b0 \cf0 (halHandle,&gDrvSpi8301Vars);\
    
    \b \cf3 #endif
    \b0 \cf0 \
    
    \b \cf3 #ifdef
    \b0 \cf0  DRV8305_SPI\
            HAL_writeDrvData(halHandle,&gDrvSpi8305Vars);\
    \
            HAL_readDrvData(halHandle,&gDrvSpi8305Vars);\
    
    \b \cf3 #endif
    \b0 \cf0 \
          \} \cf2 // end of while(gFlag_enableSys) loop\cf0 \
    \
    \
        \cf2 // disable the PWM\cf0 \
        HAL_disablePwm(halHandle);\
    \
        \cf2 // set the default controller parameters (Reset the control to re-identify the motor)\cf0 \
        
    \b \cf6 CTRL_setParams
    \b0 \cf0 (ctrlHandle,&gUserParams);\
        gMotorVars.\cf7 Flag_Run_Identify\cf0  = false;\
    \
      \} \cf2 // end of for(;;) loop\cf0 \
    \
    \} \cf2 // end of main() function\cf0 \
    \
    \
    
    \b \cf3 interrupt
    \b0 \cf0  
    \b \cf3 void
    \b0 \cf0  
    \b mainISR
    \b0 (
    \b \cf3 void
    \b0 \cf0 )\
    \{\
      \cf2 // toggle status LED\cf0 \
      
    \b \cf3 if
    \b0 \cf0 (gLEDcnt++ > (\cf5 uint_least32_t\cf0 )(USER_ISR_FREQ_Hz / LED_BLINK_FREQ_Hz))\
      \{\
        HAL_toggleLed(halHandle,(\cf5 GPIO_Number_e\cf0 )
    \i \cf7 HAL_Gpio_LED2
    \i0 \cf0 );\
        gLEDcnt = 0;\
      \}\
    \
      \cf2 // Check if speed reference signal is active\cf0 \
      \cf2 // If more than 2000 service routine cycles pass without signal, disable motor\cf0 \
      
    \b \cf3 if
    \b0 \cf0  (gSpeedRef_Ok++ > 10000)\
      \{\
          gSpeedRef_duty = 0;\
          gMotorVars.\cf7 Flag_Run_Identify\cf0  = 0;\
          gSpeedRef_Ok = 0;\
      \}\
    \
      \cf2 // acknowledge the ADC interrupt\cf0 \
      HAL_acqAdcInt(halHandle,
    \i \cf7 ADC_IntNumber_1
    \i0 \cf0 );\
    \
    \
      \cf2 // convert the ADC data\cf0 \
      HAL_readAdcData(halHandle,&gAdcData);\
    \
    \
      \cf2 // run the controller\cf0 \
      
    \b \cf6 CTRL_run
    \b0 \cf0 (ctrlHandle,halHandle,&gAdcData,&gPwmData);\
    \
    \
      \cf2 // write the PWM compare values\cf0 \
      HAL_writePwmData(halHandle,&gPwmData);\
    \
    \
      \cf2 // setup the controller\cf0 \
      
    \b \cf6 CTRL_setup
    \b0 \cf0 (ctrlHandle);\
    \
    \
      
    \b \cf3 return
    \b0 \cf0 ;\
    \} \cf2 // end of mainISR() function\cf0 \
    \
    \
    
    \b \cf3 void
    \b0 \cf0  
    \b updateGlobalVariables_motor
    \b0 (\cf5 CTRL_Handle\cf0  handle)\
    \{\
      \cf5 CTRL_Obj\cf0  *obj = (\cf5 CTRL_Obj\cf0  *)handle;\
    \
      \cf2 // get the speed estimate\cf0 \
      gMotorVars.\cf7 Speed_krpm\cf0  = 
    \b \cf6 EST_getSpeed_krpm
    \b0 \cf0 (obj->\cf7 estHandle\cf0 );\
    \
      \cf2 // set motor speed command dependent\cf0 \
      \cf2 //gMotorVars.SpeedRef_krpm = _IQ24(gSpeedRef_duty*SPEED_BASE_KRPM);\cf0 \
      gMotorVars.\cf7 SpeedRef_krpm\cf0  = _IQ24(gSpeedRef_duty);\
      \cf2 // get the real time speed reference coming out of the speed trajectory generator\cf0 \
      gMotorVars.\cf7 SpeedTraj_krpm\cf0  = _IQmpy(CTRL_getSpd_int_ref_pu(handle),
    \b \cf6 EST_get_pu_to_krpm_sf
    \b0 \cf0 (obj->\cf7 estHandle\cf0 ));\
    \
      \cf2 // get the torque estimate\cf0 \
      gMotorVars.\cf7 Torque_Nm\cf0  = 
    \b \cf6 USER_computeTorque_Nm
    \b0 \cf0 (handle, gTorque_Flux_Iq_pu_to_Nm_sf, gTorque_Ls_Id_Iq_pu_to_Nm_sf);\
    \
      \cf2 // get the \ul magnetizing\ulnone  current\cf0 \
      gMotorVars.\cf7 MagnCurr_A\cf0  = 
    \b \cf6 EST_getIdRated
    \b0 \cf0 (obj->\cf7 estHandle\cf0 );\
    \
      \cf2 // get the \ul rotor\ulnone  resistance\cf0 \
      gMotorVars.\cf7 Rr_Ohm\cf0  = 
    \b \cf6 EST_getRr_Ohm
    \b0 \cf0 (obj->\cf7 estHandle\cf0 );\
    \
      \cf2 // get the \ul stator\ulnone  resistance\cf0 \
      gMotorVars.\cf7 Rs_Ohm\cf0  = 
    \b \cf6 EST_getRs_Ohm
    \b0 \cf0 (obj->\cf7 estHandle\cf0 );\
    \
      \cf2 // get the \ul stator\ulnone  inductance in the direct coordinate direction\cf0 \
      gMotorVars.\cf7 Lsd_H\cf0  = 
    \b \cf6 EST_getLs_d_H
    \b0 \cf0 (obj->\cf7 estHandle\cf0 );\
    \
      \cf2 // get the \ul stator\ulnone  inductance in the quadrature coordinate direction\cf0 \
      gMotorVars.\cf7 Lsq_H\cf0  = 
    \b \cf6 EST_getLs_q_H
    \b0 \cf0 (obj->\cf7 estHandle\cf0 );\
    \
      \cf2 // get the \ul flux\ulnone  in V/Hz in floating point\cf0 \
      gMotorVars.\cf7 Flux_VpHz\cf0  = 
    \b \cf6 EST_getFlux_VpHz
    \b0 \cf0 (obj->\cf7 estHandle\cf0 );\
    \
      \cf2 // get the \ul flux\ulnone  in \ul Wb\ulnone  in fixed point\cf0 \
      gMotorVars.\cf7 Flux_Wb\cf0  = 
    \b \cf6 USER_computeFlux
    \b0 \cf0 (handle, gFlux_pu_to_Wb_sf);\
    \
      \cf2 // get the controller state\cf0 \
      gMotorVars.\cf7 CtrlState\cf0  = CTRL_getState(handle);\
    \
      \cf2 // get the \ul estimator\ulnone  state\cf0 \
      gMotorVars.\cf7 EstState\cf0  = 
    \b \cf6 EST_getState
    \b0 \cf0 (obj->\cf7 estHandle\cf0 );\
    \
      \cf2 // Get the DC buss voltage\cf0 \
      gMotorVars.\cf7 VdcBus_kV\cf0  = _IQmpy(gAdcData.\cf7 dcBus\cf0 ,_IQ(USER_IQ_FULL_SCALE_VOLTAGE_V/1000.0));\
    \
      
    \b \cf3 return
    \b0 \cf0 ;\
    \} \cf2 // end of updateGlobalVariables_motor() function\cf0 \
    \
    \
    
    \b \cf3 void
    \b0 \cf0  
    \b updateKpKiGains
    \b0 (\cf5 CTRL_Handle\cf0  handle)\
    \{\
      
    \b \cf3 if
    \b0 \cf0 ((gMotorVars.\cf7 CtrlState\cf0  == 
    \i \cf7 CTRL_State_OnLine
    \i0 \cf0 ) && (gMotorVars.\cf7 Flag_MotorIdentified\cf0  == true) && (Flag_Latch_softwareUpdate == false))\
        \{\
          \cf2 // set the \ul kp\ulnone  and \ul ki\ulnone  speed values from the watch window\cf0 \
          CTRL_setKp(handle,
    \i \cf7 CTRL_Type_PID_spd
    \i0 \cf0 ,gMotorVars.\cf7 Kp_spd\cf0 );\
          CTRL_setKi(handle,
    \i \cf7 CTRL_Type_PID_spd
    \i0 \cf0 ,gMotorVars.\cf7 Ki_spd\cf0 );\
    \
          \cf2 // set the \ul kp\ulnone  and \ul ki\ulnone  current values for Id and \ul Iq\ulnone  from the watch window\cf0 \
          CTRL_setKp(handle,
    \i \cf7 CTRL_Type_PID_Id
    \i0 \cf0 ,gMotorVars.\cf7 Kp_Idq\cf0 );\
          CTRL_setKi(handle,
    \i \cf7 CTRL_Type_PID_Id
    \i0 \cf0 ,gMotorVars.\cf7 Ki_Idq\cf0 );\
          CTRL_setKp(handle,
    \i \cf7 CTRL_Type_PID_Iq
    \i0 \cf0 ,gMotorVars.\cf7 Kp_Idq\cf0 );\
          CTRL_setKi(handle,
    \i \cf7 CTRL_Type_PID_Iq
    \i0 \cf0 ,gMotorVars.\cf7 Ki_Idq\cf0 );\
        \}\
    \
      
    \b \cf3 return
    \b0 \cf0 ;\
    \} \cf2 // end of updateKpKiGains() function\cf0 \
    \
    \
    
    \b \cf3 interrupt
    \b0 \cf0  
    \b \cf3 void
    \b0 \cf0  
    \b ecapISR
    \b0 (
    \b \cf3 void
    \b0 \cf0 )\
    \{\
    \
    \
        \cf2 // Compute the PWM high period (rising edge to falling edge)\cf0 \
        PwmDuty = (
    \b \cf3 float
    \b0 \cf0 ) CAP_getCap2(halHandle->\cf7 capHandle\cf0 ) - (
    \b \cf3 float
    \b0 \cf0 ) CAP_getCap1(halHandle->\cf7 capHandle\cf0 );\
        Cmax = 90625*tmax;    \cf2 // \ul ecap\ulnone  maximum count\cf0 \
        Cmin = 90625*tmin;    \cf2 // \ul ecap\ulnone  counter time relating 1ms \ul pwm\ulnone  input\cf0 \
    \pard\pardeftab720\partightenfactor0
    \cf2 //    \ul printf\ulnone ("PwmDuty = %f \\n", PwmDuty);\cf0 \
    \
        \cf2 // Assign the appropriate speed command, combine 0-5% and 95-100%\cf0 \
        \cf2 // 0-100% speed is proportional to 1-2ms high period\cf0 \
        \cf2 // 60MHz * 2ms = 120000\cf0 \
    \
    \cf2 //    // 0-1%\cf0 \
    \cf2 //    if (PwmDuty <= 61000)\cf0 \
    \cf2 //    \{\cf0 \
    \cf2 //        gSpeedRef_Ok = 0;\cf0 \
    \cf2 //        gSpeedRef_duty = 0;\cf0 \
    \cf2 //        gMotorVars.Flag_Run_Identify = 0;\cf0 \
    \cf2 //    \}\cf0 \
        \cf2 // 20-80%\cf0 \
        \cf2 //if ((PwmDuty > 35500) && (PwmDuty < 145000)) //change \ul pwm\ulnone  to respective duty % by changing the condition magnitudes here\cf0 \
        \cf2 //\{\cf0 \
        \cf2 //    gSpeedRef_Ok = 0;\cf0 \
        \cf2 //    gSpeedRef_duty = (PwmDuty)/181250; // duty % max value equivalent in \ul ecap\ulnone  timer count (181250)\cf0 \
        \cf2 //    gMotorVars.Flag_Run_Identify = 1;\cf0 \
        \cf2 //\}\cf0 \
    \
        \cf2 // 50-99% : 1ms to 2ms\cf0 \
    \
           
    \b \cf3 if
    \b0 \cf0  ((PwmDuty > Cmin) && (PwmDuty <= Cmax)) \cf2 //change \ul pwm\ulnone  to respective duty % by changing the condition magnitudes here\cf0 \
           \{\
               gSpeedRef_Ok = 0;\
              \cf2 // gSpeedRef_duty = (PwmDuty)/181250; // duty % max value equivalent in \ul ecap\ulnone  timer count (181250)\cf0 \
              \cf2 // gSpeedRef_duty = (PwmDuty-99688)/81562; // duty % max value equivalent in \ul ecap\ulnone  timer count (181250)\cf0 \
               gSpeedRef_duty = (((Smax-Smin)/(Cmax-Cmin))*(PwmDuty-Cmin) + Smin);\
               gMotorVars.\cf7 Flag_Run_Identify\cf0  = 1;\
           \}\
        \cf2 // > 99%\cf0 \
        \cf2 //else if (PwmDuty >= 181250)\cf0 \
        \cf2 //\{\cf0 \
        \cf2 //    gSpeedRef_Ok = 0;\cf0 \
        \cf2 //    gSpeedRef_duty = 1.0;\cf0 \
        \cf2 //    gMotorVars.Flag_Run_Identify = 1;\cf0 \
        \cf2 //\}\cf0 \
        \cf2 // Catch all\cf0 \
        
    \b \cf3 else
    \b0 \cf0 \
        \{\
            gSpeedRef_duty = 0;\
            gMotorVars.\cf7 Flag_Run_Identify\cf0  = 0;\
        \}\
    \
        \cf2 // Clear capture (CAP) interrupt flags\cf0 \
            CAP_clearInt(halHandle->\cf7 capHandle\cf0 , 
    \i \cf7 CAP_Int_Type_All
    \i0 \cf0 );\
    \
        \cf2 // Clears an interrupt defined by group number\cf0 \
        PIE_clearInt(halHandle->\cf7 pieHandle\cf0 , 
    \i \cf7 PIE_GroupNumber_4
    \i0 \cf0 );\
    \}  \cf2 // end of ecapISR() function\cf0 \
    \
    \
    \cf2 //@\} //\ul defgroup\cf0 \ulnone \
    \cf2 // end of file\cf0 \
    \
    \
    \
    }

  • Sorry, I can't open those two files properly you attached. I assume you are using F28069F/M controlCard, and the USER_MOTOR_MAX_CURRENT is set to enough high value like 80A in user.h.

    Have some questions to you as below.
    1. What current is limited to 5A? And did you have any phase current waveform to show the question?
    2. What control mode are you using? Torque control? Or speed close loop control? I assume you are using speed close loop control since you are working on lab05b.
    3. What value is the gMotorVars.Speed_krpm, gMotorVars.SpeedTraj_krpm and gMotorVars.SpeedRef_krpm? Is the gMotorVars.Speed_krpm near gMotorVars.SpeedTraj_krpm or gMotorVars.SpeedRef_krpm?

    For your questions,
    1. As replied to you above.
    2. gAdcData.I.value is IQ24 format, you might read Ia, Ib and Ic in amps as below.
    _iq Ia_A, Ib_A, Ic_A;
    Ia_A = _IQmpy(gAdcData.I.valu[0], _IQ(USER_IQ_FULL_SCALE_CURRENT_A));
    Ib_A = _IQmpy(gAdcData.I.valu[1], _IQ(USER_IQ_FULL_SCALE_CURRENT_A));
    Ic_A = _IQmpy(gAdcData.I.valu[2], _IQ(USER_IQ_FULL_SCALE_CURRENT_A));

    If you haven't had a chance to look at the workshop material, I think this will help demystify some of the terminology and architecture as well. processors.wiki.ti.com/.../C2000_Archived_Workshops

    3. TP24,TP25,TP27 is for the sampling value to ADC input from the output of current amplifier. You might have a look at Chapter 5 of instaSPIN user's guide, it has a detailed description of your question.
  • Hi Adnan, any update on your end? If not, I'll mark this thread closed for now

    Sean