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.

TMS320F28027F: DRV8301

Part Number: TMS320F28027F
Other Parts Discussed in Thread: MOTORWARE, DRV8301, , DRV8305, CONTROLSUITE, C2000WARE

Tool/software:

I have taken example

C:\ti\motorware\motorware_1_01_00_18\sw\solutions\instaspin_foc\boards\boostxldrv8301_revB\f28x\f2802xF\projects\ccs\proj_lab5b

TMS320F28027F with DRV8301 to run BLDC Motor are not

Any changed the parameters in the user.h file:

I have taken above BLDC motor. In user.h. 

I am define

 #define USER_MOTOR My_Motor

#elif (USER_MOTOR == My_Motor)
#define USER_MOTOR_TYPE                                         MOTOR_Type_Pm
#define USER_MOTOR_NUM_POLE_PAIRS                  (2)
#define USER_MOTOR_Rr                                                (NULL)
#define USER_MOTOR_Rs                                               (0.3918252)
#define USER_MOTOR_Ls_d                                           (0.00023495)
#define USER_MOTOR_Ls_q                                          (0.00023495)
#define USER_MOTOR_RATED_FLUX                             (0.03955824)
#define USER_MOTOR_MAGNETIZING_CURRENT        (NULL)
#define USER_MOTOR_RES_EST_CURRENT                   (3.0)
#define USER_MOTOR_IND_EST_CURRENT                  (-0.5)
#define USER_MOTOR_MAX_CURRENT                        (20.0)
#define USER_MOTOR_FLUX_EST_FREQ_Hz                (20.0)

the above all are already declared.

My BLDC motor (A2212/13T) 1000KV. 

Any changes the above declare the calculation values. Please tell me calculation of my BLDC motor (A2212/13T) 1000KV. 

  • Please take a look at guides in the folders below in motorWare, and follow the guides to set up the kits and run the lab. You may need to run the lab02c to identify the motor parameters first, and then run the following labs like lab05 or lab10

    C:\ti\motorware\motorware_1_01_00_18\docs\labs\instaspin_labs.pdf

    C:\ti\motorware\motorware_1_01_00_18\docs\boards\kits\docs\readmefirst_instaspin_launchboost.pdf

    Please don't add any load on the motor for identification, and set the correct identification variables value in the file of user.h according to the specification of the motor, to make sure the motor spin smoothly during Flux measurement and Ls identification states.

    #define USER_MOTOR_RES_EST_CURRENT     (2.0)                               // A - 10-30% of rated current of the motor

    #define USER_MOTOR_IND_EST_CURRENT     (-1.5)                             // A - 10-30% of rated current of the motor, just enough to enable rotation

    #define USER_MOTOR_MAX_CURRENT           (20.0)                               // A - 30~150% of rated current of the motor

    #define USER_MOTOR_FLUX_EST_FREQ_Hz     (40.0)                           // Hz - 10~30% rated frequency of the motor

    More infomration about PMSM Motor Parameters in user.h, you can take a look at the user's guide below.

    InstaSPIN-FOC and InstaSPIN-MOTION User's Guide

    https://www.ti.com/lit/spruhj1

  • Hi Yanming Luo

    I am replace values you send it, the below values

    #define USER_MOTOR_RES_EST_CURRENT     (2.0)                               // A - 10-30% of rated current of the motor

    #define USER_MOTOR_IND_EST_CURRENT     (-1.5)                             // A - 10-30% of rated current of the motor, just enough to enable rotation

    #define USER_MOTOR_MAX_CURRENT           (20.0)                               // A - 30~150% of rated current of the motor

    #define USER_MOTOR_FLUX_EST_FREQ_Hz     (40.0)                           // Hz - 10~30% rated frequency of the motor

    After that you told that lab02c to identify the motor parameters first below the fig.

    Displaying the above figure, Any suggestions give me.

  • my motor maximum current are shown below

    No. of Cells:                        2 - 3 Li-Poly
                                               6 - 10 NiCd/NiMH


    Kv:                                       1000 RPM/V
    Max Efficiency:                       80%
    Max Efficiency Current:          4 - 10A (>75%)
    No Load Current:                     0.5A @10V
    Resistance:                             0.090 ohms
    Max Current:                              13A for 60S
    Max Watts:                                  150W
    Weight:                                  52.7 g / 1.86 oz
    Size:                                   28 mm dia x 28 mm bell length

    Shaft Diameter:                     3.2 mm
    Poles:                                       14
    Model Weight:                       300 - 800g / 10.5 - 28.2 oz

    #define USER_MOTOR_RES_EST_CURRENT     (2.0)                               // A - 10-30% of rated current of the motor

    #define USER_MOTOR_IND_EST_CURRENT     (-1.5)                             // A - 10-30% of rated current of the motor, just enough to enable rotation

    #define USER_MOTOR_MAX_CURRENT           (20.0)                               // A - 30~150% of rated current of the motor

    #define USER_MOTOR_FLUX_EST_FREQ_Hz     (40.0)                           // Hz - 10~30% rated frequency of the motor

    the above values are you send it, but my motor current  4-10A. you define   #define USER_MOTOR_MAX_CURRENT           (20.0)   

    not a problem are not. Any change the max current value are not.

    max current 20.0 replace 10A are not.

  • The values marked red as below are just for your reference, you should set the values according to the specification of the motor you used, and tune these values per the test to make sure the motor run smoothly during the identification process.

    #define USER_MOTOR_RES_EST_CURRENT     (2.0)                               // A - 10-30% of rated current of the motor

    #define USER_MOTOR_IND_EST_CURRENT     (-1.5)                             // A - 10-30% of rated current of the motor, just enough to enable rotation

    #define USER_MOTOR_MAX_CURRENT           (20.0)                               // A - 30~150% of rated current of the motor

    #define USER_MOTOR_FLUX_EST_FREQ_Hz     (40.0)                           // Hz - 10~30% rated frequency of the motor

  • Hi Yanming Luo

    Thank you so much your support.

  • C:\ti\motorware\motorware_1_01_00_18\sw\solutions\instaspin_foc\boards\boostxldrv8301_revB\f28x\f2802xF\projects\ccs\proj_lab5b

    To run clockwise and anticlockwise. Its possible are not.

    /* --COPYRIGHT--,BSD
    * Copyright (c) 2012, Texas Instruments Incorporated
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * * Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    *
    * * Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the distribution.
    *
    * * Neither the name of Texas Instruments Incorporated nor the names of
    * its contributors may be used to endorse or promote products derived
    * from this software without specific prior written permission.
    *
    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
    * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
    * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    * --/COPYRIGHT--*/
    //! \file solutions/instaspin_foc/src/proj_lab05b.c
    //! \brief Adjusting the speed controller
    //!
    //! (C) Copyright 2011, Texas Instruments, Inc.

    //! \defgroup PROJ_LAB05b PROJ_LAB05b
    //@{

    //! \defgroup PROJ_LAB05b_OVERVIEW Project Overview
    //!
    //! Adjusting the supplied speed controller
    //!

    // **************************************************************************
    // the includes

    // system includes
    #include <math.h>
    #include "main.h"

    #ifdef FLASH
    #pragma CODE_SECTION(mainISR,"ramfuncs");
    #endif

    // Include header files used in the main function


    // **************************************************************************
    // the defines

    #define LED_BLINK_FREQ_Hz 5


    // **************************************************************************
    // the globals

    uint_least16_t gCounter_updateGlobals = 0;

    bool Flag_Latch_softwareUpdate = true;

    CTRL_Handle ctrlHandle;

    #ifdef CSM_ENABLE
    #pragma DATA_SECTION(halHandle,"rom_accessed_data");
    #endif
    HAL_Handle halHandle;

    #ifdef CSM_ENABLE
    #pragma DATA_SECTION(gUserParams,"rom_accessed_data");
    #endif
    USER_Params gUserParams;

    HAL_PwmData_t gPwmData = {_IQ(0.0), _IQ(0.0), _IQ(0.0)};

    HAL_AdcData_t gAdcData;

    _iq gMaxCurrentSlope = _IQ(0.0);

    #ifdef FAST_ROM_V1p6
    CTRL_Obj *controller_obj;
    #else
    #ifdef CSM_ENABLE
    #pragma DATA_SECTION(ctrl,"rom_accessed_data");
    #endif
    CTRL_Obj ctrl; //v1p7 format
    #endif

    uint16_t gLEDcnt = 0;

    volatile MOTOR_Vars_t gMotorVars = MOTOR_Vars_INIT;

    #ifdef FLASH
    // Used for running BackGround in flash, and ISR in RAM
    extern uint16_t *RamfuncsLoadStart, *RamfuncsLoadEnd, *RamfuncsRunStart;

    #ifdef CSM_ENABLE
    extern uint16_t *econst_start, *econst_end, *econst_ram_load;
    extern uint16_t *switch_start, *switch_end, *switch_ram_load;
    #endif
    #endif


    #ifdef DRV8301_SPI
    // Watch window interface to the 8301 SPI
    DRV_SPI_8301_Vars_t gDrvSpi8301Vars;
    #endif

    #ifdef DRV8305_SPI
    // Watch window interface to the 8305 SPI
    DRV_SPI_8305_Vars_t gDrvSpi8305Vars;
    #endif

    _iq gFlux_pu_to_Wb_sf;

    _iq gFlux_pu_to_VpHz_sf;

    _iq gTorque_Ls_Id_Iq_pu_to_Nm_sf;

    _iq gTorque_Flux_Iq_pu_to_Nm_sf;

    // **************************************************************************
    // the functions

    void main(void)
    {
    uint_least8_t estNumber = 0;

    #ifdef FAST_ROM_V1p6
    uint_least8_t ctrlNumber = 1;
    #endif

    // Only used if running from FLASH
    // Note that the variable FLASH is defined by the project
    #ifdef FLASH
    // Copy time critical code and Flash setup code to RAM
    // The RamfuncsLoadStart, RamfuncsLoadEnd, and RamfuncsRunStart
    // symbols are created by the linker. Refer to the linker files.
    memCopy((uint16_t *)&RamfuncsLoadStart,(uint16_t *)&RamfuncsLoadEnd,(uint16_t *)&RamfuncsRunStart);

    #ifdef CSM_ENABLE
    //copy .econst to unsecure RAM
    if(*econst_end - *econst_start)
    {
    memCopy((uint16_t *)&econst_start,(uint16_t *)&econst_end,(uint16_t *)&econst_ram_load);
    }

    //copy .switch ot unsecure RAM
    if(*switch_end - *switch_start)
    {
    memCopy((uint16_t *)&switch_start,(uint16_t *)&switch_end,(uint16_t *)&switch_ram_load);
    }
    #endif
    #endif

    // initialize the hardware abstraction layer
    halHandle = HAL_init(&hal,sizeof(hal));


    // check for errors in user parameters
    USER_checkForErrors(&gUserParams);


    // store user parameter error in global variable
    gMotorVars.UserErrorCode = USER_getErrorCode(&gUserParams);


    // do not allow code execution if there is a user parameter error
    if(gMotorVars.UserErrorCode != USER_ErrorCode_NoError)
    {
    for(;;)
    {
    gMotorVars.Flag_enableSys = false;
    }
    }


    // initialize the user parameters
    USER_setParams(&gUserParams);


    // set the hardware abstraction layer parameters
    HAL_setParams(halHandle,&gUserParams);


    // initialize the controller
    #ifdef FAST_ROM_V1p6
    ctrlHandle = CTRL_initCtrl(ctrlNumber, estNumber); //v1p6 format (06xF and 06xM devices)
    controller_obj = (CTRL_Obj *)ctrlHandle;
    #else
    ctrlHandle = CTRL_initCtrl(estNumber,&ctrl,sizeof(ctrl)); //v1p7 format default
    #endif


    {
    CTRL_Version version;

    // get the version number
    CTRL_getVersion(ctrlHandle,&version);

    gMotorVars.CtrlVersion = version;
    }


    // set the default controller parameters
    CTRL_setParams(ctrlHandle,&gUserParams);


    // setup faults
    HAL_setupFaults(halHandle);


    // initialize the interrupt vector table
    HAL_initIntVectorTable(halHandle);


    // enable the ADC interrupts
    HAL_enableAdcInts(halHandle);


    // enable global interrupts
    HAL_enableGlobalInts(halHandle);


    // enable debug interrupts
    HAL_enableDebugInt(halHandle);


    // disable the PWM
    HAL_disablePwm(halHandle);


    #ifdef DRV8301_SPI
    // turn on the DRV8301 if present
    HAL_enableDrv(halHandle);
    // initialize the DRV8301 interface
    HAL_setupDrvSpi(halHandle,&gDrvSpi8301Vars);
    #endif

    #ifdef DRV8305_SPI
    // turn on the DRV8305 if present
    HAL_enableDrv(halHandle);
    // initialize the DRV8305 interface
    HAL_setupDrvSpi(halHandle,&gDrvSpi8305Vars);
    #endif


    // enable DC bus compensation
    CTRL_setFlag_enableDcBusComp(ctrlHandle, true);


    // compute scaling factors for flux and torque calculations
    gFlux_pu_to_Wb_sf = USER_computeFlux_pu_to_Wb_sf();
    gFlux_pu_to_VpHz_sf = USER_computeFlux_pu_to_VpHz_sf();
    gTorque_Ls_Id_Iq_pu_to_Nm_sf = USER_computeTorque_Ls_Id_Iq_pu_to_Nm_sf();
    gTorque_Flux_Iq_pu_to_Nm_sf = USER_computeTorque_Flux_Iq_pu_to_Nm_sf();


    for(;;)
    {
    // Waiting for enable system flag to be set
    while(!(gMotorVars.Flag_enableSys));

    // Enable the Library internal PI. Iq is referenced by the speed PI now
    CTRL_setFlag_enableSpeedCtrl(ctrlHandle, true);

    // loop while the enable system flag is true
    while(gMotorVars.Flag_enableSys)
    {
    CTRL_Obj *obj = (CTRL_Obj *)ctrlHandle;

    // increment counters
    gCounter_updateGlobals++;

    // enable/disable the use of motor parameters being loaded from user.h
    CTRL_setFlag_enableUserMotorParams(ctrlHandle,gMotorVars.Flag_enableUserParams);

    // enable/disable Rs recalibration during motor startup
    EST_setFlag_enableRsRecalc(obj->estHandle,gMotorVars.Flag_enableRsRecalc);

    // enable/disable automatic calculation of bias values
    CTRL_setFlag_enableOffset(ctrlHandle,gMotorVars.Flag_enableOffsetcalc);


    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
    HAL_disablePwm(halHandle);
    }
    else
    {
    // update the controller state
    bool flag_ctrlStateChanged = CTRL_updateState(ctrlHandle);

    // enable or disable the control
    CTRL_setFlag_enableCtrl(ctrlHandle, gMotorVars.Flag_Run_Identify);

    if(flag_ctrlStateChanged)
    {
    CTRL_State_e ctrlState = CTRL_getState(ctrlHandle);

    if(ctrlState == CTRL_State_OffLine)
    {
    // enable the PWM
    HAL_enablePwm(halHandle);
    }
    else if(ctrlState == CTRL_State_OnLine)
    {
    if(gMotorVars.Flag_enableOffsetcalc == true)
    {
    // update the ADC bias values
    HAL_updateAdcBias(halHandle);
    }
    else
    {
    // set the current bias
    HAL_setBias(halHandle,HAL_SensorType_Current,0,_IQ(I_A_offset));
    HAL_setBias(halHandle,HAL_SensorType_Current,1,_IQ(I_B_offset));
    HAL_setBias(halHandle,HAL_SensorType_Current,2,_IQ(I_C_offset));

    // set the voltage bias
    HAL_setBias(halHandle,HAL_SensorType_Voltage,0,_IQ(V_A_offset));
    HAL_setBias(halHandle,HAL_SensorType_Voltage,1,_IQ(V_B_offset));
    HAL_setBias(halHandle,HAL_SensorType_Voltage,2,_IQ(V_C_offset));
    }

    // Return the bias value for currents
    gMotorVars.I_bias.value[0] = HAL_getBias(halHandle,HAL_SensorType_Current,0);
    gMotorVars.I_bias.value[1] = HAL_getBias(halHandle,HAL_SensorType_Current,1);
    gMotorVars.I_bias.value[2] = HAL_getBias(halHandle,HAL_SensorType_Current,2);

    // Return the bias value for voltages
    gMotorVars.V_bias.value[0] = HAL_getBias(halHandle,HAL_SensorType_Voltage,0);
    gMotorVars.V_bias.value[1] = HAL_getBias(halHandle,HAL_SensorType_Voltage,1);
    gMotorVars.V_bias.value[2] = HAL_getBias(halHandle,HAL_SensorType_Voltage,2);

    // enable the PWM
    HAL_enablePwm(halHandle);
    }
    else if(ctrlState == CTRL_State_Idle)
    {
    // disable the PWM
    HAL_disablePwm(halHandle);
    gMotorVars.Flag_Run_Identify = false;
    }

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

    }
    }


    if(EST_isMotorIdentified(obj->estHandle))
    {
    // set the current ramp
    EST_setMaxCurrentSlope_pu(obj->estHandle,gMaxCurrentSlope);
    gMotorVars.Flag_MotorIdentified = true;

    // set the speed reference
    CTRL_setSpd_ref_krpm(ctrlHandle,gMotorVars.SpeedRef_krpm);

    // set the speed acceleration
    CTRL_setMaxAccel_pu(ctrlHandle,_IQmpy(MAX_ACCEL_KRPMPS_SF,gMotorVars.MaxAccel_krpmps));
    if(Flag_Latch_softwareUpdate)
    {
    Flag_Latch_softwareUpdate = false;

    USER_calcPIgains(ctrlHandle);

    // initialize the watch window kp and ki current values with pre-calculated values
    gMotorVars.Kp_Idq = CTRL_getKp(ctrlHandle,CTRL_Type_PID_Id);
    gMotorVars.Ki_Idq = CTRL_getKi(ctrlHandle,CTRL_Type_PID_Id);

    // initialize the watch window kp and ki values with pre-calculated values
    gMotorVars.Kp_spd = CTRL_getKp(ctrlHandle,CTRL_Type_PID_spd);
    gMotorVars.Ki_spd = CTRL_getKi(ctrlHandle,CTRL_Type_PID_spd);
    }

    }
    else
    {
    Flag_Latch_softwareUpdate = true;

    // the estimator sets the maximum current slope during identification
    gMaxCurrentSlope = EST_getMaxCurrentSlope_pu(obj->estHandle);
    }


    // when appropriate, update the global variables
    if(gCounter_updateGlobals >= NUM_MAIN_TICKS_FOR_GLOBAL_VARIABLE_UPDATE)
    {
    // reset the counter
    gCounter_updateGlobals = 0;

    updateGlobalVariables_motor(ctrlHandle);
    }


    // update Kp and Ki gains
    updateKpKiGains(ctrlHandle);

    // enable/disable the forced angle
    EST_setFlag_enableForceAngle(obj->estHandle,gMotorVars.Flag_enableForceAngle);

    // enable or disable power warp
    CTRL_setFlag_enablePowerWarp(ctrlHandle,gMotorVars.Flag_enablePowerWarp);

    #ifdef DRV8301_SPI
    HAL_writeDrvData(halHandle,&gDrvSpi8301Vars);

    HAL_readDrvData(halHandle,&gDrvSpi8301Vars);
    #endif
    #ifdef DRV8305_SPI
    HAL_writeDrvData(halHandle,&gDrvSpi8305Vars);

    HAL_readDrvData(halHandle,&gDrvSpi8305Vars);
    #endif
    } // end of while(gFlag_enableSys) loop


    // disable the PWM
    HAL_disablePwm(halHandle);

    // 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

    } // end of main() function


    interrupt void mainISR(void)
    {
    // toggle status LED
    if(++gLEDcnt >= (uint_least32_t)(USER_ISR_FREQ_Hz / LED_BLINK_FREQ_Hz))
    {
    HAL_toggleLed(halHandle,(GPIO_Number_e)HAL_Gpio_LED2);
    gLEDcnt = 0;
    }


    // acknowledge the ADC interrupt
    HAL_acqAdcInt(halHandle,ADC_IntNumber_1);


    // convert the ADC data
    HAL_readAdcData(halHandle,&gAdcData);


    // run the controller
    CTRL_run(ctrlHandle,halHandle,&gAdcData,&gPwmData);


    // write the PWM compare values
    HAL_writePwmData(halHandle,&gPwmData);


    // setup the controller
    CTRL_setup(ctrlHandle);


    return;
    } // end of mainISR() function


    void updateGlobalVariables_motor(CTRL_Handle handle)
    {
    CTRL_Obj *obj = (CTRL_Obj *)handle;

    // get the speed estimate
    gMotorVars.Speed_krpm = EST_getSpeed_krpm(obj->estHandle);

    // get the real time speed reference coming out of the speed trajectory generator
    gMotorVars.SpeedTraj_krpm = _IQmpy(CTRL_getSpd_int_ref_pu(handle),EST_get_pu_to_krpm_sf(obj->estHandle));

    // get the torque estimate
    gMotorVars.Torque_Nm = USER_computeTorque_Nm(handle, gTorque_Flux_Iq_pu_to_Nm_sf, gTorque_Ls_Id_Iq_pu_to_Nm_sf);

    // get the magnetizing current
    gMotorVars.MagnCurr_A = EST_getIdRated(obj->estHandle);

    // get the rotor resistance
    gMotorVars.Rr_Ohm = EST_getRr_Ohm(obj->estHandle);

    // get the stator resistance
    gMotorVars.Rs_Ohm = EST_getRs_Ohm(obj->estHandle);

    // get the stator inductance in the direct coordinate direction
    gMotorVars.Lsd_H = EST_getLs_d_H(obj->estHandle);

    // get the stator inductance in the quadrature coordinate direction
    gMotorVars.Lsq_H = EST_getLs_q_H(obj->estHandle);

    // get the flux in V/Hz in floating point
    gMotorVars.Flux_VpHz = EST_getFlux_VpHz(obj->estHandle);

    // get the flux in Wb in fixed point
    gMotorVars.Flux_Wb = USER_computeFlux(handle, gFlux_pu_to_Wb_sf);

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

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

    // Get the DC buss voltage
    gMotorVars.VdcBus_kV = _IQmpy(gAdcData.dcBus,_IQ(USER_IQ_FULL_SCALE_VOLTAGE_V/1000.0));

    return;
    } // end of updateGlobalVariables_motor() function


    void updateKpKiGains(CTRL_Handle handle)
    {
    if((gMotorVars.CtrlState == CTRL_State_OnLine) && (gMotorVars.Flag_MotorIdentified == true) && (Flag_Latch_softwareUpdate == false))
    {
    // set the kp and ki speed values from the watch window
    CTRL_setKp(handle,CTRL_Type_PID_spd,gMotorVars.Kp_spd);
    CTRL_setKi(handle,CTRL_Type_PID_spd,gMotorVars.Ki_spd);

    // set the kp and ki current values for Id and Iq from the watch window
    CTRL_setKp(handle,CTRL_Type_PID_Id,gMotorVars.Kp_Idq);
    CTRL_setKi(handle,CTRL_Type_PID_Id,gMotorVars.Ki_Idq);
    CTRL_setKp(handle,CTRL_Type_PID_Iq,gMotorVars.Kp_Idq);
    CTRL_setKi(handle,CTRL_Type_PID_Iq,gMotorVars.Ki_Idq);
    }

    return;
    } // end of updateKpKiGains() function


    //@} //defgroup
    // end of file

    Clockwise and anti clockwise is possible. If it possible the above code send it. Re modifies it to run clock and anti clock. 

     

  • Are you using your own board? Or TI EVM board?

    Clockwise and anti clockwise is possible. If it possible the above code send it. Re modifies it to run clock and anti clock.

    What do you mean this? What's your question?

  • TI board I am using

    Above figure send it. If it possible developing code without any using project lab examples.

    TI LAUNCHPAD TMS320F28027F and DRV8301 with BLDC Motor (A2212/13T)

  • //#############################################################################
    //
    // File: Example_F2802xCpuTimer.c
    //
    // Title: F2802x CPU Timer Example
    //
    //! \addtogroup example_list
    //! <h1>CPU Timer</h1>
    //!
    //! This example configures CPU Timer0, 1, & 2 and increments
    //! a counter each time the timer asserts an interrupt.
    //!
    //! Watch Variables:
    //! - timer0IntCount
    //! - timer1IntCount
    //! - timer2IntCount
    //
    //#############################################################################
    // $TI Release: F2802x Support Library v3.02.00.00 $
    // $Release Date: Sun Mar 25 13:23:09 CDT 2018 $
    // $Copyright:
    // Copyright (C) 2009-2018 Texas Instruments Incorporated - http://www.ti.com/
    //
    // Redistribution and use in source and binary forms, with or without
    // modification, are permitted provided that the following conditions
    // are met:
    //
    // Redistributions of source code must retain the above copyright
    // notice, this list of conditions and the following disclaimer.
    //
    // Redistributions in binary form must reproduce the above copyright
    // notice, this list of conditions and the following disclaimer in the
    // documentation and/or other materials provided with the
    // distribution.
    //
    // Neither the name of Texas Instruments Incorporated nor the names of
    // its contributors may be used to endorse or promote products derived
    // from this software without specific prior written permission.
    //
    // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    // $
    //#############################################################################

    //
    // Included Files
    //
    #include "DSP28x_Project.h" // Device Headerfile and Examples Include File
    //#include "common/include/clk.h"
    #include "f2802x_common/include/clk.h"

    //#include "common/include/flash.h"
    #include "f2802x_common/include/flash.h"

    //#include "common/include/gpio.h"
    #include "f2802x_common/include/gpio.h"

    #include "f2802x_common/include/pie.h"
    #include "f2802x_common/include/pll.h"
    #include "f2802x_common/include/timer.h"
    #include "f2802x_common/include/wdog.h"
    #include "i2ca.h"
    #include "user.h"
    #include "uart.h"
    #include "printf.h"
    #include "ringBuffer.h"


    //
    // Function Prototypes
    //
    //__interrupt void cpu_timer0_isr(void);
    __interrupt void cpu_timer1_isr(void);
    __interrupt void cpu_timer2_isr(void);
    __interrupt void cpu_timer0_isr(void);
    __interrupt void adc_isr(void);
    __interrupt void hall_a_isr(void);
    __interrupt void hall_b_isr(void);
    __interrupt void hall_c_isr(void);
    __interrupt void sciaTxIsr(void);
    void updatePWMState(volatile struct EPWM_REGS *pwmReg, pwm_state CSFA, pwm_state CSFB);
    void setDutyCycle(uint8_t dutyCycle);
    void initPWM(void);
    void initGPIO(void);
    void initADC(void);
    void itoa(char *buf, int data);

    //
    // Globals
    //
    //unsigned long Xint1Count;
    //unsigned long Xint2Count;
    //unsigned long Xint3Count;
    //unsigned long adcIntCount = 0;
    int length = 0;
    char buf[45];

    CLK_Handle myClk;
    ADC_Handle myAdc;
    FLASH_Handle myFlash;
    GPIO_Handle myGpio;
    PIE_Handle myPie;
    TIMER_Handle myTimer0, myTimer1;
    PWM_Handle myPwm1, myPwm2, myPwm3;
    SCI_Handle mySci;
    CONTROL_Obj Control;
    CONTROL_Obj *ControlPtr = &Control;
    uint8_t dutyCycle = 0;
    uint16_t CMP_GLOBAL;
    //
    // Main
    //
    void main(void)
    {
    CPU_Handle myCpu;
    PLL_Handle myPll;
    WDOG_Handle myWDog;

    //
    // Initialize all the handles needed for this application
    //
    myAdc = ADC_init((void *)ADC_BASE_ADDR, sizeof(ADC_Obj));
    myClk = CLK_init((void *)CLK_BASE_ADDR, sizeof(CLK_Obj));
    myCpu = CPU_init((void *)NULL, sizeof(CPU_Obj));
    myFlash = FLASH_init((void *)FLASH_BASE_ADDR, sizeof(FLASH_Obj));
    myGpio = GPIO_init((void *)GPIO_BASE_ADDR, sizeof(GPIO_Obj));
    myPie = PIE_init((void *)PIE_BASE_ADDR, sizeof(PIE_Obj));
    myPll = PLL_init((void *)PLL_BASE_ADDR, sizeof(PLL_Obj));
    myTimer0 = TIMER_init((void *)TIMER0_BASE_ADDR, sizeof(TIMER_Obj));
    myTimer1 = TIMER_init((void *)TIMER1_BASE_ADDR, sizeof(TIMER_Obj));
    myWDog = WDOG_init((void *)WDOG_BASE_ADDR, sizeof(WDOG_Obj));
    myPwm1 = PWM_init((void *)PWM_ePWM1_BASE_ADDR, sizeof(PWM_Obj));
    myPwm2 = PWM_init((void *)PWM_ePWM2_BASE_ADDR, sizeof(PWM_Obj));
    myPwm3 = PWM_init((void *)PWM_ePWM3_BASE_ADDR, sizeof(PWM_Obj));
    mySci = SCI_init((void *)SCIA_BASE_ADDR, sizeof(SCI_Obj));

    /*
    * Initialize the Main Control Object.
    */
    initControl(ControlPtr);


    //
    // Step 1. Initialize System Control:
    // PLL, WatchDog, enable Peripheral Clocks
    // This example function is found in the f2802x_SysCtrl.c file.
    //
    //InitSysCtrl();

    //
    // Perform basic system initialization
    //
    WDOG_disable(myWDog);
    CLK_enableAdcClock(myClk);
    (*Device_cal)();

    //
    // Select the internal oscillator 1 as the clock source
    //
    CLK_setOscSrc(myClk, CLK_OscSrc_Internal);

    //
    // Setup the PLL for x12 /2 which will yield 60Mhz = 10Mhz * 12 / 2
    //
    PLL_setup(myPll, PLL_Multiplier_12, PLL_DivideSelect_ClkIn_by_2);

    //
    // Disable the PIE and all interrupts
    //
    PIE_disable(myPie);
    PIE_disableAllInts(myPie);
    CPU_disableGlobalInts(myCpu);
    CPU_clearIntFlags(myCpu);

    //
    // Step 2. Initialize GPIO:
    // This example function is found in the f2802x_Gpio.c file and
    // illustrates how to set the GPIO to it's default state.
    //
    //InitGpio(); // Skipped for this example

    //
    // Step 3. Clear all interrupts and initialize PIE vector table:
    // Disable CPU interrupts
    //
    //DINT;

    //
    // Initialize the PIE control registers to their default state.
    // The default state is all PIE interrupts disabled and flags
    // are cleared.
    // This function is found in the f2802x_PieCtrl.c file.
    //
    //InitPieCtrl();

    //
    // Disable CPU interrupts and clear all CPU interrupt flags:
    //
    //IER = 0x0000;
    //IFR = 0x0000;

    //
    // Initialize the PIE vector table with pointers to the shell Interrupt
    // Service Routines (ISR).
    // This will populate the entire table, even if the interrupt
    // is not used in this example. This is useful for debug purposes.
    // The shell ISR routines are found in f2802x_DefaultIsr.c.
    // This function is found in f2802x_PieVect.c.
    //
    //InitPieVectTable();
    PIE_setDebugIntVectorTable(myPie);
    PIE_enable(myPie);

    //
    // Interrupts that are used in this example are re-mapped to
    // ISR functions found within this file.
    //
    EALLOW; // This is needed to write to EALLOW protected registers
    PIE_registerPieIntHandler(myPie, PIE_GroupNumber_1, PIE_SubGroupNumber_7,
    (intVec_t)&cpu_timer0_isr);
    PIE_registerSystemIntHandler(myPie, PIE_SystemInterrupts_TINT1,
    (intVec_t)&cpu_timer1_isr);
    PIE_registerPieIntHandler(myPie, PIE_GroupNumber_10, PIE_SubGroupNumber_1,
    (intVec_t)&adc_isr);
    PIE_registerPieIntHandler(myPie, PIE_GroupNumber_1, PIE_SubGroupNumber_4,
    (intVec_t)&hall_a_isr);
    PIE_registerPieIntHandler(myPie, PIE_GroupNumber_1, PIE_SubGroupNumber_5,
    (intVec_t)&hall_b_isr);
    PIE_registerPieIntHandler(myPie, PIE_GroupNumber_12, PIE_SubGroupNumber_1,
    (intVec_t)&hall_c_isr);
    PIE_registerPieIntHandler(myPie, PIE_GroupNumber_9, PIE_SubGroupNumber_2,
    (intVec_t)&sciaTxIsr);

    PIE_enableInt(myPie, PIE_GroupNumber_1, PIE_InterruptSource_XINT_1);
    PIE_enableInt(myPie, PIE_GroupNumber_1, PIE_InterruptSource_XINT_2);
    PIE_enableInt(myPie, PIE_GroupNumber_12, PIE_InterruptSource_XINT_3);
    //PIE_enableInt(myPie, PIE_GroupNumber_9, PIE_InterruptSource_SCIARX);
    PIE_enableInt(myPie, PIE_GroupNumber_9, PIE_InterruptSource_SCIATX);
    PIE_enableInt(myPie, PIE_GroupNumber_1, PIE_InterruptSource_TIMER_0);


    EDIS; // This is needed to disable write to EALLOW protected registers

    #ifdef _FLASH
    //
    // Copy time critical code and Flash setup code to RAM
    // This includes the following ISR functions: EPwm1_timer_isr(),
    // EPwm2_timer_isr() and FLASH_setup();
    // The RamfuncsLoadStart, RamfuncsLoadSize, and RamfuncsRunStart
    // symbols are created by the linker. Refer to the F228027.cmd file.
    //
    memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);

    //
    // Call Flash Initialization to setup flash waitstates
    // This function must reside in RAM
    //
    FLASH_setup(myFlash);
    #endif
    //
    // Step 4. Initialize the Device Peripheral. This function can be
    // found in f2802x_CpuTimers.c
    //
    //InitCpuTimers(); // For this example, only initialize the Cpu Timers
    TIMER_stop(myTimer0);
    TIMER_stop(myTimer1);

    initGPIO();
    //
    // Configure XINT1
    //
    PIE_setExtIntPolarity(myPie, CPU_ExtIntNumber_1, PIE_ExtIntPolarity_RisingAndFallingEdge);
    PIE_setExtIntPolarity(myPie, CPU_ExtIntNumber_2, PIE_ExtIntPolarity_RisingAndFallingEdge);
    PIE_setExtIntPolarity(myPie, CPU_ExtIntNumber_3, PIE_ExtIntPolarity_RisingAndFallingEdge);

    //
    // Enable XINT1
    //
    PIE_enableExtInt(myPie, CPU_ExtIntNumber_1);
    PIE_enableExtInt(myPie, CPU_ExtIntNumber_2);
    PIE_enableExtInt(myPie, CPU_ExtIntNumber_3);

    #if (CPU_FRQ_60MHZ)
    //
    // Configure CPU-Timer 0, 1, and 2 to interrupt every second:
    // 60MHz CPU Freq, 1 second Period (in uSeconds)
    //
    //ConfigCpuTimer(&CpuTimer0, 60, 1000000);
    TIMER_setPeriod(myTimer0, 60 * 1000000);
    //ConfigCpuTimer(&CpuTimer1, 60, 1000000);
    TIMER_setPeriod(myTimer1, 60 * 1000000);
    //ConfigCpuTimer(&CpuTimer2, 60, 1000000);

    #endif
    #if (CPU_FRQ_40MHZ)
    //
    // Configure CPU-Timer 0, 1, and 2 to interrupt every second:
    // 40MHz CPU Freq, 1 second Period (in uSeconds)
    //
    //ConfigCpuTimer(&CpuTimer0, 40, 1000000);
    TIMER_setPeriod(myTimer0, 40 * 1000000);
    //ConfigCpuTimer(&CpuTimer1, 40, 1000000);
    TIMER_setPeriod(myTimer1, 40 * 1000000);
    //ConfigCpuTimer(&CpuTimer2, 40, 1000000);
    TIMER_setPeriod(myTimer2, 40 * 1000000);
    #endif


    TIMER_setPreScaler(myTimer0, 0); // No prescaler
    TIMER_reload(myTimer0);
    TIMER_setEmulationMode(myTimer0,
    TIMER_EmulationMode_StopAtZero);
    TIMER_enableInt(myTimer0);


    TIMER_setPreScaler(myTimer1, 0);
    TIMER_reload(myTimer1);
    TIMER_setEmulationMode(myTimer1,
    TIMER_EmulationMode_StopAtZero);
    TIMER_enableInt(myTimer1);
    //
    // To ensure precise timing, use write-only instructions to write to the
    // entire register. Therefore, if any of the configuration bits are changed
    // in ConfigCpuTimer and InitCpuTimers (in f2802x_CpuTimers.h), the
    // below settings must also be updated.
    //

    //
    // Use write-only instruction to set TSS bit = 0
    //
    //CpuTimer0Regs.TCR.all = 0x4001;
    //TIMER_start(myTimer0);

    //
    // Use write-only instruction to set TSS bit = 0
    //
    //CpuTimer1Regs.TCR.all = 0x4001;
    TIMER_start(myTimer1);
    TIMER_start(myTimer0);


    //
    // Use write-only instruction to set TSS bit = 0
    //
    //CpuTimer2Regs.TCR.all = 0x4001;
    //TIMER_start(myTimer2);

    //
    // Step 5. User specific code, enable interrupts:
    //

    //
    // Enable CPU int1 which is connected to CPU-Timer 0, CPU int13
    // which is connected to CPU-Timer 1, CPU int 9 which is connected to SCITX int and CPU int 14, which is connected
    // to CPU-Timer 2
    //
    CPU_enableInt(myCpu, CPU_IntNumber_13);
    CPU_enableInt(myCpu, CPU_IntNumber_10);
    CPU_enableInt(myCpu, CPU_IntNumber_1);
    CPU_enableInt(myCpu, CPU_IntNumber_12);
    CPU_enableInt(myCpu, CPU_IntNumber_9);
    int tempIER = CPU_IntNumber_1 | CPU_IntNumber_9 | CPU_IntNumber_10 | CPU_IntNumber_12;
    IER &= tempIER;


    //CPU_enableInt(myCpu, CPU_IntNumber_14);

    //
    // Enable TINT0 in the PIE: Group 1 interrupt 7
    //
    PIE_enableTimer0Int(myPie);

    //
    // Enable global Interrupts and higher priority real-time debug events
    //
    CPU_enableGlobalInts(myCpu); // Enable Global interrupt INTM


    CPU_enableDebugInt(myCpu); // Enable Global realtime interrupt DBGM

    //
    // Step 6. IDLE loop. Just sit and loop forever (optional)
    //
    // CLK_disableTbClockSync(myClk);
    initPWM();
    CLK_enableTbClockSync(myClk);
    initADC();
    i2ca_init();
    scia_init(); // Initialize SCI
    scia_msg("Hello World!\n\0");
    initHallStates(myGpio, ControlPtr, GPIO_Number_12, GPIO_Number_6, GPIO_Number_7);
    commutateMotor(ControlPtr);
    for(;;) {
    length = snprintf(buf, sizeof(buf), "{\"RPM\": %f, \"Battery\": %f}\n\r", 25.2, ControlPtr->battery.percBat);
    if (RING_BUFFER_SIZE - ring_buffer_num_items(&ControlPtr->ringBuf) > length){ // Check if there's enough room in buffer for new string
    ring_buffer_queue_arr(&(ControlPtr->ringBuf), buf, length);
    }

    if (ControlPtr->hallErr == TRUE) GPIO_setHigh(myGpio, GPIO_Number_19); // Turn ON error led
    else GPIO_setLow(myGpio, GPIO_Number_19); // Turn OFF error led

    if (ControlPtr->state == BRAKE){
    updatePWMState(&EPwm1Regs, LOW, HIGH); // Phase A
    updatePWMState(&EPwm2Regs, LOW, HIGH); // Phase B
    updatePWMState(&EPwm3Regs, LOW, HIGH); // Phase C
    } else if (ControlPtr->state == RUN){
    if (ControlPtr->speedCalc.speedUpdateReady == TRUE){
    double periodSecs, freqHz;
    unsigned long periodCycles;
    periodCycles = (ControlPtr->speedCalc.timerPeriod - ControlPtr->speedCalc.timerVal); // Electrical rotation period in seconds
    periodSecs = (double) periodCycles/(ControlPtr->speedCalc.timerPeriod);
    freqHz = 1/periodSecs;
    ControlPtr->speedCalc.rpm = freqHz * 60.0/ControlPtr->motor.npp; // Update the speed value
    ControlPtr->speedCalc.speedUpdateReady = FALSE;
    if (ControlPtr->speedCalc.rpm > MIN_CLOSED_LOOP_RPM){
    // dutyCycle = updatePI(ControlPtr);
    // setDutyCycle(dutyCycle);
    }
    }

    } else if (ControlPtr->state == COAST){
    updatePWMState(&EPwm1Regs, LOW, LOW); // Phase A
    updatePWMState(&EPwm2Regs, LOW, LOW); // Phase B
    updatePWMState(&EPwm3Regs, LOW, LOW); // Phase C
    }
    }
    }

    void initGPIO(void){
    // Set GPIO28 as RX and GPIO29 as TX for SCIA
    GPIO_setPullUp(myGpio, GPIO_Number_28, GPIO_PullUp_Enable);
    GPIO_setPullUp(myGpio, GPIO_Number_29, GPIO_PullUp_Disable);
    GPIO_setMode(myGpio, GPIO_Number_28, GPIO_28_Mode_SCIRXDA);
    GPIO_setMode(myGpio, GPIO_Number_29, GPIO_29_Mode_SCITXDA);

    // Set GPIO32 as SDA and GPIO33 as SCL for I2C communication with fuel gauge
    GPIO_setMode(myGpio, GPIO_Number_32, GPIO_32_Mode_SDAA);
    GPIO_setMode(myGpio, GPIO_Number_33, GPIO_33_Mode_SCLA);

    GPIO_setMode(myGpio, GPIO_Number_19, GPIO_19_Mode_GeneralPurpose);
    GPIO_setDirection(myGpio, GPIO_Number_19, GPIO_Direction_Output);

    GPIO_setMode(myGpio, GPIO_Number_16, GPIO_16_Mode_GeneralPurpose);
    GPIO_setDirection(myGpio, GPIO_Number_16, GPIO_Direction_Output);
    GPIO_setHigh(myGpio, GPIO_Number_16); // Enable linear regulator for gate drivers

    // Set Up GPIO12 (Hall Sensor A) as input.
    GPIO_setMode(myGpio, GPIO_Number_12, GPIO_12_Mode_GeneralPurpose);
    GPIO_setDirection(myGpio, GPIO_Number_12, GPIO_Direction_Input);
    GPIO_setQualification(myGpio, GPIO_Number_12, GPIO_Qual_Sample_6);
    GPIO_setQualificationPeriod(myGpio, GPIO_Number_12, 0xFF); // 60MHz/(2*30) = 1uS

    // Set Up GPIO6 (Hall Sensor B) as input
    GPIO_setMode(myGpio, GPIO_Number_6, GPIO_6_Mode_GeneralPurpose);
    GPIO_setDirection(myGpio, GPIO_Number_6, GPIO_Direction_Input);
    GPIO_setQualification(myGpio, GPIO_Number_6, GPIO_Qual_Sample_6);
    GPIO_setQualificationPeriod(myGpio, GPIO_Number_6, 0xFF); // 60MHz/(2*30) = 1uS

    // Set Up GPIO7 (Hall Sensor C) as input.
    GPIO_setMode(myGpio, GPIO_Number_7, GPIO_7_Mode_GeneralPurpose);
    GPIO_setDirection(myGpio, GPIO_Number_7, GPIO_Direction_Input);
    GPIO_setQualification(myGpio, GPIO_Number_7, GPIO_Qual_Sample_6);
    GPIO_setQualificationPeriod(myGpio, GPIO_Number_7, 0xFF); // 60MHz/(2*30) = 1uS

    GPIO_setPullUp(myGpio, GPIO_Number_12, GPIO_PullUp_Enable);
    GPIO_setPullUp(myGpio, GPIO_Number_6, GPIO_PullUp_Enable);
    GPIO_setPullUp(myGpio, GPIO_Number_7, GPIO_PullUp_Enable);
    //
    // GPIO12 is XINT1 (Hall A), GPIO6 is XINT2 (Hall B), GPIO7 is XINT3 (Hall C)
    //
    GPIO_setExtInt(myGpio, GPIO_Number_12, CPU_ExtIntNumber_1);
    GPIO_setExtInt(myGpio, GPIO_Number_6, CPU_ExtIntNumber_2);
    GPIO_setExtInt(myGpio, GPIO_Number_7, CPU_ExtIntNumber_3);

    //
    // Initialize GPIO for PWM
    //
    GPIO_setPullUp(myGpio, GPIO_Number_0, GPIO_PullUp_Disable);
    GPIO_setPullUp(myGpio, GPIO_Number_1, GPIO_PullUp_Disable);
    GPIO_setMode(myGpio, GPIO_Number_0, GPIO_0_Mode_EPWM1A);
    GPIO_setMode(myGpio, GPIO_Number_1, GPIO_1_Mode_EPWM1B);

    GPIO_setPullUp(myGpio, GPIO_Number_2, GPIO_PullUp_Disable);
    GPIO_setPullUp(myGpio, GPIO_Number_3, GPIO_PullUp_Disable);
    GPIO_setMode(myGpio, GPIO_Number_2, GPIO_2_Mode_EPWM2A);
    GPIO_setMode(myGpio, GPIO_Number_3, GPIO_3_Mode_EPWM2B);

    GPIO_setPullUp(myGpio, GPIO_Number_4, GPIO_PullUp_Disable);
    GPIO_setPullUp(myGpio, GPIO_Number_5, GPIO_PullUp_Disable);
    GPIO_setMode(myGpio, GPIO_Number_4, GPIO_4_Mode_EPWM3A);
    GPIO_setMode(myGpio, GPIO_Number_5, GPIO_5_Mode_EPWM3B);
    }

    void initADC(void){
    //
    // Initialize the ADC
    //
    ADC_enableBandGap(myAdc);
    ADC_enableRefBuffers(myAdc);
    ADC_powerUp(myAdc);
    ADC_enable(myAdc);
    ADC_setVoltRefSrc(myAdc, ADC_VoltageRefSrc_Int);

    ADC_setIntPulseGenMode(myAdc, ADC_IntPulseGenMode_Prior);
    ADC_enableInt(myAdc, ADC_IntNumber_1);
    ADC_setIntMode(myAdc, ADC_IntNumber_1, ADC_IntMode_EOC);
    ADC_setIntSrc(myAdc, ADC_IntNumber_1, ADC_IntSrc_EOC0);
    ADC_setSocChanNumber (myAdc, ADC_SocNumber_0, ADC_SocChanNumber_B1);
    ADC_setSocTrigSrc(myAdc, ADC_SocNumber_0, ADC_SocTrigSrc_CpuTimer_1);
    ADC_setSocSampleWindow(myAdc, ADC_SocNumber_0,
    ADC_SocSampleWindow_37_cycles);
    PIE_enableAdcInt(myPie, ADC_IntNumber_1);
    }

    void initPWM(void)
    {
    CLK_enablePwmClock(myClk, PWM_Number_1);
    CLK_enablePwmClock(myClk, PWM_Number_2);
    CLK_enablePwmClock(myClk, PWM_Number_3);
    EPwm1Regs.TBPRD = TBPRD_VALUE; // Period = 2*TBPRD TBCLK counts
    EPwm1Regs.TBPHS.half.TBPHS = 0; // Set Phase register to zero
    EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Symmetrical mode
    EPwm1Regs.DBCTL.bit.OUT_MODE = DB_DISABLE; // Disable Dead-band module
    EPwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE; // Master module
    EPwm1Regs.TBCTL.bit.PRDLD = TB_SHADOW;
    EPwm1Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO; // Sync down-stream module
    EPwm1Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;
    EPwm1Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
    EPwm1Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; // load on CTR=Zero
    EPwm1Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO; // load on CTR=Zero
    EPwm1Regs.AQCTLA.bit.CAU = AQ_CLEAR; // set actions for EPWM1A
    EPwm1Regs.AQCTLA.bit.CAD = AQ_SET;
    EPwm1Regs.AQCTLB.bit.CBU = AQ_SET; // set actions for EPWM1A
    EPwm1Regs.AQCTLB.bit.CBD = AQ_CLEAR;

    //EPwm1Regs.AQCSFRC.bit.CSFA = 0x0; // PWM still on
    //EPwm1Regs.AQCSFRC.bit.CSFA = 0x1; // Use these commands to force PWM outputs low or high
    //EPwm1Regs.AQCSFRC.bit.CSFB = 0x2;

    // EPWM Module 2 config
    EPwm2Regs.TBPRD = TBPRD_VALUE;
    EPwm2Regs.TBPHS.half.TBPHS = 0; // Set Phase register to zero
    EPwm2Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Symmetrical mode
    EPwm2Regs.DBCTL.bit.OUT_MODE = DB_DISABLE; // Disable Dead-band module
    EPwm2Regs.TBCTL.bit.PHSEN = TB_ENABLE; // Slave module
    EPwm2Regs.TBCTL.bit.PRDLD = TB_SHADOW;
    EPwm2Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_IN; // sync flow-through
    EPwm2Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;
    EPwm2Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
    EPwm2Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; // load on CTR=Zero
    EPwm2Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO; // load on CTR=Zero
    EPwm2Regs.AQCTLA.bit.CAU = AQ_CLEAR; // set actions for EPWM2A
    EPwm2Regs.AQCTLA.bit.CAD = AQ_SET;
    EPwm2Regs.AQCTLB.bit.CBU = AQ_SET; // set actions for EPWM1A
    EPwm2Regs.AQCTLB.bit.CBD = AQ_CLEAR;

    // EPWM Module 3 config
    EPwm3Regs.TBPRD = TBPRD_VALUE;
    EPwm3Regs.TBPHS.half.TBPHS = 0; // Set Phase register to zero
    EPwm3Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Symmetrical mode
    EPwm3Regs.DBCTL.bit.OUT_MODE = DB_DISABLE; // Disable Dead-band module
    EPwm3Regs.TBCTL.bit.PHSEN = TB_ENABLE; // Slave module
    EPwm3Regs.TBCTL.bit.PRDLD = TB_SHADOW;
    EPwm3Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_IN; // sync flow-through
    EPwm3Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;
    EPwm3Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
    EPwm3Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; // load on CTR=Zero
    EPwm3Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO; // load on CTR=Zero
    EPwm3Regs.AQCTLA.bit.CAU = AQ_CLEAR; // set actions for EPWM3A
    EPwm3Regs.AQCTLA.bit.CAD = AQ_SET;
    EPwm3Regs.AQCTLB.bit.CBU = AQ_SET; // set actions for EPWM1A
    EPwm3Regs.AQCTLB.bit.CBD = AQ_CLEAR;


    EPwm1Regs.CMPA.half.CMPA = 300; // adjust duty for output EPWM1A
    EPwm1Regs.CMPB = 310; // adjust duty for output EPWM3B

    EPwm2Regs.CMPA.half.CMPA = 300; // adjust duty for output EPWM2A
    EPwm2Regs.CMPB = 310; // adjust duty for output EPWM3B

    EPwm3Regs.CMPA.half.CMPA = 300; // adjust duty for output EPWM3A
    EPwm3Regs.CMPB = 310; // adjust duty for output EPWM3B

    // Brake the motor to start off
    updatePWMState(&EPwm1Regs, LOW, HIGH); // Phase A
    updatePWMState(&EPwm2Regs, LOW, HIGH); // Phase B
    updatePWMState(&EPwm3Regs, LOW, HIGH); // Phase C

    }

    __interrupt void
    sciaTxIsr(void)
    {
    char buf, ch;
    static parse_state parseState = BUFFER_EMPTY;

    if (ring_buffer_dequeue(&(ControlPtr->ringBuf), &buf) == TRUE){
    scia_xmit(buf); // Transmit just one byte if there is data in the ring buffer
    }


    //
    // Clear SCI Interrupt flag
    //
    SCI_clearTxFifoInt(mySci);

    //
    // Issue PIE ACK
    //
    PIE_clearInt(myPie, PIE_GroupNumber_9);

    return;
    }

    //
    // cpu_timer1_isr -
    //
    __interrupt void
    cpu_timer1_isr(void)
    {
    /*
    * Use this ISR to send out one byte over UART from ring buffer, which is filled in main loop
    */


    // ADC SOC should occur when this interrupt fires


    }

    __interrupt void
    cpu_timer0_isr(void)
    {
    if (TIMER_getStatus(myTimer0) == TIMER_Status_CntIsZero){
    ControlPtr->speedCalc.rpm = 0; // Set RPM to 0 and skip RPM calculation
    ControlPtr->speedCalc.speedUpdateReady = FALSE;
    }

    PIE_clearInt(myPie, PIE_GroupNumber_1);
    TIMER_clearFlag(myTimer0);
    TIMER_stop(myTimer0);

    }


    //
    // adc_isr -
    //
    __interrupt void
    adc_isr(void)
    {

    unsigned int adc_counts = ADC_readResult(myAdc, ADC_ResultNumber_0);
    double result = (double)(adc_counts*ControlPtr->speedCalc.rpmMax)/((1 << NUM_ADC_BITS) - 1);
    ControlPtr->speedCalc.rpmRef = result; // Update the command value used by the PI controller
    ADC_clearIntFlag(myAdc, ADC_IntNumber_1);
    PIE_clearInt(myPie, PIE_GroupNumber_10);


    return;
    }
    //
    // hall_a_isr-
    //
    __interrupt void
    hall_a_isr(void)
    {
    uint32_t gpioVal = GPIO_getData(myGpio, GPIO_Number_12);
    updateHall_A(gpioVal, ControlPtr);
    checkHallErr(ControlPtr);
    commutateMotor(ControlPtr);

    //GPIO_toggle(myGpio, GPIO_Number_29);
    if (gpioVal == 1){ // Used to get time between rising edge to calculate speed.
    //GPIO_setHigh(myGpio, GPIO_Number_29);
    } else {
    if (myTimer0->TCR & TIMER_TCR_TSS_BITS){ // If timer is stopped, start timer and begin count
    //GPIO_setLow(myGpio, GPIO_Number_28);
    TIMER_reload(myTimer0);
    TIMER_start(myTimer0);
    }else {
    // GPIO_setHigh(myGpio, GPIO_Number_28);
    TIMER_stop(myTimer0);

    ControlPtr->speedCalc.timerVal = TIMER_getCount(myTimer0);
    ControlPtr->speedCalc.speedUpdateReady = TRUE;

    }
    //GPIO_setLow(myGpio, GPIO_Number_29);
    }
    //
    // Acknowledge this interrupt to get more from group 1
    //
    PIE_clearInt(myPie, PIE_GroupNumber_1);
    }
    //
    // hall_b_isr-
    //
    __interrupt void
    hall_b_isr(void)
    {
    uint32_t gpioVal = GPIO_getData(myGpio, GPIO_Number_6);
    updateHall_B(gpioVal, ControlPtr);
    checkHallErr(ControlPtr);
    commutateMotor(ControlPtr);

    //
    // Acknowledge this interrupt to get more from group 1
    //
    PIE_clearInt(myPie, PIE_GroupNumber_1);
    }
    //
    // hall_c_isr -
    //
    __interrupt void
    hall_c_isr(void)
    {
    uint32_t gpioVal = GPIO_getData(myGpio, GPIO_Number_7);
    updateHall_C(gpioVal, ControlPtr);
    checkHallErr(ControlPtr);
    commutateMotor(ControlPtr);

    //
    // Acknowledge this interrupt to get more from group 12
    //
    PIE_clearInt(myPie, PIE_GroupNumber_12);
    }

    //
    // End of File
    //

    The above code sum errors occur. Given below

    *** Build Finished ****

    **** Build of configuration Debug for project motor_app ****

    "D:\\Texas_instrument\\ccs\\utils\\bin\\gmake" -k -j 12 all -O

    Building file: "../main.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/controlSUITE/device_support/f2802x/v230" --include_path="D:/Texas_instrument/controlSUITE/libs/math/IQmath/v15c/include" --include_path="D:/TI_Progrms/motor_app" --include_path="D:/Texas_instrument/controlSUITE/device_support/f2802x/v230/f2802x_headers/include" --include_path="D:/Texas_instrument/controlSUITE/device_support/f2802x/v230/f2802x_common/include" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --emit_warnings_as_errors --abi=coffabi --preproc_with_compile --preproc_dependency="main.d_raw" "../main.c"

    >> Compilation failure
    subdir_rules.mk:9: recipe for target 'main.obj' failed
    "../main.c", line 220: error: function "PIE_setDebugIntVectorTable" declared implicitly
    "../main.c", line 605: error: variable "ch" was declared but never referenced
    "../main.c", line 606: error: variable "parseState" was declared but never referenced
    "../main.c", line 688: error: pointer to incomplete class type is not allowed
    4 errors detected in the compilation of "../main.c".
    gmake: *** [main.obj] Error 1
    Building file: "../i2ca.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/controlSUITE/device_support/f2802x/v230" --include_path="D:/Texas_instrument/controlSUITE/libs/math/IQmath/v15c/include" --include_path="D:/TI_Progrms/motor_app" --include_path="D:/Texas_instrument/controlSUITE/device_support/f2802x/v230/f2802x_headers/include" --include_path="D:/Texas_instrument/controlSUITE/device_support/f2802x/v230/f2802x_common/include" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --emit_warnings_as_errors --abi=coffabi --preproc_with_compile --preproc_dependency="i2ca.d_raw" "../i2ca.c"
    Finished building: "../i2ca.c"

    Building file: "../uart.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/controlSUITE/device_support/f2802x/v230" --include_path="D:/Texas_instrument/controlSUITE/libs/math/IQmath/v15c/include" --include_path="D:/TI_Progrms/motor_app" --include_path="D:/Texas_instrument/controlSUITE/device_support/f2802x/v230/f2802x_headers/include" --include_path="D:/Texas_instrument/controlSUITE/device_support/f2802x/v230/f2802x_common/include" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --emit_warnings_as_errors --abi=coffabi --preproc_with_compile --preproc_dependency="uart.d_raw" "../uart.c"
    Finished building: "../uart.c"

    Building file: "../ringBuffer.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/controlSUITE/device_support/f2802x/v230" --include_path="D:/Texas_instrument/controlSUITE/libs/math/IQmath/v15c/include" --include_path="D:/TI_Progrms/motor_app" --include_path="D:/Texas_instrument/controlSUITE/device_support/f2802x/v230/f2802x_headers/include" --include_path="D:/Texas_instrument/controlSUITE/device_support/f2802x/v230/f2802x_common/include" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --emit_warnings_as_errors --abi=coffabi --preproc_with_compile --preproc_dependency="ringBuffer.d_raw" "../ringBuffer.c"
    Finished building: "../ringBuffer.c"

    Building file: "../user.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/controlSUITE/device_support/f2802x/v230" --include_path="D:/Texas_instrument/controlSUITE/libs/math/IQmath/v15c/include" --include_path="D:/TI_Progrms/motor_app" --include_path="D:/Texas_instrument/controlSUITE/device_support/f2802x/v230/f2802x_headers/include" --include_path="D:/Texas_instrument/controlSUITE/device_support/f2802x/v230/f2802x_common/include" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --emit_warnings_as_errors --abi=coffabi --preproc_with_compile --preproc_dependency="user.d_raw" "../user.c"
    Finished building: "../user.c"

    Building file: "../printf.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/controlSUITE/device_support/f2802x/v230" --include_path="D:/Texas_instrument/controlSUITE/libs/math/IQmath/v15c/include" --include_path="D:/TI_Progrms/motor_app" --include_path="D:/Texas_instrument/controlSUITE/device_support/f2802x/v230/f2802x_headers/include" --include_path="D:/Texas_instrument/controlSUITE/device_support/f2802x/v230/f2802x_common/include" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --emit_warnings_as_errors --abi=coffabi --preproc_with_compile --preproc_dependency="printf.d_raw" "../printf.c"
    Finished building: "../printf.c"

    gmake: Target 'all' not remade because of errors.

    **** Build Finished ****

    How to resolve it. Please tell me.

  • What's your question? What modification have you made in the example lab?

    Do you take a look at the lab user's guide and follow the guide to run the lab02c for motor identification first?

    Please take a look at guides in the folders below in motorWare, and follow the guides to set up the kits and run the lab.

    C:\ti\motorware\motorware_1_01_00_18\docs\labs\instaspin_labs.pdf

    C:\ti\motorware\motorware_1_01_00_18\docs\boards\kits\docs\readmefirst_instaspin_launchboost.pdf

  • I am developing own application for bldc motor. Not used any lab examples . The above code are developing it. 

  • Did you refer to any TI example lab code in motorWare?

    What's your question? What modification have you made in the example lab?

    Can you have a detailed description of your questions, not paste all of the code? 

  • **** Build of configuration Debug for project motor_app ****

    "D:\\Texas_instrument\\ccs\\utils\\bin\\gmake" -k -j 12 all -O

    Building file: "../i2ca.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/libraries/math/IQmath/c28/include" --include_path="D:/TI_Progrms/motor_app" --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/device_support/f2802x" --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/device_support/f2802x/common/include" --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/device_support/f2802x/headers/include" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --emit_warnings_as_errors --abi=coffabi --preproc_with_compile --preproc_dependency="i2ca.d_raw" "../i2ca.c"
    Finished building: "../i2ca.c"

    Building file: "../ringBuffer.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/libraries/math/IQmath/c28/include" --include_path="D:/TI_Progrms/motor_app" --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/device_support/f2802x" --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/device_support/f2802x/common/include" --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/device_support/f2802x/headers/include" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --emit_warnings_as_errors --abi=coffabi --preproc_with_compile --preproc_dependency="ringBuffer.d_raw" "../ringBuffer.c"
    Finished building: "../ringBuffer.c"

    Building file: "../uart.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/libraries/math/IQmath/c28/include" --include_path="D:/TI_Progrms/motor_app" --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/device_support/f2802x" --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/device_support/f2802x/common/include" --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/device_support/f2802x/headers/include" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --emit_warnings_as_errors --abi=coffabi --preproc_with_compile --preproc_dependency="uart.d_raw" "../uart.c"
    Finished building: "../uart.c"

    Building file: "../main.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/libraries/math/IQmath/c28/include" --include_path="D:/TI_Progrms/motor_app" --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/device_support/f2802x" --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/device_support/f2802x/common/include" --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/device_support/f2802x/headers/include" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --emit_warnings_as_errors --abi=coffabi --preproc_with_compile --preproc_dependency="main.d_raw" "../main.c"
    Finished building: "../main.c"

    Building file: "../user.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/libraries/math/IQmath/c28/include" --include_path="D:/TI_Progrms/motor_app" --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/device_support/f2802x" --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/device_support/f2802x/common/include" --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/device_support/f2802x/headers/include" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --emit_warnings_as_errors --abi=coffabi --preproc_with_compile --preproc_dependency="user.d_raw" "../user.c"
    Finished building: "../user.c"

    Building file: "../printf.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/libraries/math/IQmath/c28/include" --include_path="D:/TI_Progrms/motor_app" --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/device_support/f2802x" --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/device_support/f2802x/common/include" --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/device_support/f2802x/headers/include" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --emit_warnings_as_errors --abi=coffabi --preproc_with_compile --preproc_dependency="printf.d_raw" "../printf.c"
    Finished building: "../printf.c"

    Building target: "motor_app.out"
    Invoking: C2000 Linker
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --advice:performance=all -g --diag_warning=225 --diag_wrap=off --emit_warnings_as_errors --abi=coffabi -z -m"motor_app.map" --stack_size=0x300 --warn_sections -i"D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/lib" -i"D:/tms320f28027f/motor_A0_Application" -i"D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --reread_libs --diag_wrap=off --display_error_number --xml_link_info="motor_app_linkInfo.xml" --rom_model -o "motor_app.out" "./i2ca.obj" "./main.obj" "./printf.obj" "./ringBuffer.obj" "./uart.obj" "./user.obj" "../F2802x_Headers_nonBIOS.cmd" -l"D:/Texas_instrument/C2000Ware_5_02_00_00/device_support/f2802x/common/ccs/Debug/driverlib.lib" -lrts2800_fpu64_eabi.lib
    <Linking>
    fatal error #16000: object files have incompatible formats ("D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/lib/rts2800_fpu64_eabi.lib<boot28.asm.obj>" = ELF, "./i2ca.obj" = TI-COFF)

    >> Compilation failure
    makefile:141: recipe for target 'motor_app.out' failed
    gmake[1]: *** [motor_app.out] Error 1
    makefile:137: recipe for target 'all' failed
    gmake: *** [all] Error 2

    **** Build Finished ****

    I am using this library  <boot28.asm.obj> facing error issue. Please give suggestion on that.

  • fatal error #16000: object files have incompatible formats ("D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/lib/rts2800_fpu64_eabi.lib<boot28.asm.obj>" = ELF, "./i2ca.obj" = TI-COFF)

    Can you try to design your project based on an example project in C2000Ware or C2000 Motor Control SDK? Seems like your project includes a wrong library for F28027 that doesn't have FPU32 and FPU64.

  • which supported library used ? 

    Give me suggestion and any supported library was download are not.

  • I am using runtime support library using rts2800_ml_eab.lib but occur occur. How to solve it.

    **** Build of configuration Debug for project BLDC_application ****

    "D:\\Texas_instrument\\ccs\\utils\\bin\\gmake" -k -j 12 all -O

    Building target: "BLDC_application.out"
    Invoking: C2000 Linker
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi -z -m"BLDC_application.map" --stack_size=0x300 --warn_sections -i"D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/lib" -i"D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --reread_libs --diag_wrap=off --display_error_number --xml_link_info="BLDC_application_linkInfo.xml" --rom_model -o "BLDC_application.out" "./i2ca.obj" "./main.obj" "./printf.obj" "./ringBuffer.obj" "./uart.obj" "./user.obj" "../28027_RAM_lnk.cmd" -lrts2800_ml_eabi.lib
    <Linking>
    fatal error #16000: object files have incompatible formats ("D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/lib/rts2800_ml_eabi.lib<boot28.asm.obj>" = ELF, "./i2ca.obj" = TI-COFF)

    >> Compilation failure
    makefile:140: recipe for target 'BLDC_application.out' failed
    makefile:136: recipe for target 'all' failed
    gmake[1]: *** [BLDC_application.out] Error 1
    gmake: *** [all] Error 2

    **** Build Finished ****

    How to solve it.

  • lhttps://github.com/acvilla/BLDC-Motor-Control

    I am using TI board LAUNCHXL TMS320F28027F with DRV8301 to run BLDC Motor(A2212/13T) sensor-less.

    The above link possible to run bldc motor or not and any changes in a code. Please check above link to run bldc motor sensor-less or not. Any changes in a code or modifies in a code.Give suggestion on that.

  • As mentioned above, please try to use the example labs in motorWare. You have made a lot of changes in the example lab that is not supported by this device.

    Download and install motorware which has many example projects to support this kit, and follow the lab guide to understand these lab projects.

    MotorWare: http://www.ti.com/tool/motorware

     

    Please take a look at guides in the folders below in motorWare, and follow the guides to set up the kits and run the lab.

    C:\ti\motorware\motorware_1_01_00_18\docs\labs\instaspin_labs.pdf

    C:\ti\motorware\motorware_1_01_00_18\docs\boards\kits\docs\readmefirst_instaspin_launchboost.pdf

  • lhttps://github.com/acvilla/BLDC-Motor-Control

    The above example does not supported to my device. Ok but how to developing own application for to run motor. Developing is possible or not. Please give me suggestion on that. 

  • As mentioned above, take a look at the lab user's guide, and use the example labs in motorWare to run your motor since you are using a supported kit in the motorWare.

    C:\ti\motorware\motorware_1_01_00_18\sw\solutions\instaspin_foc\boards\boostxldrv8301_revB\f28x\f2802xF

    Run the lab02c to identify the motor parameters, and then run the lab05a, lab05b or lab10a per your system's requirements.

  • Using lab2c and lab5b both integrate to run my motor clockwise and anticlockwise. To possible or not. Give me suggestion on that.  And also Set UART commands to run motor. For example I send command R, to run motor and send command S to stop motor. If it is possible or not.

  • Using lab2c and lab5b both integrate to run my motor clockwise and anticlockwise. To possible or not. Give me suggestion on that.  And also Set UART commands to run motor. For example I send command R, to run motor and send command S to stop motor. If it is possible or not.

    Please give me any suggestion on that.

  • I am using lab2c to build the project. Some errors occurs. show below

    **** Build of configuration Debug for project motor_8301 ****

    "D:\\Texas_instrument\\ccs\\utils\\bin\\gmake" -k -j 12 all -O

    Building file: "../CodeStartBranch.asm"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/types/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="CodeStartBranch.d_raw" "../CodeStartBranch.asm"
    Finished building: "../CodeStartBranch.asm"

    Building file: "../clarke.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/types/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="clarke.d_raw" "../clarke.c"
    Finished building: "../clarke.c"

    Building file: "../cpu.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/types/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="cpu.d_raw" "../cpu.c"
    Finished building: "../cpu.c"

    Building file: "../adc.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/types/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="adc.d_raw" "../adc.c"
    Finished building: "../adc.c"

    Building file: "../clk.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/types/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="clk.d_raw" "../clk.c"
    Finished building: "../clk.c"

    Building file: "../filter_fo.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/types/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="filter_fo.d_raw" "../filter_fo.c"
    Finished building: "../filter_fo.c"

    Building file: "../flash.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/types/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="flash.d_raw" "../flash.c"
    Finished building: "../flash.c"

    Building file: "../gpio.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/types/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="gpio.d_raw" "../gpio.c"
    Finished building: "../gpio.c"

    Building file: "../ipark.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/types/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="ipark.d_raw" "../ipark.c"
    Finished building: "../ipark.c"

    Building file: "../memCopy.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/types/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="memCopy.d_raw" "../memCopy.c"
    Finished building: "../memCopy.c"

    Building file: "../offset.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/types/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="offset.d_raw" "../offset.c"
    Finished building: "../offset.c"

    Building file: "../osc.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/types/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="osc.d_raw" "../osc.c"
    Finished building: "../osc.c"

    Building file: "../park.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/types/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="park.d_raw" "../park.c"
    Finished building: "../park.c"

    Building file: "../pll.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/types/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="pll.d_raw" "../pll.c"
    Finished building: "../pll.c"

    Building file: "../pie.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/types/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="pie.d_raw" "../pie.c"
    Finished building: "../pie.c"

    Building file: "../main.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/types/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="main.d_raw" "../main.c"
    Finished building: "../main.c"

    Building file: "../pwr.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/types/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="pwr.d_raw" "../pwr.c"
    Finished building: "../pwr.c"

    Building file: "../hal.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/types/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="hal.d_raw" "../hal.c"
    Finished building: "../hal.c"

    Building file: "../ctrl.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/types/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="ctrl.d_raw" "../ctrl.c"
    Finished building: "../ctrl.c"

    Building file: "../svgen.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/types/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="svgen.d_raw" "../svgen.c"
    Finished building: "../svgen.c"

    Building file: "../spi.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/types/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="spi.d_raw" "../spi.c"
    Finished building: "../spi.c"

    Building file: "../timer.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/types/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="timer.d_raw" "../timer.c"
    Finished building: "../timer.c"

    Building file: "../traj.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/types/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="traj.d_raw" "../traj.c"
    Finished building: "../traj.c"

    Building file: "../pwm.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/types/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="pwm.d_raw" "../pwm.c"
    Finished building: "../pwm.c"

    Building file: "../usDelay.asm"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/types/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="usDelay.d_raw" "../usDelay.asm"
    Finished building: "../usDelay.asm"

    Building file: "../wdog.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/types/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="wdog.d_raw" "../wdog.c"
    Finished building: "../wdog.c"

    Building file: "../user.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/types/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="user.d_raw" "../user.c"
    Finished building: "../user.c"

    Building target: "motor_8301.out"
    Invoking: C2000 Linker
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi -z -m"motor_8301.map" --stack_size=0x300 --warn_sections -i"D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/lib" -i"D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --reread_libs --diag_wrap=off --display_error_number --xml_link_info="motor_8301_linkInfo.xml" --rom_model -o "motor_8301.out" "./CodeStartBranch.obj" "./adc.obj" "./clarke.obj" "./clk.obj" "./cpu.obj" "./ctrl.obj" "./filter_fo.obj" "./flash.obj" "./gpio.obj" "./hal.obj" "./ipark.obj" "./main.obj" "./memCopy.obj" "./offset.obj" "./osc.obj" "./park.obj" "./pie.obj" "./pll.obj" "./pwm.obj" "./pwr.obj" "./spi.obj" "./svgen.obj" "./timer.obj" "./traj.obj" "./usDelay.obj" "./user.obj" "./wdog.obj" "../F28027.cmd" -lrts2800_ml_eabi.lib
    <Linking>
    fatal error #16000: object files have incompatible formats ("D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/lib/rts2800_ml_eabi.lib<boot28.asm.obj>" = ELF, "./CodeStartBranch.obj" = TI-COFF)

    >> Compilation failure
    makefile:161: recipe for target 'motor_8301.out' failed
    gmake[1]: *** [motor_8301.out] Error 1
    makefile:157: recipe for target 'all' failed
    gmake: *** [all] Error 2

    **** Build Finished ****

    how to solve it ? Give me any suggestion on that.

    c2000_22.6.1.LTS/lib/rts2800_ml_eabi.lib<boot28.asm.obj>" = ELF, "./CodeStartBranch.obj" = TI-COFF)

    does not supported run time library and obj file.

  • TI Launch Pad tms320f28027f) with drv8301 to run bldc motor. If it possible in different applications using this TI board possible are not. Give me suggestion on that.

  • Please refer to the example labs as mentioned above. The board and example can run the BLDC motor you used, just need to follow the guide to set the related parameters. It could be easy to use and better than the code you downloaded. Please use the example labs first without ange changes, and just change the motor parameters in the "user.h" file before you are familiar with the labs.

  • ok, but lab2c is taken, create a new project, start copying lab2c in a new project but errors occur. Error is run time library and object file does not supported show below.

    **** Build of configuration Debug for project motor_8301 ****

    "D:\\Texas_instrument\\ccs\\utils\\bin\\gmake" -k -j 12 all -O

    Building target: "motor_8301.out"
    Invoking: C2000 Linker
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi -z -m"motor_8301.map" --stack_size=0x300 --warn_sections -i"D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/lib" -i"D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --reread_libs --diag_wrap=off --display_error_number --xml_link_info="motor_8301_linkInfo.xml" --rom_model -o "motor_8301.out" "./CodeStartBranch.obj" "./adc.obj" "./clarke.obj" "./clk.obj" "./cpu.obj" "./ctrl.obj" "./filter_fo.obj" "./flash.obj" "./gpio.obj" "./hal.obj" "./ipark.obj" "./main.obj" "./memCopy.obj" "./offset.obj" "./osc.obj" "./park.obj" "./pie.obj" "./pll.obj" "./pwm.obj" "./pwr.obj" "./spi.obj" "./svgen.obj" "./timer.obj" "./traj.obj" "./usDelay.obj" "./user.obj" "./wdog.obj" "../F28027.cmd" -lrts2800_ml_eabi.lib
    <Linking>
    fatal error #16000: object files have incompatible formats ("D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/lib/rts2800_ml_eabi.lib<boot28.asm.obj>" = ELF, "./CodeStartBranch.obj" = TI-COFF)

    >> Compilation failure
    makefile:161: recipe for target 'motor_8301.out' failed
    gmake[1]: *** [motor_8301.out] Error 1
    makefile:157: recipe for target 'all' failed
    gmake: *** [all] Error 2

    **** Build Finished ****

    how to resolve it.

    Give me suggestion on that.

  • How do you create the new project? What changes do you make compare to the example lab?

    Is it possible to use the example lab and only add the new codes according to your project?

  • **** Clean-only build of configuration Debug for project motor_8301 ****

    "D:\\Texas_instrument\\ccs\\utils\\bin\\gmake" -k -j 12 clean -O

    DEL /F "motor_8301.out"
    DEL /F "CodeStartBranch.obj" "adc.obj" "clarke.obj" "clk.obj" "cpu.obj" "ctrl.obj" "filter_fo.obj" "flash.obj" "gpio.obj" "hal.obj" "ipark.obj" "main.obj" "memCopy.obj" "offset.obj" "osc.obj" "park.obj" "pie.obj" "pll.obj" "pwm.obj" "pwr.obj" "spi.obj" "svgen.obj" "timer.obj" "traj.obj" "usDelay.obj" "user.obj" "wdog.obj"
    DEL /F "adc.d" "clarke.d" "clk.d" "cpu.d" "ctrl.d" "filter_fo.d" "flash.d" "gpio.d" "hal.d" "ipark.d" "main.d" "memCopy.d" "offset.d" "osc.d" "park.d" "pie.d" "pll.d" "pwm.d" "pwr.d" "spi.d" "svgen.d" "timer.d" "traj.d" "user.d" "wdog.d"
    DEL /F "CodeStartBranch.d" "usDelay.d"
    Could Not Find D:\TI_Progrms\motor_8301\Debug\motor_8301.out
    Could Not Find D:\TI_Progrms\motor_8301\Debug\CodeStartBranch.d
    Finished clean

    **** Build Finished ****

    **** Build of configuration Debug for project motor_8301 ****

    "D:\\Texas_instrument\\ccs\\utils\\bin\\gmake" -k -j 12 all -O

    Building file: "../CodeStartBranch.asm"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="CodeStartBranch.d_raw" "../CodeStartBranch.asm"
    Finished building: "../CodeStartBranch.asm"

    Building file: "../clarke.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="clarke.d_raw" "../clarke.c"
    Finished building: "../clarke.c"

    Building file: "../adc.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="adc.d_raw" "../adc.c"
    Finished building: "../adc.c"

    Building file: "../clk.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="clk.d_raw" "../clk.c"
    Finished building: "../clk.c"

    Building file: "../cpu.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="cpu.d_raw" "../cpu.c"
    Finished building: "../cpu.c"

    Building file: "../ctrl.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="ctrl.d_raw" "../ctrl.c"
    Finished building: "../ctrl.c"

    Building file: "../filter_fo.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="filter_fo.d_raw" "../filter_fo.c"
    Finished building: "../filter_fo.c"

    Building file: "../flash.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="flash.d_raw" "../flash.c"
    Finished building: "../flash.c"

    Building file: "../gpio.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="gpio.d_raw" "../gpio.c"
    Finished building: "../gpio.c"

    Building file: "../hal.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="hal.d_raw" "../hal.c"
    Finished building: "../hal.c"

    Building file: "../ipark.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="ipark.d_raw" "../ipark.c"
    Finished building: "../ipark.c"

    Building file: "../memCopy.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="memCopy.d_raw" "../memCopy.c"
    Finished building: "../memCopy.c"

    Building file: "../offset.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="offset.d_raw" "../offset.c"
    Finished building: "../offset.c"

    Building file: "../osc.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="osc.d_raw" "../osc.c"
    Finished building: "../osc.c"

    Building file: "../main.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="main.d_raw" "../main.c"
    Finished building: "../main.c"

    Building file: "../park.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="park.d_raw" "../park.c"
    Finished building: "../park.c"

    Building file: "../pll.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="pll.d_raw" "../pll.c"
    Finished building: "../pll.c"

    Building file: "../pie.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="pie.d_raw" "../pie.c"
    Finished building: "../pie.c"

    Building file: "../pwm.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="pwm.d_raw" "../pwm.c"
    Finished building: "../pwm.c"

    Building file: "../pwr.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="pwr.d_raw" "../pwr.c"
    Finished building: "../pwr.c"

    Building file: "../spi.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="spi.d_raw" "../spi.c"
    Finished building: "../spi.c"

    Building file: "../svgen.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="svgen.d_raw" "../svgen.c"
    Finished building: "../svgen.c"

    Building file: "../timer.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="timer.d_raw" "../timer.c"
    Finished building: "../timer.c"

    Building file: "../usDelay.asm"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="usDelay.d_raw" "../usDelay.asm"
    Finished building: "../usDelay.asm"

    Building file: "../traj.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="traj.d_raw" "../traj.c"
    Finished building: "../traj.c"

    Building file: "../wdog.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="wdog.d_raw" "../wdog.c"
    Finished building: "../wdog.c"

    Building file: "../user.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="user.d_raw" "../user.c"
    Finished building: "../user.c"

    Building target: "motor_8301.out"
    Invoking: C2000 Linker
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi -z -m"motor_8301.map" --warn_sections -i"D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/lib" -i"D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -o "motor_8301.out" "./CodeStartBranch.obj" "./adc.obj" "./clarke.obj" "./clk.obj" "./cpu.obj" "./ctrl.obj" "./filter_fo.obj" "./flash.obj" "./gpio.obj" "./hal.obj" "./ipark.obj" "./main.obj" "./memCopy.obj" "./offset.obj" "./osc.obj" "./park.obj" "./pie.obj" "./pll.obj" "./pwm.obj" "./pwr.obj" "./spi.obj" "./svgen.obj" "./timer.obj" "./traj.obj" "./usDelay.obj" "./user.obj" "./wdog.obj" "../F28027.cmd"
    <Linking>
    warning #10247-D: creating output section "ramfuncs" without a SECTIONS specification
    warning #10247-D: creating output section "rom_accessed_data" without a SECTIONS specification
    "../F28027.cmd", line 117: error #10099-D: program will not fit into available memory, or the section contains a call site that requires a trampoline that can't be generated for this section. placement with alignment/blocking fails for section ".text" size 0x4195 page 0. Available memory ranges:
    FLASHA size: 0x1f80 unused: 0x1ea6 max hole: 0x1ea6

    undefined first referenced
    symbol in file
    --------- ----------------
    FD$$MPY ./ctrl.obj
    FD$$TOL ./ctrl.obj
    FS$$DIV ./ctrl.obj
    FS$$MPY ./ctrl.obj
    FS$$NEG ./user.obj
    FS$$TOFD ./ctrl.obj
    FS$$TOI ./main.obj
    FS$$TOU ./hal.obj
    FS$$TOUL ./hal.obj
    I$$TOFS ./user.obj
    U$$TOFS ./hal.obj
    UL$$TOFS ./ctrl.obj
    _CTRL_getVersion ./main.obj
    _CTRL_initCtrl ./main.obj
    _CTRL_runTraj ./ctrl.obj
    _CTRL_setEstParams ./ctrl.obj
    _CTRL_setUserMotorParams ./ctrl.obj
    _CTRL_setupCtrl ./ctrl.obj
    _CTRL_setupEstIdleState ./ctrl.obj
    _CTRL_setupEstOnLineState ./ctrl.obj
    _CTRL_setupTraj ./ctrl.obj
    _DRV8301_enable ./hal.obj
    _DRV8301_init ./hal.obj
    _DRV8301_readData ./hal.obj
    _DRV8301_setGpioHandle ./hal.obj
    _DRV8301_setGpioNumber ./hal.obj
    _DRV8301_setSpiHandle ./hal.obj
    _DRV8301_setupSpi ./hal.obj
    _DRV8301_writeData ./hal.obj
    _EST_computeDirection_qFmt ./main.obj
    _EST_doCurrentCtrl ./ctrl.obj
    _EST_doSpeedCtrl ./ctrl.obj
    _EST_getAngle_pu ./ctrl.obj
    _EST_getFlux_VpHz ./main.obj
    _EST_getFlux_pu ./user.obj
    _EST_getFm_pu ./ctrl.obj
    _EST_getIdRated ./main.obj
    _EST_getLs_coarse_max_pu ./main.obj
    _EST_getLs_d_H ./main.obj
    _EST_getLs_d_pu ./main.obj
    _EST_getLs_qFmt ./main.obj
    _EST_getLs_q_H ./main.obj
    _EST_getLs_q_pu ./user.obj
    _EST_getMaxCurrentSlope_pu ./main.obj
    _EST_getOneOverDcBus_pu ./ctrl.obj
    _EST_getRr_Ohm ./main.obj
    _EST_getRs_Ohm ./main.obj
    _EST_getSpeed_krpm ./main.obj
    _EST_getState ./ctrl.obj
    _EST_get_krpm_to_pu_sf ./ctrl.obj
    _EST_get_pu_to_krpm_sf ./main.obj
    _EST_isError ./ctrl.obj
    _EST_isIdle ./ctrl.obj
    _EST_isLockRotor ./ctrl.obj
    _EST_isMotorIdentified ./ctrl.obj
    _EST_isOnLine ./ctrl.obj
    _EST_run ./ctrl.obj
    _EST_setDir_qFmt ./main.obj
    _EST_setFe_neg_max_pu ./main.obj
    _EST_setFe_pos_min_pu ./main.obj
    _EST_setFlag_enableForceAngle ./main.obj
    _EST_setId_ref_pu ./ctrl.obj
    _EST_setIdle ./ctrl.obj
    _EST_setIdle_all ./ctrl.obj
    _EST_setIq_ref_pu ./ctrl.obj
    _EST_setLs_d_pu ./user.obj
    _EST_setLs_qFmt ./main.obj
    _EST_setLs_q_pu ./user.obj
    _EST_setMaxCurrentSlope_pu ./main.obj
    _EST_setRs_pu ./ctrl.obj
    _EST_updateId_ref_pu ./ctrl.obj
    _EST_updateState ./ctrl.obj
    _EST_useZeroIq_ref ./ctrl.obj
    __IQ24cosPU ./ctrl.obj
    __IQ24sinPU ./ctrl.obj
    __IQ24sqrt ./ctrl.obj
    __IQ30toF ./main.obj
    _c_int00 ./CodeStartBranch.obj
    _ceil ./main.obj
    _log ./main.obj
    _pow ./user.obj

    error #10234-D: unresolved symbols remain
    error #10010: errors encountered during linking; "motor_8301.out" not built

    >> Compilation failure
    makefile:160: recipe for target 'motor_8301.out' failed
    makefile:156: recipe for target 'all' failed
    gmake[1]: *** [motor_8301.out] Error 1
    gmake: *** [all] Error 2

    **** Build Finished ****

    The above error displayed. How to solve it.

  • I am using the TI LaunchPad with a TMS320F28027F microcontroller and a DRV8301 gate driver to control a BLDC motor (A2212/13T). I've installed the MotorWare software version 1.01.00.18 and successfully tested the motor using the project labs examples provided, such as Lab2c and Lab5c.

    My question is whether this setup (TMS320F28027F and DRV8301) supports the development of custom applications for controlling a BLDC motor, or if it's limited to the provided example projects. Specifically, I'm interested in creating my own application to run the BLDC motor and would like to know if it's feasible and what steps or considerations are involved.

    Could you provide guidance or suggestions on how to proceed with developing a custom application for this setup?

  • Could you provide guidance or suggestions on how to proceed with developing a custom application for this setup?

    Yes. It can be migrated to your own board and support your motor for a customer application. You may take a look at the below training and guides.

    Please follow the steps to change the example labs and verify the current and voltage signals of the hardware board before run the lab02a/b/c since you are using your own board. Make sure that the current and voltage sampling works well.

     

    1. Please refer to the guide, motorware_hal_tutorial.pdf below, to change the peripherals configuration like PWM and ADC in hal.c and hal.h according to your hardware board.

    C:\ti\motorware\motorware_1_01_00_18\docs\tutorials

     

    2. Set correct parameters based on the hardware board in user.h. You can refer to the Chapter 5 Managing Motor Signals of  InstaSPIN-FOC and InstaSPIN-MOTION User's Guide to calculate and define the value of these variables.

    #define USER_IQ_FULL_SCALE_VOLTAGE_V           (xx)

    #define USER_VOLTAGE_FILTER_POLE_Hz               (xx)

    #define USER_ADC_FULL_SCALE_VOLTAGE_V       (xx)

    #define USER_IQ_FULL_SCALE_CURRENT_A           (xx)

    #define USER_ADC_FULL_SCALE_CURRENT_A       (xx)

     

    3. Make sure that the sign of the current coefficient in HAL_readAdcData() in hal.h matches the current sensing circuit. Refer to chapter 5.2.2 Current Feedback Polarity in InstaSPIN user's guide (SPRUHJ1, https://www.ti.com/lit/spruhj1) to set the sign of the current scale factor.

     

    static inline void HAL_readAdcData(HAL_Handle handle,HAL_AdcData_t *pAdcData)

    {

       _iq current_sf = (+/-)HAL_getCurrentScaleFactor(handle);

    }

     

    4. Follow the instaSPIN lab guide to use lab01b and lab01c to verify your own hardware since you are not using the TI EVM kits and then run the subsequent labs.

     

     

    5. Using the lab02b or lab02c and tuning the identification variables parameter below to identify the motor parameters, and use the identified parameters to run the motor if the current and voltage sensing signals are verified and good.

    #define USER_MOTOR_RES_EST_CURRENT      (1.0)                               // A -  10-30% of rated current of the motor

    #define USER_MOTOR_IND_EST_CURRENT      (-1.0)                             // A -  10-30% of rated current of the motor,  just enough to enable rotation

    #define USER_MOTOR_MAX_CURRENT            (5.0)                               // A -  30~150%  of rated current of the motor

    #define USER_MOTOR_FLUX_EST_FREQ_Hz     (40.0)                            // Hz - 10~30% rated frequency of the motor

  • It seems you're having trouble with runtime library and linker issues after migrating  Project lab3c to a new environment (new project taken). Here's a revised and streamlined approach to troubleshooting and resolving these issues:


    **** Clean-only build of configuration Debug for project motor_8301 ****

    "D:\\Texas_instrument\\ccs\\utils\\bin\\gmake" -k -j 12 clean -O

    DEL /F "motor_8301.out"
    DEL /F "CodeStartBranch.lst" "adc.lst" "clarke.lst" "clk.lst" "cpu.lst" "ctrl.lst" "filter_fo.lst" "flash.lst" "gpio.lst" "hal.lst" "ipark.lst" "main.lst" "memCopy.lst" "offset.lst" "osc.lst" "park.lst" "pie.lst" "pll.lst" "pwm.lst" "pwr.lst" "spi.lst" "svgen.lst" "timer.lst" "traj.lst" "usDelay.lst" "user.lst" "wdog.lst"
    DEL /F "CodeStartBranch.obj" "adc.obj" "clarke.obj" "clk.obj" "cpu.obj" "ctrl.obj" "filter_fo.obj" "flash.obj" "gpio.obj" "hal.obj" "ipark.obj" "main.obj" "memCopy.obj" "offset.obj" "osc.obj" "park.obj" "pie.obj" "pll.obj" "pwm.obj" "pwr.obj" "spi.obj" "svgen.obj" "timer.obj" "traj.obj" "usDelay.obj" "user.obj" "wdog.obj"
    DEL /F "adc.d" "clarke.d" "clk.d" "cpu.d" "ctrl.d" "filter_fo.d" "flash.d" "gpio.d" "hal.d" "ipark.d" "main.d" "memCopy.d" "offset.d" "osc.d" "park.d" "pie.d" "pll.d" "pwm.d" "pwr.d" "spi.d" "svgen.d" "timer.d" "traj.d" "user.d" "wdog.d"
    DEL /F "CodeStartBranch.d" "usDelay.d"
    Could Not Find D:\TI_Progrms\motor_8301\Debug\motor_8301.out
    Could Not Find D:\TI_Progrms\motor_8301\Debug\CodeStartBranch.d
    Finished clean

    **** Build Finished ****

    **** Build of configuration Debug for project motor_8301 ****

    "D:\\Texas_instrument\\ccs\\utils\\bin\\gmake" -k -j 12 all -O

    Building file: "../CodeStartBranch.asm"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --asm_listing --preproc_with_compile --preproc_dependency="CodeStartBranch.d_raw" "../CodeStartBranch.asm"
    Finished building: "../CodeStartBranch.asm"

    Building file: "../clarke.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --asm_listing --preproc_with_compile --preproc_dependency="clarke.d_raw" "../clarke.c"
    Finished building: "../clarke.c"

    Building file: "../adc.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --asm_listing --preproc_with_compile --preproc_dependency="adc.d_raw" "../adc.c"
    Finished building: "../adc.c"

    Building file: "../cpu.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --asm_listing --preproc_with_compile --preproc_dependency="cpu.d_raw" "../cpu.c"
    Finished building: "../cpu.c"

    Building file: "../clk.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --asm_listing --preproc_with_compile --preproc_dependency="clk.d_raw" "../clk.c"
    Finished building: "../clk.c"

    Building file: "../filter_fo.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --asm_listing --preproc_with_compile --preproc_dependency="filter_fo.d_raw" "../filter_fo.c"
    Finished building: "../filter_fo.c"

    Building file: "../flash.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --asm_listing --preproc_with_compile --preproc_dependency="flash.d_raw" "../flash.c"
    Finished building: "../flash.c"

    Building file: "../gpio.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --asm_listing --preproc_with_compile --preproc_dependency="gpio.d_raw" "../gpio.c"
    Finished building: "../gpio.c"

    Building file: "../ipark.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --asm_listing --preproc_with_compile --preproc_dependency="ipark.d_raw" "../ipark.c"
    Finished building: "../ipark.c"

    Building file: "../memCopy.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --asm_listing --preproc_with_compile --preproc_dependency="memCopy.d_raw" "../memCopy.c"
    Finished building: "../memCopy.c"

    Building file: "../offset.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --asm_listing --preproc_with_compile --preproc_dependency="offset.d_raw" "../offset.c"
    Finished building: "../offset.c"

    Building file: "../osc.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --asm_listing --preproc_with_compile --preproc_dependency="osc.d_raw" "../osc.c"
    Finished building: "../osc.c"

    Building file: "../park.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --asm_listing --preproc_with_compile --preproc_dependency="park.d_raw" "../park.c"
    Finished building: "../park.c"

    Building file: "../pie.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --asm_listing --preproc_with_compile --preproc_dependency="pie.d_raw" "../pie.c"
    Finished building: "../pie.c"

    Building file: "../pll.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --asm_listing --preproc_with_compile --preproc_dependency="pll.d_raw" "../pll.c"
    Finished building: "../pll.c"

    Building file: "../pwr.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --asm_listing --preproc_with_compile --preproc_dependency="pwr.d_raw" "../pwr.c"
    Finished building: "../pwr.c"

    Building file: "../main.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --asm_listing --preproc_with_compile --preproc_dependency="main.d_raw" "../main.c"
    Finished building: "../main.c"

    Building file: "../spi.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --asm_listing --preproc_with_compile --preproc_dependency="spi.d_raw" "../spi.c"
    Finished building: "../spi.c"

    Building file: "../svgen.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --asm_listing --preproc_with_compile --preproc_dependency="svgen.d_raw" "../svgen.c"
    Finished building: "../svgen.c"

    Building file: "../hal.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --asm_listing --preproc_with_compile --preproc_dependency="hal.d_raw" "../hal.c"
    Finished building: "../hal.c"

    Building file: "../timer.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --asm_listing --preproc_with_compile --preproc_dependency="timer.d_raw" "../timer.c"
    Finished building: "../timer.c"

    Building file: "../ctrl.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --asm_listing --preproc_with_compile --preproc_dependency="ctrl.d_raw" "../ctrl.c"
    Finished building: "../ctrl.c"

    Building file: "../traj.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --asm_listing --preproc_with_compile --preproc_dependency="traj.d_raw" "../traj.c"
    Finished building: "../traj.c"

    Building file: "../pwm.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --asm_listing --preproc_with_compile --preproc_dependency="pwm.d_raw" "../pwm.c"
    Finished building: "../pwm.c"

    Building file: "../usDelay.asm"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --asm_listing --preproc_with_compile --preproc_dependency="usDelay.d_raw" "../usDelay.asm"
    Finished building: "../usDelay.asm"

    Building file: "../wdog.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --asm_listing --preproc_with_compile --preproc_dependency="wdog.d_raw" "../wdog.c"
    Finished building: "../wdog.c"

    Building file: "../user.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/TI_Progrms/motor_8301" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --asm_listing --preproc_with_compile --preproc_dependency="user.d_raw" "../user.c"
    Finished building: "../user.c"

    Building target: "motor_8301.out"
    Invoking: C2000 Linker
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --advice:performance=all --define=DRBUG --define=FAST_ROM_V1P7 --define=F2802xF -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --asm_listing -z -m"motor_8301.map" --warn_sections -i"D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/lib" -i"D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --priority --reread_libs --disable_auto_rts -o "motor_8301.out" "./CodeStartBranch.obj" "./adc.obj" "./clarke.obj" "./clk.obj" "./cpu.obj" "./ctrl.obj" "./filter_fo.obj" "./flash.obj" "./gpio.obj" "./hal.obj" "./ipark.obj" "./main.obj" "./memCopy.obj" "./offset.obj" "./osc.obj" "./park.obj" "./pie.obj" "./pll.obj" "./pwm.obj" "./pwr.obj" "./spi.obj" "./svgen.obj" "./timer.obj" "./traj.obj" "./usDelay.obj" "./user.obj" "./wdog.obj" "../F28027.cmd" -lrts2800_ml.lib
    <Linking>
    warning #10247-D: creating output section "ramfuncs" without a SECTIONS specification
    warning #10247-D: creating output section "rom_accessed_data" without a SECTIONS specification
    warning #10210-D: creating ".stack" section with default size of 0x400; use the -stack option to change the default size
    "../F28027.cmd", line 117: error #10099-D: program will not fit into available memory, or the section contains a call site that requires a trampoline that can't be generated for this section. placement with alignment/blocking fails for section ".text" size 0x4c41 page 0. Available memory ranges:
    FLASHA size: 0x1f80 unused: 0x1e30 max hole: 0x1e30
    "../F28027.cmd", line 142: error #10099-D: program will not fit into available memory, or the section contains a call site that requires a trampoline that can't be generated for this section. run placement with alignment/blocking fails for section ".stack" size 0x400 page 1. Available memory ranges:
    RAMM0 size: 0x3b0 unused: 0x3b0 max hole: 0x3b0

    undefined first referenced
    symbol in file
    --------- ----------------
    _CTRL_getVersion ./main.obj
    _CTRL_initCtrl ./main.obj
    _CTRL_runTraj ./ctrl.obj
    _CTRL_setEstParams ./ctrl.obj
    _CTRL_setUserMotorParams ./ctrl.obj
    _CTRL_setupCtrl ./ctrl.obj
    _CTRL_setupEstIdleState ./ctrl.obj
    _CTRL_setupEstOnLineState ./ctrl.obj
    _CTRL_setupTraj ./ctrl.obj
    _DRV8301_enable ./hal.obj
    _DRV8301_init ./hal.obj
    _DRV8301_readData ./hal.obj
    _DRV8301_setGpioHandle ./hal.obj
    _DRV8301_setGpioNumber ./hal.obj
    _DRV8301_setSpiHandle ./hal.obj
    _DRV8301_setupSpi ./hal.obj
    _DRV8301_writeData ./hal.obj
    _EST_computeDirection_qFmt ./main.obj
    _EST_doCurrentCtrl ./ctrl.obj
    _EST_doSpeedCtrl ./ctrl.obj
    _EST_getAngle_pu ./ctrl.obj
    _EST_getFlux_VpHz ./main.obj
    _EST_getFlux_pu ./user.obj
    _EST_getFm_pu ./ctrl.obj
    _EST_getIdRated ./main.obj
    _EST_getLs_coarse_max_pu ./main.obj
    _EST_getLs_d_H ./main.obj
    _EST_getLs_d_pu ./main.obj
    _EST_getLs_qFmt ./main.obj
    _EST_getLs_q_H ./main.obj
    _EST_getLs_q_pu ./user.obj
    _EST_getMaxCurrentSlope_pu ./main.obj
    _EST_getOneOverDcBus_pu ./ctrl.obj
    _EST_getRr_Ohm ./main.obj
    _EST_getRs_Ohm ./main.obj
    _EST_getSpeed_krpm ./main.obj
    _EST_getState ./ctrl.obj
    _EST_get_krpm_to_pu_sf ./ctrl.obj
    _EST_get_pu_to_krpm_sf ./main.obj
    _EST_isError ./ctrl.obj
    _EST_isIdle ./ctrl.obj
    _EST_isLockRotor ./ctrl.obj
    _EST_isMotorIdentified ./ctrl.obj
    _EST_isOnLine ./ctrl.obj
    _EST_run ./ctrl.obj
    _EST_setDir_qFmt ./main.obj
    _EST_setFe_neg_max_pu ./main.obj
    _EST_setFe_pos_min_pu ./main.obj
    _EST_setFlag_enableForceAngle ./main.obj
    _EST_setId_ref_pu ./ctrl.obj
    _EST_setIdle ./ctrl.obj
    _EST_setIdle_all ./ctrl.obj
    _EST_setIq_ref_pu ./ctrl.obj
    _EST_setLs_d_pu ./user.obj
    _EST_setLs_qFmt ./main.obj
    _EST_setLs_q_pu ./user.obj
    _EST_setMaxCurrentSlope_pu ./main.obj
    _EST_setRs_pu ./ctrl.obj
    _EST_updateId_ref_pu ./ctrl.obj
    _EST_updateState ./ctrl.obj
    _EST_useZeroIq_ref ./ctrl.obj
    __IQ24cosPU ./ctrl.obj
    __IQ24sinPU ./ctrl.obj
    __IQ24sqrt ./ctrl.obj
    __IQ30toF ./main.obj

    error #10234-D: unresolved symbols remain
    error #10010: errors encountered during linking; "motor_8301.out" not built

    >> Compilation failure
    makefile:161: recipe for target 'motor_8301.out' failed
    gmake[1]: *** [motor_8301.out] Error 1
    makefile:157: recipe for target 'all' failed
    gmake: *** [all] Error 2

    **** Build Finished ****

    Give me suggestion on that.

  • I having trouble with runtime library and linker issues after migrating  Project lab3c to a new environment (new project taken). Here's a revised and streamlined approach to troubleshooting and how to resolving these issues:

    **** Build of configuration Debug for project lab2c_motor ****

    "D:\\Texas_instrument\\ccs\\utils\\bin\\gmake" -k -j 12 all -O

    Building file: "../CodeStartBranch.asm"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c_motor" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="CodeStartBranch.d_raw" "../CodeStartBranch.asm"
    Finished building: "../CodeStartBranch.asm"

    Building file: "../clarke.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c_motor" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="clarke.d_raw" "../clarke.c"
    Finished building: "../clarke.c"

    Building file: "../cpu.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c_motor" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="cpu.d_raw" "../cpu.c"
    Finished building: "../cpu.c"

    Building file: "../adc.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c_motor" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="adc.d_raw" "../adc.c"
    Finished building: "../adc.c"

    Building file: "../clk.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c_motor" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="clk.d_raw" "../clk.c"
    Finished building: "../clk.c"

    Building file: "../filter_fo.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c_motor" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="filter_fo.d_raw" "../filter_fo.c"
    Finished building: "../filter_fo.c"

    Building file: "../flash.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c_motor" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="flash.d_raw" "../flash.c"
    Finished building: "../flash.c"

    Building file: "../drv8301.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c_motor" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="drv8301.d_raw" "../drv8301.c"
    Finished building: "../drv8301.c"

    Building file: "../gpio.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c_motor" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="gpio.d_raw" "../gpio.c"
    Finished building: "../gpio.c"

    Building file: "../ipark.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c_motor" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="ipark.d_raw" "../ipark.c"
    Finished building: "../ipark.c"

    Building file: "../memCopy.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c_motor" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="memCopy.d_raw" "../memCopy.c"
    Finished building: "../memCopy.c"

    Building file: "../offset.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c_motor" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="offset.d_raw" "../offset.c"
    Finished building: "../offset.c"

    Building file: "../osc.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c_motor" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="osc.d_raw" "../osc.c"
    Finished building: "../osc.c"

    Building file: "../park.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c_motor" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="park.d_raw" "../park.c"
    Finished building: "../park.c"

    Building file: "../pid.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c_motor" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="pid.d_raw" "../pid.c"
    Finished building: "../pid.c"

    Building file: "../pll.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c_motor" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="pll.d_raw" "../pll.c"
    Finished building: "../pll.c"

    Building file: "../pie.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c_motor" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="pie.d_raw" "../pie.c"
    Finished building: "../pie.c"

    Building file: "../pwr.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c_motor" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="pwr.d_raw" "../pwr.c"
    Finished building: "../pwr.c"

    Building file: "../main.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c_motor" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="main.d_raw" "../main.c"
    Finished building: "../main.c"

    Building file: "../svgen.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c_motor" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="svgen.d_raw" "../svgen.c"
    Finished building: "../svgen.c"

    Building file: "../usDelay.asm"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c_motor" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="usDelay.d_raw" "../usDelay.asm"
    Finished building: "../usDelay.asm"

    Building file: "../spi.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c_motor" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="spi.d_raw" "../spi.c"
    Finished building: "../spi.c"

    Building file: "../traj.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c_motor" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="traj.d_raw" "../traj.c"
    Finished building: "../traj.c"

    Building file: "../hal.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c_motor" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="hal.d_raw" "../hal.c"
    Finished building: "../hal.c"

    Building file: "../ctrl.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c_motor" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="ctrl.d_raw" "../ctrl.c"
    Finished building: "../ctrl.c"

    Building file: "../pwm.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c_motor" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="pwm.d_raw" "../pwm.c"
    Finished building: "../pwm.c"

    Building file: "../user.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c_motor" --include_path="D:/Texas_instrument/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="user.d_raw" "../user.c"
    Finished building: "../user.c"

    Building target: "lab2c_motor.out"
    Invoking: C2000 Linker
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi -z -m"lab2c_motor.map" --warn_sections -i"D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/lib" -i"D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --reread_libs --diag_wrap=off --display_error_number --xml_link_info="lab2c_motor_linkInfo.xml" --rom_model -o "lab2c_motor.out" "./CodeStartBranch.obj" "./adc.obj" "./clarke.obj" "./clk.obj" "./cpu.obj" "./ctrl.obj" "./drv8301.obj" "./filter_fo.obj" "./flash.obj" "./gpio.obj" "./hal.obj" "./ipark.obj" "./main.obj" "./memCopy.obj" "./offset.obj" "./osc.obj" "./park.obj" "./pid.obj" "./pie.obj" "./pll.obj" "./pwm.obj" "./pwr.obj" "./spi.obj" "./svgen.obj" "./traj.obj" "./usDelay.obj" "./user.obj" "../28027_RAM_lnk.cmd" -lrts2800_ml.lib
    <Linking>
    warning #10247-D: creating output section "ramfuncs" without a SECTIONS specification
    warning #10210-D: creating ".stack" section with default size of 0x400; use the -stack option to change the default size
    "../28027_RAM_lnk.cmd", line 122: error #10099-D: program will not fit into available memory, or the section contains a call site that requires a trampoline that can't be generated for this section. placement with alignment/blocking fails for section ".text" size 0x4f77 page 0. Available memory ranges:
    PRAML0 size: 0x900 unused: 0x900 max hole: 0x900

    undefined first referenced
    symbol in file
    --------- ----------------
    _CTRL_getVersion ./main.obj
    _CTRL_initCtrl ./main.obj
    _CTRL_runTraj ./ctrl.obj
    _CTRL_setEstParams ./ctrl.obj
    _CTRL_setUserMotorParams ./ctrl.obj
    _CTRL_setupCtrl ./ctrl.obj
    _CTRL_setupEstIdleState ./ctrl.obj
    _CTRL_setupEstOnLineState ./ctrl.obj
    _CTRL_setupTraj ./ctrl.obj
    _EST_computeDirection_qFmt ./main.obj
    _EST_doCurrentCtrl ./ctrl.obj
    _EST_doSpeedCtrl ./ctrl.obj
    _EST_getAngle_pu ./ctrl.obj
    _EST_getFlux_VpHz ./main.obj
    _EST_getFlux_pu ./user.obj
    _EST_getFm_pu ./ctrl.obj
    _EST_getIdRated ./main.obj
    _EST_getLs_coarse_max_pu ./main.obj
    _EST_getLs_d_H ./main.obj
    _EST_getLs_d_pu ./main.obj
    _EST_getLs_qFmt ./main.obj
    _EST_getLs_q_H ./main.obj
    _EST_getLs_q_pu ./user.obj
    _EST_getMaxCurrentSlope_pu ./main.obj
    _EST_getOneOverDcBus_pu ./ctrl.obj
    _EST_getRr_Ohm ./main.obj
    _EST_getRs_Ohm ./main.obj
    _EST_getSpeed_krpm ./main.obj
    _EST_getState ./ctrl.obj
    _EST_get_krpm_to_pu_sf ./ctrl.obj
    _EST_get_pu_to_krpm_sf ./main.obj
    _EST_isError ./ctrl.obj
    _EST_isIdle ./ctrl.obj
    _EST_isLockRotor ./ctrl.obj
    _EST_isMotorIdentified ./ctrl.obj
    _EST_isOnLine ./ctrl.obj
    _EST_run ./ctrl.obj
    _EST_setDir_qFmt ./main.obj
    _EST_setFe_neg_max_pu ./main.obj
    _EST_setFe_pos_min_pu ./main.obj
    _EST_setFlag_enableForceAngle ./main.obj
    _EST_setId_ref_pu ./ctrl.obj
    _EST_setIdle ./ctrl.obj
    _EST_setIdle_all ./ctrl.obj
    _EST_setIq_ref_pu ./ctrl.obj
    _EST_setLs_d_pu ./user.obj
    _EST_setLs_qFmt ./main.obj
    _EST_setLs_q_pu ./user.obj
    _EST_setMaxCurrentSlope_pu ./main.obj
    _EST_setRs_pu ./ctrl.obj
    _EST_updateId_ref_pu ./ctrl.obj
    _EST_updateState ./ctrl.obj
    _EST_useZeroIq_ref ./ctrl.obj
    _TIMER_init ./hal.obj
    _TIMER_setDecimationFactor ./hal.obj
    _TIMER_setEmulationMode ./hal.obj
    _TIMER_setPreScaler ./hal.obj
    _WDOG_disable ./hal.obj
    _WDOG_init ./hal.obj
    __IQ24cosPU ./ctrl.obj
    __IQ24sinPU ./ctrl.obj
    __IQ24sqrt ./ctrl.obj
    __IQ30toF ./main.obj

    error #10234-D: unresolved symbols remain
    error #10010: errors encountered during linking; "lab2c_motor.out" not built

    >> Compilation failure
    makefile:161: recipe for target 'lab2c_motor.out' failed
    gmake[1]: *** [lab2c_motor.out] Error 1
    makefile:157: recipe for target 'all' failed
    gmake: *** [all] Error 2

    **** Build Finished ****

  • You didn't add the related libraries like IQmath, FAST libraries, and set the right directory to search the related header files. Looks it's difficult to tell you all of instructions and steps about how to create a new project and migrate the algorithm in several sentence.  You may have to take a look at the guide and attend the training as mentioned above. 

    Or you may use the example labs and just add/change the codes per your application if you don't want to spend a lot of time to learn the contents as above.

  • Hi Yanming Luo

    Lab2c and 5b were tested, and the motor was running in a clockwise direction. I am now working on modifying the motor to also run in an anticlockwise direction. Is this possible?

  • Yes. Just need to set the target speed to a negative value for another rotation direction.

  • Yes. Just need to set the target speed to a negative value for another rotation direction.

    I am changes in pid.h (header file) for anti-clockwise direction

    " Error =  - refValue - fbackValue; "

    Any changes also ctrl.c, pwm.c, drv8301.c etc

    /* --COPYRIGHT--,BSD
    * Copyright (c) 2012, Texas Instruments Incorporated
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * * Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    *
    * * Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the distribution.
    *
    * * Neither the name of Texas Instruments Incorporated nor the names of
    * its contributors may be used to endorse or promote products derived
    * from this software without specific prior written permission.
    *
    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
    * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
    * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    * --/COPYRIGHT--*/
    #ifndef _PID_H_
    #define _PID_H_

    //! \file modules/pid/src/32b/pid.h
    //! \brief Contains the public interface to the
    //! Proportional-Integral-Derivative (PID) controller module routines
    //!
    //! (C) Copyright 2011, Texas Instruments, Inc.


    // **************************************************************************
    // the includes

    //modules
    #include "sw/modules/iqmath/src/32b/IQmathLib.h"
    #include "sw/modules/types/src/types.h"


    //!
    //!
    //! \defgroup PID PID
    //!
    //@{

    // Include the algorithm overview defined in modules/<module>/docs/doxygen/doxygen.h
    //! \defgroup PID_OVERVIEW

    #ifdef __cplusplus
    extern "C" {
    #endif


    // **************************************************************************
    // the defines



    // **************************************************************************
    // the typedefs

    //! \brief Defines the PID controller object
    //!
    typedef struct _PID_Obj_
    {
    _iq Kp; //!< the proportional gain for the PID controller
    _iq Ki; //!< the integral gain for the PID controller
    _iq Kd; //!< the derivative gain for the PID controller

    _iq Ui; //!< the integrator start value for the PID controller

    _iq refValue; //!< the reference input value
    _iq fbackValue; //!< the feedback input value

    _iq outMin; //!< the minimum output value allowed for the PID controller
    _iq outMax; //!< the maximum output value allowed for the PID controller

    } PID_Obj;


    //! \brief Defines the PID handle
    //!
    typedef struct _PID_Obj_ *PID_Handle;


    // **************************************************************************
    // the function prototypes

    //! \brief Gets the feedback value in the PID controller
    //! \param[in] handle The PID controller handle
    //! \return The feedback value in the PID controller
    static inline _iq PID_getFbackValue(PID_Handle handle)
    {
    PID_Obj *obj = (PID_Obj *)handle;

    return(obj->fbackValue);
    } // end of PID_getFbackValue() function


    //! \brief Gets the gains in the PID controller
    //! \param[in] handle The PID controller handle
    //! \param[out] pKp The pointer to the proportional gain value
    //! \param[out] pKi The pointer to the integrator gain value
    //! \param[out] pKd The pointer to the derivative gain value
    static inline void PID_getGains(PID_Handle handle,_iq *pKp,_iq *pKi,_iq *pKd)
    {
    PID_Obj *obj = (PID_Obj *)handle;

    *pKp = obj->Kp;
    *pKi = obj->Ki;
    *pKd = obj->Kd;

    return;
    } // end of PID_getGains() function


    //! \brief Gets the derivative gain in the PID controller
    //! \param[in] handle The PID controller handle
    //! \return The derivative gain in the PID controller
    static inline _iq PID_getKd(PID_Handle handle)
    {
    PID_Obj *obj = (PID_Obj *)handle;

    return(obj->Kd);
    } // end of PID_getKd() function


    //! \brief Gets the integral gain in the PID controller
    //! \param[in] handle The PID controller handle
    //! \return The integral gain in the PID controller
    static inline _iq PID_getKi(PID_Handle handle)
    {
    PID_Obj *obj = (PID_Obj *)handle;

    return(obj->Ki);
    } // end of PID_getKi() function


    //! \brief Gets the proportional gain in the PID controller
    //! \param[in] handle The PID controller handle
    //! \return The proportional gain in the PID controller
    static inline _iq PID_getKp(PID_Handle handle)
    {
    PID_Obj *obj = (PID_Obj *)handle;

    return(obj->Kp);
    } // end of PID_getKp() function


    //! \brief Gets the minimum and maximum output value allowed in the PID controller
    //! \param[in] handle The PID controller handle
    //! \param[out] pOutMin The pointer to the minimum output value allowed
    //! \param[out] pOutMax The pointer to the maximum output value allowed
    static inline void PID_getMinMax(PID_Handle handle,_iq *pOutMin,_iq *pOutMax)
    {
    PID_Obj *obj = (PID_Obj *)handle;

    *pOutMin = obj->outMin;
    *pOutMax = obj->outMax;

    return;
    } // end of PID_getMinMax() function


    //! \brief Gets the maximum output value allowed in the PID controller
    //! \param[in] handle The PID controller handle
    //! \return The maximum output value allowed
    static inline _iq PID_getOutMax(PID_Handle handle)
    {
    PID_Obj *obj = (PID_Obj *)handle;

    return(obj->outMax);
    } // end of PID_getOutMax() function


    //! \brief Gets the minimum output value allowed in the PID controller
    //! \param[in] handle The PID controller handle
    //! \return The minimum output value allowed
    static inline _iq PID_getOutMin(PID_Handle handle)
    {
    PID_Obj *obj = (PID_Obj *)handle;

    return(obj->outMin);
    } // end of PID_getOutMin() function


    //! \brief Gets the reference value in the PID controller
    //! \param[in] handle The PID controller handle
    //! \return The reference value in the PID controller
    static inline _iq PID_getRefValue(PID_Handle handle)
    {
    PID_Obj *obj = (PID_Obj *)handle;

    return(obj->refValue);
    } // end of PID_getRefValue() function


    //! \brief Gets the integrator start value in the PID controller
    //! \param[in] handle The PID controller handle
    //! \return The integrator start value for the PID controller
    static inline _iq PID_getUi(PID_Handle handle)
    {
    PID_Obj *obj = (PID_Obj *)handle;

    return(obj->Ui);
    } // end of PID_getUi() function


    //! \brief Initializes the PID controller
    //! \param[in] pMemory A pointer to the memory for the PID controller object
    //! \param[in] numBytes The number of bytes allocated for the PID controller object, bytes
    //! \return The PID controller (PID) object handle
    extern PID_Handle PID_init(void *pMemory,const size_t numBytes);


    //! \brief Runs the PID controller
    //! \param[in] handle The PID controller handle
    //! \param[in] refValue The reference value to the controller
    //! \param[in] fbackValue The feedback value to the controller
    //! \param[in] pOutValue The pointer to the controller output value
    static inline void PID_run(PID_Handle handle,const _iq refValue,const _iq fbackValue,_iq *pOutValue)
    {
    PID_Obj *obj = (PID_Obj *)handle;

    _iq Error;
    _iq Up,Ui;


    //Error = refValue - fbackValue;

    " Error =- refValue - fbackValue; "

    Ui = obj->Ui; // load the previous integral output
    Up = _IQmpy(obj->Kp,Error); // Compute the proportional output
    Ui = _IQsat(Ui + _IQmpy(obj->Ki,Up),obj->outMax,obj->outMin); // Compute the integral output

    obj->Ui = Ui; // store the intetral output
    obj->refValue = refValue;
    obj->fbackValue = fbackValue;

    *pOutValue = _IQsat(Up + Ui,obj->outMax,obj->outMin); // Saturate the output

    return;
    } // end of PID_run() function


    //! \brief Runs the PID controller for speed
    //! \param[in] handle The PID controller handle
    //! \param[in] refValue The reference value to the controller
    //! \param[in] fbackValue The feedback value to the controller
    //! \param[in] pOutValue The pointer to the controller output value
    static inline void PID_run_spd(PID_Handle handle,const _iq refValue,const _iq fbackValue,_iq *pOutValue)
    {
    PID_Obj *obj = (PID_Obj *)handle;

    _iq Error;
    _iq Up,Ui;

    // Error = refValue - fbackValue;
    Error = -refValue - fbackValue;
    Ui = obj->Ui; // load the previous integral output
    Up = _IQmpy(obj->Kp,Error); // Compute the proportional output
    Ui = _IQsat(Ui + _IQmpy(obj->Ki,Error),obj->outMax,obj->outMin); // Compute the integral output

    obj->Ui = Ui; // store the intetral output
    obj->refValue = refValue;
    obj->fbackValue = fbackValue;

    *pOutValue = _IQsat(Up + Ui,obj->outMax,obj->outMin); // Saturate the output

    return;
    } // end of PID_run_spd() function


    //! \brief Sets the feedback value in the PID controller
    //! \param[in] handle The PID controller handle
    //! \param[in] fbackValue The feedback value
    static inline void PID_setFbackValue(PID_Handle handle,const _iq fbackValue)
    {
    PID_Obj *obj = (PID_Obj *)handle;

    obj->fbackValue = fbackValue;

    return;
    } // end of PID_setFbackValue() function


    //! \brief Sets the gains in the PID controller
    //! \param[in] handle The PID controller handle
    //! \param[in] Kp The proportional gain for the PID controller
    //! \param[in] Ki The integrator gain for the PID controller
    //! \param[in] Kd The derivative gain for the PID controller
    static inline void PID_setGains(PID_Handle handle,const _iq Kp,const _iq Ki,const _iq Kd)
    {
    PID_Obj *obj = (PID_Obj *)handle;

    obj->Kp = Kp;
    obj->Ki = Ki;
    obj->Kd = Kd;

    return;
    } // end of PID_setGains() function


    //! \brief Sets the derivative gain in the PID controller
    //! \param[in] handle The PID controller handle
    //! \param[in] Kd The derivative gain for the PID controller
    static inline void PID_setKd(PID_Handle handle,const _iq Kd)
    {
    PID_Obj *obj = (PID_Obj *)handle;

    obj->Kd = Kd;

    return;
    } // end of PID_setKd() function


    //! \brief Sets the integral gain in the PID controller
    //! \param[in] handle The PID controller handle
    //! \param[in] Ki The integral gain for the PID controller
    static inline void PID_setKi(PID_Handle handle,const _iq Ki)
    {
    PID_Obj *obj = (PID_Obj *)handle;

    obj->Ki = Ki;

    return;
    } // end of PID_setKi() function


    //! \brief Sets the proportional gain in the PID controller
    //! \param[in] handle The PID controller handle
    //! \param[in] Kp The proportional gain for the PID controller
    static inline void PID_setKp(PID_Handle handle,const _iq Kp)
    {
    PID_Obj *obj = (PID_Obj *)handle;

    obj->Kp = Kp;

    return;
    } // end of PID_setKp() function


    //! \brief Sets the minimum and maximum output value allowed in the PID controller
    //! \param[in] handle The PID controller handle
    //! \param[in] outMin The minimum output value allowed
    //! \param[in] outMax The maximum output value allowed
    static inline void PID_setMinMax(PID_Handle handle,const _iq outMin,const _iq outMax)
    {
    PID_Obj *obj = (PID_Obj *)handle;

    obj->outMin = outMin;
    obj->outMax = outMax;

    return;
    } // end of PID_setMinMax() function


    //! \brief Sets the maximum output value allowed in the PID controller
    //! \param[in] handle The PID controller handle
    //! \param[in] outMax The maximum output value allowed
    static inline void PID_setOutMax(PID_Handle handle,const _iq outMax)
    {
    PID_Obj *obj = (PID_Obj *)handle;

    obj->outMax = outMax;

    return;
    } // end of PID_setOutMax() function


    //! \brief Sets the minimum output value allowed in the PID controller
    //! \param[in] handle The PID controller handle
    //! \param[in] outMax The minimum output value allowed
    static inline void PID_setOutMin(PID_Handle handle,const _iq outMin)
    {
    PID_Obj *obj = (PID_Obj *)handle;

    obj->outMin = outMin;

    return;
    } // end of PID_setOutMin() function


    //! \brief Sets the reference value in the PID controller
    //! \param[in] handle The PID controller handle
    //! \param[in] refValue The reference value
    static inline void PID_setRefValue(PID_Handle handle,const _iq refValue)
    {
    PID_Obj *obj = (PID_Obj *)handle;

    obj->refValue = refValue;

    return;
    } // end of PID_setRefValue() function


    //! \brief Sets the integrator start value in the PID controller
    //! \param[in] handle The PID controller handle
    //! \param[in] Ui The integral start value for the PID controller
    static inline void PID_setUi(PID_Handle handle,const _iq Ui)
    {
    PID_Obj *obj = (PID_Obj *)handle;

    obj->Ui = Ui;

    return;
    } // end of PID_setUi() function


    #ifdef __cplusplus
    }
    #endif // extern "C"

    //@} // ingroup
    #endif //end of _PID_H_ definition

  • Yes. Just need to set the target speed to a negative value for another rotation direction.?

    Give me explanation on

  • The software will change the output voltage sequence and direction according to the reference speed. You don't change anything else, you only need to set the positive or negative reference speed for forward or reverse rotation as mentioned above. 

  • "Are there any possible UART commands to control a motor, such as 'Rx_on' to turn the motor on and 'Rx_off' to turn it off?"

  • I compiled it, but when I uploaded it to the GUI, an error appeared. 

  • "Are there any possible UART commands to control a motor, such as 'Rx_on' to turn the motor on and 'Rx_off' to turn it off?"

    No. You have to add this by yourself.

    Please take a look at the guide in motorWare as below:

    \ti\motorware\motorware_1_01_00_18\docs\guis\universal

    And also you can search and refer to the related thread about the GUI connection on E2E as below.

    https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/635255/ccs-launchxl-f28027f-boostxl-drv8301-universal-gui

  • I am starting to develop UART commands to control a motor, such as 'Rx_on' to turn the motor on and 'Rx_off' to turn it off. I am using the Lab2C platform for this project.

    I have created a new source file (uart.c) and a header file (uart.h).

    In the source file, I have written the code as follows:

    //#include "F28x_Project.h" // Device Headerfile and Examples Include File
    #include "uart.c"
    #include "uart.h" // Include the header file

    //#define UART_BAUD_RATE 115200
    #define SCI_BaudRate_115_2_kBaud = 15 //!< Denotes 115.2 kBaud
    //#define SCI_BAUD_RATE_DIVISOR 194

    #define RX_ON_COMMAND "Rx_on"
    #define RX_OFF_COMMAND "Rx_off"

    // Global variable to store UART received data
    //volatile char uartRxBuffer[100];
    volatile char SCIRXBUF[100];
    volatile uint16_t rxIndex = 0;

    void InitUART(void)
    {
    // Configure UART for communication
    InitSciaGpio();
    SciaRegs.SCICCR.all = 0x0007; // 1 stop bit, No Parity, 8 char bits
    SciaRegs.SCICTL1.all = 0x0003; // Enable TX, RX, and Enable the SCI
    SciaRegs.SCICTL2.all = 0x0003; // Enable TX, RX interrupts
    SciaRegs.SCIHBAUD.all = (uint16_t)((Uint32)(SysCtl_getPeripheralClock(SCI_A) / (UART_BAUD_RATE * 8)) - 1);
    SciaRegs.SCILBAUD.all = (uint16_t)((Uint32)(SysCtl_getPeripheralClock(SCI_A) / (UART_BAUD_RATE * 8)) - 1);
    }

    void InitSciaGpio(void)
    {
    // Initialize GPIO for SCI-A
    EALLOW;
    GpioCtrlRegs.GPAMUX1.bit.GPIO29 = 1; // Configure GPIO29 for SCIA TX
    GpioCtrlRegs.GPAMUX1.bit.GPIO928 = 1; // Configure GPIO28 for SCIA RX
    EDIS;
    }

    void InitPWM(void)
    {
    // Initialize PWM for motor control
    EALLOW;
    Eqpwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UP; // Count up mode
    Eqpwm1Regs.TBPRD = 1000; // Set PWM period
    Eqpwm1Regs.CMPA.half.CMPA = 0; // Initialize duty cycle to 0
    Eqpwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE; // Disable phase loading
    Eqpwm1Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1; // No division
    Eqpwm1Regs.TBCTL.bit.CLKDIV = TB_DIV1; // No division
    Eqpwm1Regs.AQCTLA.bit.CAU = AQ_SET; // Set on Compare A Up
    Eqpwm1Regs.AQCTLA.bit.CAD = AQ_CLEAR; // Clear on Compare A Down
    Eqpwm1Regs.CTL.bit.PHSDIR = PWM_UP_DOWN; // Up/Down Count Mode
    EDIS;

    // Configure GPIOs for PWM
    EALLOW;
    GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 1; // GPIO0 for PWM output
    EDIS;
    }

    void sciaRxISR(void)
    {
    // SCI RX Interrupt Service Routine
    char receivedChar = SciaRegs.SCIRXBUF.all; // Read received character

    // Store received character in buffer
    if (rxIndex < sizeof(uartRxBuffer) - 1)
    {
    uartRxBuffer[rxIndex++] = receivedChar;
    }
    if (receivedChar == '\n' || rxIndex >= sizeof(uartRxBuffer) - 1)
    {
    uartRxBuffer[rxIndex] = '\0'; // Null-terminate the string
    rxIndex = 0; // Reset index for next command
    // Call function to handle received command
    HandleUARTCommand();
    }

    SciaRegs.SCIFFCLR.bit.RXFFOVFCLR = 1; // Clear overflow flag
    PieCtrlRegs.PIEACK.all = PIEACK_GROUP9; // Acknowledge interrupt
    }

    void HandleUARTCommand(void)
    {
    if (strcmp(uartRxBuffer, RX_ON_COMMAND) == 0)
    {
    TurnMotorOn();
    }
    else if (strcmp(uartRxBuffer, RX_OFF_COMMAND) == 0)
    {
    TurnMotorOff();
    }
    else
    {
    // Handle unknown command
    }
    }

    void TurnMotorOn(void)
    {
    // Code to turn the motor on
    Eqpwm1Regs.CMPA.half.CMPA = 500; // Example duty cycle (50%)
    }

    void TurnMotorOff(void)
    {
    // Code to turn the motor off
    Eqpwm1Regs.CMPA.half.CMPA = 0; // Set duty cycle to 0%
    }

    In the header file, I have written the code as follows:

    /*
    * uart.h
    *
    * Created on: 10-Aug-2024
    * Author: DELL
    */

    #ifndef UART_H_
    #define UART_H_


    #include <stdint.h>

    // Function prototypes
    void InitUART(void);
    void InitSciaGpio(void);
    void InitPWM(void);
    void HandleUARTCommand(void);
    void TurnMotorOn(void);
    void TurnMotorOff(void);
    void sciaRxISR(void);

    // Global variables
    extern volatile char uartRxBuffer[100];
    extern volatile uint16_t rxIndex;

    #endif /* UART_H_ */

    but errors occur. The above developing code is suitable to control motor or not. And any added in the code.

  • "Please check if there are any mistakes in the question I asked above."

  • sorry the above code is modified 

    I am starting to develop UART commands to control a motor, such as 'Rx_on' to turn the motor on and 'Rx_off' to turn it off. I am using the Lab2C platform for this project.

    I have created a new source file (uart.c) and a header file (uart.h).

    In the source file, I have written the code as follows:

    #ifndef UART_C
    #define UART_C


    #include "F2802x_Device.h"
    #include "f2802x_examples.h"

    // Motor control definitions
    #define MOTOR_ON_COMMAND "Rx_on"
    #define MOTOR_OFF_COMMAND "Rx_off"

    __interrupt void scia_rx_isr(void);
    __interrupt void scia_tx_isr(void);

    char txBuffer[] = "Hello, UART Interrupt!";
    //int txIndex = 0;


    int txIndex=0;
    //char rxBuffer[16];
    char SCIRXBUF[16];
    int rxIndex = 0;
    bool motorEnabled = false;

    // Function prototypes
    void InitGpio();
    void InitScia();
    void ControlMotor(bool enable);
    /*
    void main(void)
    {
    // InitSysCtrl(); // Initialize the CPU and configure the clock
    DINT; // Disable CPU interrupts

    //InitGpio(); // Initialize the GPIO
    //InitScia(); // Initialize the UART

    InitPieCtrl(); // Initialize the PIE control registers
    InitPieVectTable(); // Initialize the PIE vector table

    EALLOW;
    // PieVectTable.SCIRXINTA = &scia_rx_isr; // Map RX ISR to the PIE vector table
    //PieVectTable.SCITXINTA = &scia_tx_isr; // Map TX ISR to the PIE vector table
    EDIS;

    //IER |= M_INT9; // Enable CPU INT9
    //PieCtrlRegs.PIEIER9.bit.INTx1 = 1; // Enable PIE Group 9 interrupt 1 (RX)
    //PieCtrlRegs.PIEIER9.bit.INTx2 = 1; // Enable PIE Group 9 interrupt 2 (TX)

    EINT; // Enable Global interrupt INTM
    ERTM; // Enable Global realtime interrupt DBGM

    while(1)
    {
    // Wait for interrupt-driven communication
    }
    }*/

    __interrupt void scia_rx_isr(void)
    {
    Uint16 receivedChar;

    receivedChar = SciaRegs.SCIRXBUF.all; // Read received character
    //if (rxIndex < sizeof(rxBuffer) - 1)
    if (rxIndex < sizeof(SCIRXBUF) - 1)
    {
    // rxBuffer[rxIndex++] = (char)receivedChar;
    SCIRXBUF[rxIndex++] = (char)receivedChar;
    }

    // Check if end of command (e.g., newline or carriage return)
    if (receivedChar == '\n' || receivedChar == '\r')
    {
    //rxBuffer[rxIndex] = '\0'; // Null-terminate the string
    SCIRXBUF[rxIndex] = '\0'; // Null-terminate the string
    rxIndex = 0;

    // Process received command
    // if (strcmp(rxBuffer, MOTOR_ON_COMMAND) == 0)
    if (strcmp(SCIRXBUF, MOTOR_ON_COMMAND) == 0)
    {
    ControlMotor(true); // Turn motor on
    }
    // else if (strcmp(rxBuffer, MOTOR_OFF_COMMAND) == 0)
    else if (strcmp(SCIRXBUF, MOTOR_OFF_COMMAND) == 0)
    {
    ControlMotor(false); // Turn motor off
    }

    // Echo received command
    SciaRegs.SCITXBUF = receivedChar;
    }

    SciaRegs.SCIFFRX.bit.RXFFINTCLR = 1; // Clear RX interrupt flag
    PieCtrlRegs.PIEACK.all = PIEACK_GROUP9; // Acknowledge interrupt
    }

    __interrupt void scia_tx_isr(void)
    {
    // if (txBuffer[txIndex] != '\0')
    if (txBuffer[txIndex] != '\0')
    {
    SciaRegs.SCITXBUF = txBuffer[txIndex++]; // Send next character
    }
    else
    {
    txIndex = 0; // Reset txIndex after completing transmission
    SciaRegs.SCICTL1.bit.TXENA = 0; // Disable TX
    }

    SciaRegs.SCIFFTX.bit.TXFFINTCLR = 1; // Clear TX interrupt flag
    PieCtrlRegs.PIEACK.all = PIEACK_GROUP9; // Acknowledge interrupt
    }

    void InitGpio()
    {
    EALLOW;
    GpioCtrlRegs.GPAPUD.bit.GPIO28 = 0; // Enable pull-up on GPIO28 (SCIRXDA)
    GpioCtrlRegs.GPAPUD.bit.GPIO29 = 0; // Enable pull-up on GPIO29 (SCITXDA)
    GpioCtrlRegs.GPAQSEL2.bit.GPIO28 = 3; // Asynchronous input GPIO28 (SCIRXDA)
    GpioCtrlRegs.GPAMUX2.bit.GPIO28 = 1; // Configure GPIO28 as SCIRXDA
    GpioCtrlRegs.GPAMUX2.bit.GPIO29 = 1; // Configure GPIO29 as SCITXDA
    EDIS;
    }

    void InitScia()
    {
    EALLOW;
    SysCtrlRegs.PCLKCR0.bit.SCIAENCLK = 1; // Enable SCI-A clock
    SciaRegs.SCICCR.all = 0x0007; // 1 stop bit, No loopback, No parity, 8 char bits, async mode, idle-line protocol
    SciaRegs.SCICTL1.all = 0x0003; // Enable TX, RX, internal SCICLK
    SciaRegs.SCICTL2.all = 0x0003; // Enable TX, RX interrupts
    SciaRegs.SCICTL1.all = 0x0023; // Relinquish SCI from Reset
    SciaRegs.SCIHBAUD = 0x0001; // Set baud rate to 9600
    SciaRegs.SCILBAUD = 0x00E7;
    SciaRegs.SCIFFTX.all = 0xC022; // Enable FIFO enhancements, clear TX FIFO, set TX FIFO level to 2
    SciaRegs.SCIFFRX.all = 0x0022; // Enable RX FIFO, clear RX FIFO, set RX FIFO level to 2
    SciaRegs.SCIFFCT.all = 0x0;
    EDIS;
    }

    void ControlMotor(bool enable)
    {
    if (enable)
    {
    // Add your code to turn the motor on, e.g., set GPIO or PWM
    motorEnabled = true;
    }
    else
    {
    // Add your code to turn the motor off, e.g., reset GPIO or PWM
    motorEnabled = false;
    }
    }
    #endif

    and also uart.h header file 

    #ifndef UART_H
    #define UART_H

    #include "F2802x_Device.h"

    // Motor control command definitions
    #define MOTOR_ON_COMMAND "Rx_on"
    #define MOTOR_OFF_COMMAND "Rx_off"

    // Function prototypes
    void InitGpio(void);
    void InitScia(void);
    void ControlMotor(bool enable);

    // Interrupt Service Routines
    __interrupt void scia_rx_isr(void);
    __interrupt void scia_tx_isr(void);

    #endif // UART_H

    and added initialize main.c function is below


    InitSysCtrl(); // Initialize the CPU and configure the clock
    DINT; // Disable CPU interrupts

    InitGpio(); // Initialize the GPIO
    InitScia(); // Initialize the UART

    InitPieCtrl(); // Initialize the PIE control registers
    InitPieVectTable(); // Initialize the PIE vector table

    EALLOW;
    PieVectTable.SCIRXINTA = &scia_rx_isr; // Map RX ISR to the PIE vector table
    PieVectTable.SCITXINTA = &scia_tx_isr; // Map TX ISR to the PIE vector table
    EDIS;

    IER |= M_INT9; // Enable CPU INT9
    PieCtrlRegs.PIEIER9.bit.INTx1 = 1; // Enable PIE Group 9 interrupt 1 (RX)
    PieCtrlRegs.PIEIER9.bit.INTx2 = 1; // Enable PIE Group 9 interrupt 2 (TX)

    EINT; // Enable Global interrupt INTM
    ERTM; // Enable Global realtime interrupt DBGM

    UART_sendString("System Initialized\n");

    while(1)
    {
    // Wait for interrupt-driven communication
    }

    but some errors occur. Please help me


    **** Build of configuration Debug for project lab2c ****

    "D:\\Texas_instrument\\ccs\\utils\\bin\\gmake" -k -j 12 all -O

    Building file: "../uart.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c" --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/device_support/f2802x" --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/device_support/f2802x/common/include" --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/device_support/f2802x/headers/include" --include_path="D:/Texas_instrument/motorware_1_01_00_18/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="uart.d_raw" "../uart.c"
    "../uart.c", line 80: warning #225-D: function "strcmp" declared implicitly
    Finished building: "../uart.c"

    Building file: "../main.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c" --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/device_support/f2802x" --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/device_support/f2802x/common/include" --include_path="D:/Texas_instrument/C2000Ware_5_02_00_00/device_support/f2802x/headers/include" --include_path="D:/Texas_instrument/motorware_1_01_00_18/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="main.d_raw" "../main.c"
    "../main.c", line 242: warning #187-D: dynamic initialization in unreachable code
    Finished building: "../main.c"

    Building target: "lab2c.out"
    Invoking: C2000 Linker
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi -z -m"lab2c.map" --warn_sections -i"D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/lib" -i"D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --reread_libs --diag_wrap=off --display_error_number --xml_link_info="lab2c_linkInfo.xml" --rom_model -o "lab2c.out" "./CodeStartBranch.obj" "./adc.obj" "./clarke.obj" "./clk.obj" "./cpu.obj" "./ctrl.obj" "./drv8301.obj" "./filter_fo.obj" "./flash.obj" "./gpio.obj" "./hal.obj" "./ipark.obj" "./main.obj" "./memCopy.obj" "./offset.obj" "./osc.obj" "./park.obj" "./pid.obj" "./pie.obj" "./pll.obj" "./pwm.obj" "./pwr.obj" "./sci.obj" "./spi.obj" "./svgen.obj" "./timer.obj" "./traj.obj" "./uart.obj" "./usDelay.obj" "./user.obj" "./wdog.obj" "D:/Texas_instrument/motorware_1_01_00_18/motorware_1_01_00_18/sw/modules/fast/lib/32b/f28x/f2802x/2802xRevB_Fast_IQ_ROMSymbols.lib" "D:/Texas_instrument/motorware_1_01_00_18/motorware_1_01_00_18/sw/modules/fast/lib/32b/f28x/f2802x/2802xRevB_Fast_ONLY_ROMSymbols.lib" "D:/Texas_instrument/motorware_1_01_00_18/motorware_1_01_00_18/sw/modules/fast/lib/32b/f28x/f2802x/2802xRevB_Fast_RTS_ROMSymbols.lib" "../F28027F.cmd" "D:/Texas_instrument/motorware_1_01_00_18/motorware_1_01_00_18/sw/modules/iqmath/lib/f28x/32b/IQmath.lib" "D:/Texas_instrument/motorware_1_01_00_18/motorware_1_01_00_18/sw/modules/fast/lib/32b/f28x/f2802x/fast_public.lib" -lrts2800_ml.lib
    <Linking>
    error #10056: symbol "_txIndex" redefined: first defined in "./main.obj"; redefined in "./uart.obj"
    error #10056: symbol "_InitGpio" redefined: first defined in "./main.obj"; redefined in "./uart.obj"
    error #10056: symbol "_txBuffer" redefined: first defined in "./main.obj"; redefined in "./uart.obj"
    error #10056: symbol "_scia_tx_isr" redefined: first defined in "./main.obj"; redefined in "./uart.obj"
    error #10056: symbol "_scia_rx_isr" redefined: first defined in "./main.obj"; redefined in "./uart.obj"
    error #10056: symbol "_ControlMotor" redefined: first defined in "./main.obj"; redefined in "./uart.obj"
    error #10056: symbol "_motorEnabled" redefined: first defined in "./main.obj"; redefined in "./uart.obj"
    error #10056: symbol "_SCIRXBUF" redefined: first defined in "./main.obj"; redefined in "./uart.obj"
    error #10056: symbol "_rxIndex" redefined: first defined in "./main.obj"; redefined in "./uart.obj"
    error #10056: symbol "_InitScia" redefined: first defined in "./main.obj"; redefined in "./uart.obj"
    warning #10210-D: creating ".stack" section with default size of 0x400; use the -stack option to change the default size

    undefined first referenced
    symbol in file
    --------- ----------------
    _GpioCtrlRegs ./main.obj
    _InitPieCtrl ./main.obj
    _InitPieVectTable ./main.obj
    _InitSysCtrl ./main.obj
    _PieCtrlRegs ./main.obj
    _PieVectTable ./main.obj
    _SciaRegs ./main.obj
    _SysCtrlRegs ./main.obj
    _UART_sendString ./main.obj

    error #10234-D: unresolved symbols remain
    error #10010: errors encountered during linking; "lab2c.out" not built

    >> Compilation failure
    makefile:170: recipe for target 'lab2c.out' failed
    gmake[1]: *** [lab2c.out] Error 1
    makefile:166: recipe for target 'all' failed
    gmake: *** [all] Error 2

    **** Build Finished ****

     

  • You may take a look at the guide (motorware_hal_tutorial.pdf) as below to add the functions you need. You can add the function with the same format in current motorWare.

    C:\ti\motorware\motorware_1_01_00_18\docs\tutorials

  • Thank you for your support. However, I am using functions from the motorware_hal_tutorial.pdf, but I am encountering some errors. Could you provide example code for UART commands to control a motor, such as 'Rx_on' to turn the motor on and 'Rx_off' to turn it off? I am working with the Lab2C platform for this project.

  • Sorry. There is no such example for you in motorWare. You may follow the guide and refer to the SCI example in C2000Ware or controlSUITE.

  • Thank you for your support. I am trying it numerous times, but errors occur. Please provide code for UART commands to control a motor, such as 'Rx_on' to turn the motor on and 'Rx_off' to turn it off. I am working with the Lab2C platform for this project.

    In main.c below code 

    /* --COPYRIGHT--,BSD
    * Copyright (c) 2012, Texas Instruments Incorporated
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * * Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    *
    * * Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the distribution.
    *
    * * Neither the name of Texas Instruments Incorporated nor the names of
    * its contributors may be used to endorse or promote products derived
    * from this software without specific prior written permission.
    *
    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
    * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
    * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    * --/COPYRIGHT--*/
    //! \file solutions/instaspin_foc/src/proj_lab02c.c
    //! \brief All control from user code, only FAST�feedback from ROM
    //! \brief Special variable scaling for improved motor ID, especially with low inductance motors
    //! (C) Copyright 2011, Texas Instruments, Inc.

    //! \defgroup PROJ_LAB02c PROJ_LAB02c
    //@{

    //! \defgroup PROJ_LAB02c_OVERVIEW Project Overview
    //!
    //! Run InstaSPIN�FOC from user memory (RAM/FLASH), only FAST�in ROM
    //! Special variable scaling for improved motor ID, especially with low inductance motors

    // **************************************************************************
    // the includes

    // system includes
    #include <math.h>
    #include <uart.h>
    //#include <uart_motor_control.c>
    #include "main.h"
    /*#include "uart.h"
    #include "uart.c"
    #include "F2802x_Device.h"
    #include "f2802x_examples.h"*/
    #include "hal.h"
    //#include "drv8301.h"
    #include "uart.h"
    #include "motor_control.h"
    #include <stdio.h>
    #include <string.h>

    #define SCI_BUFFER_SIZE 256

    /*void UART_init(void);
    void UART_sendString(const char *str);
    void UART_sendByte(uint8_t byte);
    uint8_t UART_receiveByte(void);*/

    HAL_Handle halHandle;


    // Define the handle for the hardware abstraction layer
    //HAL_Handle halHandle;

    // Function prototypes
    //void initHardware(void);
    //void handleUART(void);
    void processCommand(const char *command);
    void receiveAndProcessCommands(SCI_Handle sciHandle);


    char rxBuffer[SCI_BUFFER_SIZE];
    int rxBufferIndex = 0;

    //void processCommand(const char *command);
    //void receiveAndProcessCommands(SCI_Handle sciHandle);

    void receiveAndProcessCommands(SCI_Handle sciHandle) {
    uint16_t data;
    while (1) {
    // Check if data is available in the RX FIFO
    data = SCI_getDataBlocking(sciHandle);
    if (data == '\r' || data == '\n') { // End of command
    rxBuffer[rxBufferIndex] = '\0';
    // Process the command
    processCommand(rxBuffer);
    // Reset buffer index for next command
    rxBufferIndex = 0;
    } else {
    // Store the received character in the buffer
    if (rxBufferIndex < (SCI_BUFFER_SIZE - 1)) {
    rxBuffer[rxBufferIndex++] = (char)data;
    } else {
    // Buffer overflow, reset index
    rxBufferIndex = 0;
    }
    }
    }
    }

    void processCommand(const char *command) {
    if (strcmp(command, "Rx_on") == 0) {
    motorControlOn();
    } else if (strcmp(command, "Rx_off") == 0) {
    motorControlOff();
    } else {
    // Handle unknown command
    printf("Unknown command: %s\n", command);
    }
    }


    #ifdef FLASH
    #pragma CODE_SECTION(mainISR,"ramfuncs");
    #endif

    // Include header files used in the main function


    // **************************************************************************
    // the defines

    #define LED_BLINK_FREQ_Hz 5


    // **************************************************************************
    // the globals

    uint_least16_t gCounter_updateGlobals = 0;

    bool Flag_Latch_softwareUpdate = true;

    CTRL_Handle ctrlHandle;

    #ifdef CSM_ENABLE
    #pragma DATA_SECTION(halHandle,"rom_accessed_data");
    #endif
    HAL_Handle halHandle;

    #ifdef CSM_ENABLE
    #pragma DATA_SECTION(gUserParams,"rom_accessed_data");
    #endif
    USER_Params gUserParams;

    HAL_PwmData_t gPwmData = {_IQ(0.0), _IQ(0.0), _IQ(0.0)};

    HAL_AdcData_t gAdcData;

    _iq gMaxCurrentSlope = _IQ(0.0);

    #ifdef FAST_ROM_V1p6
    CTRL_Obj *controller_obj;
    #else
    #ifdef CSM_ENABLE
    #pragma DATA_SECTION(ctrl,"rom_accessed_data");
    #endif
    CTRL_Obj ctrl; //v1p7 format
    #endif

    uint16_t gLEDcnt = 0;

    volatile MOTOR_Vars_t gMotorVars = MOTOR_Vars_INIT;

    #ifdef FLASH
    // Used for running BackGround in flash, and ISR in RAM
    extern uint16_t *RamfuncsLoadStart, *RamfuncsLoadEnd, *RamfuncsRunStart;

    #ifdef CSM_ENABLE
    extern uint16_t *econst_start, *econst_end, *econst_ram_load;
    extern uint16_t *switch_start, *switch_end, *switch_ram_load;
    #endif
    #endif

    _iq gLs_pu = _IQ30(0.0);
    uint_least8_t gLs_qFmt = 0;
    uint_least8_t gMax_Ls_qFmt = 0;

    #ifdef DRV8301_SPI
    // Watch window interface to the 8301 SPI
    DRV_SPI_8301_Vars_t gDrvSpi8301Vars;
    #endif

    #ifdef DRV8305_SPI
    // Watch window interface to the 8305 SPI
    DRV_SPI_8305_Vars_t gDrvSpi8305Vars;
    #endif

    // **************************************************************************
    // the functions
    // UART functions

    void main(void)
    {

    SCI_Handle sciHandle;
    void *sciObj; // Replace with actual initialization

    // Initialize the SCI handle
    sciHandle = SCI_init(sciObj, sizeof(*sciObj));

    // Initialize the SCI module with configuration
    SCI_setBaudRate(sciHandle, 9600);
    SCI_setCharLength(sciHandle, 8);
    SCI_setNumStopBits(sciHandle, 1);
    SCI_setParity(sciHandle, 0); // No parity
    SCI_enable(sciHandle);

    // Start receiving and processing commands
    //receiveAndProcessCommands(sciHandle);

    //return 0;


    uint_least8_t estNumber = 0;

    #ifdef FAST_ROM_V1p6
    uint_least8_t ctrlNumber = 0;
    #endif

    // Only used if running from FLASH
    // Note that the variable FLASH is defined by the project
    #ifdef FLASH
    // Copy time critical code and Flash setup code to RAM
    // The RamfuncsLoadStart, RamfuncsLoadEnd, and RamfuncsRunStart
    // symbols are created by the linker. Refer to the linker files.
    memCopy((uint16_t *)&RamfuncsLoadStart,(uint16_t *)&RamfuncsLoadEnd,(uint16_t *)&RamfuncsRunStart);

    #ifdef CSM_ENABLE
    //copy .econst to unsecure RAM
    if(*econst_end - *econst_start)
    {
    memCopy((uint16_t *)&econst_start,(uint16_t *)&econst_end,(uint16_t *)&econst_ram_load);
    }

    //copy .switch ot unsecure RAM
    if(*switch_end - *switch_start)
    {
    memCopy((uint16_t *)&switch_start,(uint16_t *)&switch_end,(uint16_t *)&switch_ram_load);
    }
    #endif
    #endif

    // initialize the hardware abstraction layer
    halHandle = HAL_init(&hal,sizeof(hal));


    // check for errors in user parameters
    USER_checkForErrors(&gUserParams);


    // store user parameter error in global variable
    gMotorVars.UserErrorCode = USER_getErrorCode(&gUserParams);


    // do not allow code execution if there is a user parameter error
    if(gMotorVars.UserErrorCode != USER_ErrorCode_NoError)
    {
    for(;;)
    {
    gMotorVars.Flag_enableSys = false;
    }
    }


    // initialize the user parameters
    USER_setParams(&gUserParams);


    // set the hardware abstraction layer parameters
    HAL_setParams(halHandle,&gUserParams);


    // initialize the controller
    #ifdef FAST_ROM_V1p6
    ctrlHandle = CTRL_initCtrl(ctrlNumber, estNumber); //v1p6 format (06xF and 06xM devices)
    controller_obj = (CTRL_Obj *)ctrlHandle;
    #else
    ctrlHandle = CTRL_initCtrl(estNumber,&ctrl,sizeof(ctrl)); //v1p7 format default
    #endif


    {
    CTRL_Version version;

    // get the version number
    CTRL_getVersion(ctrlHandle,&version);

    gMotorVars.CtrlVersion = version;
    }

    // set the default controller parameters
    CTRL_setParams(ctrlHandle,&gUserParams);

    // setup faults
    HAL_setupFaults(halHandle);

    // initialize the interrupt vector table
    HAL_initIntVectorTable(halHandle);

    // enable the ADC interrupts
    HAL_enableAdcInts(halHandle);


    // enable global interrupts
    HAL_enableGlobalInts(halHandle);


    // enable debug interrupts
    HAL_enableDebugInt(halHandle);


    // disable the PWM
    HAL_disablePwm(halHandle);


    #ifdef DRV8301_SPI
    // turn on the DRV8301 if present
    HAL_enableDrv(halHandle);
    // initialize the DRV8301 interface
    HAL_setupDrvSpi(halHandle,&gDrvSpi8301Vars);
    #endif

    #ifdef DRV8305_SPI
    // turn on the DRV8305 if present
    HAL_enableDrv(halHandle);
    // initialize the DRV8305 interface
    HAL_setupDrvSpi(halHandle,&gDrvSpi8305Vars);
    #endif


    // enable DC bus compensation
    CTRL_setFlag_enableDcBusComp(ctrlHandle, true);


    for(;;)
    {
    // Waiting for enable system flag to be set
    while(!(gMotorVars.Flag_enableSys));

    // loop while the enable system flag is true
    while(gMotorVars.Flag_enableSys)
    {
    CTRL_Obj *obj = (CTRL_Obj *)ctrlHandle;

    // increment counters
    gCounter_updateGlobals++;


    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
    HAL_disablePwm(halHandle);
    }
    else
    {
    // update the controller state
    bool flag_ctrlStateChanged = CTRL_updateState(ctrlHandle);

    // enable or disable the control
    CTRL_setFlag_enableCtrl(ctrlHandle, gMotorVars.Flag_Run_Identify);

    if(flag_ctrlStateChanged)
    {
    CTRL_State_e ctrlState = CTRL_getState(ctrlHandle);
    EST_State_e estState = EST_getState(obj->estHandle);

    if(ctrlState == CTRL_State_OffLine)
    {
    // enable the PWM
    HAL_enablePwm(halHandle);
    }
    else if(ctrlState == CTRL_State_OnLine)
    {
    if((estState < EST_State_LockRotor) || (estState > EST_State_MotorIdentified))
    {
    // update the ADC bias values
    HAL_updateAdcBias(halHandle);
    }

    // Return the bias value for currents
    gMotorVars.I_bias.value[0] = HAL_getBias(halHandle,HAL_SensorType_Current,0);
    gMotorVars.I_bias.value[1] = HAL_getBias(halHandle,HAL_SensorType_Current,1);
    gMotorVars.I_bias.value[2] = HAL_getBias(halHandle,HAL_SensorType_Current,2);

    // Return the bias value for voltages
    gMotorVars.V_bias.value[0] = HAL_getBias(halHandle,HAL_SensorType_Voltage,0);
    gMotorVars.V_bias.value[1] = HAL_getBias(halHandle,HAL_SensorType_Voltage,1);
    gMotorVars.V_bias.value[2] = HAL_getBias(halHandle,HAL_SensorType_Voltage,2);

    // enable the PWM
    HAL_enablePwm(halHandle);
    }
    else if(ctrlState == CTRL_State_Idle)
    {
    // disable the PWM
    HAL_disablePwm(halHandle);
    gMotorVars.Flag_Run_Identify = false;
    }

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

    }
    }


    if(EST_isMotorIdentified(obj->estHandle))
    {
    // set the current ramp
    EST_setMaxCurrentSlope_pu(obj->estHandle,gMaxCurrentSlope);
    gMotorVars.Flag_MotorIdentified = true;

    // set the speed reference
    CTRL_setSpd_ref_krpm(ctrlHandle,gMotorVars.SpeedRef_krpm);

    // set the speed acceleration
    CTRL_setMaxAccel_pu(ctrlHandle,_IQmpy(MAX_ACCEL_KRPMPS_SF,gMotorVars.MaxAccel_krpmps));

    if(Flag_Latch_softwareUpdate)
    {
    Flag_Latch_softwareUpdate = false;

    USER_calcPIgains(ctrlHandle);
    }

    }
    else
    {
    Flag_Latch_softwareUpdate = true;

    // the estimator sets the maximum current slope during identification
    gMaxCurrentSlope = EST_getMaxCurrentSlope_pu(obj->estHandle);
    }


    // when appropriate, update the global variables
    if(gCounter_updateGlobals >= NUM_MAIN_TICKS_FOR_GLOBAL_VARIABLE_UPDATE)
    {
    // reset the counter
    gCounter_updateGlobals = 0;

    updateGlobalVariables_motor(ctrlHandle);
    }

    if(CTRL_getMotorType(ctrlHandle) == MOTOR_Type_Induction)
    {
    // recalculate Kp and Ki gains to fix the R/L limitation of 2000.0, and Kp limit to 0.11
    recalcKpKi(ctrlHandle);

    // set electrical frequency limit to zero while identifying an induction motor
    setFeLimitZero(ctrlHandle);

    // calculate Dir_qFmt for acim motors
    acim_Dir_qFmtCalc(ctrlHandle);
    }
    else
    {
    // recalculate Kp and Ki gains to fix the R/L limitation of 2000.0, and Kp limit to 0.11
    // as well as recalculates gains based on estimator state to allow low inductance pmsm to id
    recalcKpKiPmsm(ctrlHandle);

    // calculate an Ls qFmt that allows ten times smaller inductance compared to Lhf
    CTRL_calcMax_Ls_qFmt(ctrlHandle, &gMax_Ls_qFmt);

    gLs_pu = EST_getLs_d_pu(obj->estHandle);
    gLs_qFmt = EST_getLs_qFmt(obj->estHandle);
    }

    // enable/disable the forced angle
    EST_setFlag_enableForceAngle(obj->estHandle,gMotorVars.Flag_enableForceAngle);

    // enable or disable power warp
    CTRL_setFlag_enablePowerWarp(ctrlHandle,gMotorVars.Flag_enablePowerWarp);

    #ifdef DRV8301_SPI
    HAL_writeDrvData(halHandle,&gDrvSpi8301Vars);

    HAL_readDrvData(halHandle,&gDrvSpi8301Vars);
    #endif
    #ifdef DRV8305_SPI
    HAL_writeDrvData(halHandle,&gDrvSpi8305Vars);

    HAL_readDrvData(halHandle,&gDrvSpi8305Vars);
    #endif
    } // end of while(gFlag_enableSys) loop


    // disable the PWM
    HAL_disablePwm(halHandle);

    // 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

    } // end of main() function


    interrupt void mainISR(void)
    {
    // toggle status LED
    if(++gLEDcnt >= (uint_least32_t)(USER_ISR_FREQ_Hz / LED_BLINK_FREQ_Hz))
    {
    HAL_toggleLed(halHandle,(GPIO_Number_e)HAL_Gpio_LED2);
    gLEDcnt = 0;
    }


    // acknowledge the ADC interrupt
    HAL_acqAdcInt(halHandle,ADC_IntNumber_1);


    // convert the ADC data
    HAL_readAdcData(halHandle,&gAdcData);


    // run the controller
    CTRL_run(ctrlHandle,halHandle,&gAdcData,&gPwmData);


    // write the PWM compare values
    HAL_writePwmData(halHandle,&gPwmData);


    // setup the controller
    CTRL_setup(ctrlHandle);


    if(CTRL_getMotorType(ctrlHandle) == MOTOR_Type_Pm)
    {
    // reset Ls Q format to a higher value when Ls identification starts
    CTRL_resetLs_qFmt(ctrlHandle, gMax_Ls_qFmt);
    }

    return;
    } // end of mainISR() function


    void updateGlobalVariables_motor(CTRL_Handle handle)
    {
    CTRL_Obj *obj = (CTRL_Obj *)handle;

    // get the speed estimate
    gMotorVars.Speed_krpm = EST_getSpeed_krpm(obj->estHandle);

    // get the real time speed reference coming out of the speed trajectory generator
    gMotorVars.SpeedTraj_krpm = _IQmpy(CTRL_getSpd_int_ref_pu(handle),EST_get_pu_to_krpm_sf(obj->estHandle));

    // get the magnetizing current
    gMotorVars.MagnCurr_A = EST_getIdRated(obj->estHandle);

    // get the rotor resistance
    gMotorVars.Rr_Ohm = EST_getRr_Ohm(obj->estHandle);

    // get the stator resistance
    gMotorVars.Rs_Ohm = EST_getRs_Ohm(obj->estHandle);

    // get the stator inductance in the direct coordinate direction
    gMotorVars.Lsd_H = EST_getLs_d_H(obj->estHandle);

    // get the stator inductance in the quadrature coordinate direction
    gMotorVars.Lsq_H = EST_getLs_q_H(obj->estHandle);

    // get the flux in V/Hz in floating point
    gMotorVars.Flux_VpHz = EST_getFlux_VpHz(obj->estHandle);

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

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

    // Get the DC buss voltage
    gMotorVars.VdcBus_kV = _IQmpy(gAdcData.dcBus,_IQ(USER_IQ_FULL_SCALE_VOLTAGE_V/1000.0));

    return;
    } // end of updateGlobalVariables_motor() function


    void CTRL_resetLs_qFmt(CTRL_Handle handle, const uint_least8_t Ls_qFmt)
    {
    CTRL_Obj *obj = (CTRL_Obj *)handle;
    static bool LsResetLatch = false;

    // reset Ls Q format to a higher value when Ls identification starts
    if(EST_getState(obj->estHandle) == EST_State_Ls)
    {
    if((EST_getLs_d_pu(obj->estHandle) != _IQ30(0.0)) && (LsResetLatch == false))
    {
    EST_setLs_qFmt(obj->estHandle, Ls_qFmt);
    LsResetLatch = true;
    }
    }
    else
    {
    LsResetLatch = false;
    }

    return;
    } // end of CTRL_resetLs_qFmt() function


    void recalcKpKiPmsm(CTRL_Handle handle)
    {
    CTRL_Obj *obj = (CTRL_Obj *)handle;
    EST_State_e EstState = EST_getState(obj->estHandle);

    if((EST_isMotorIdentified(obj->estHandle) == false) && (EstState == EST_State_Rs))
    {
    float_t Lhf = CTRL_getLhf(handle);
    float_t Rhf = CTRL_getRhf(handle);
    float_t RhfoverLhf = Rhf/Lhf;
    _iq Kp = _IQ(0.05*Lhf*USER_IQ_FULL_SCALE_CURRENT_A/(USER_CTRL_PERIOD_sec*USER_IQ_FULL_SCALE_VOLTAGE_V));
    _iq Ki = _IQ(RhfoverLhf*USER_CTRL_PERIOD_sec);
    _iq Kp_spd = _IQ(0.005*USER_IQ_FULL_SCALE_FREQ_Hz*USER_MOTOR_MAX_CURRENT/USER_IQ_FULL_SCALE_CURRENT_A);

    // set Rhf/Lhf
    CTRL_setRoverL(handle,RhfoverLhf);

    // set the controller proportional gains
    CTRL_setKp(handle,CTRL_Type_PID_Id,Kp);
    CTRL_setKp(handle,CTRL_Type_PID_Iq,Kp);

    // set the Id controller gains
    CTRL_setKi(handle,CTRL_Type_PID_Id,Ki);
    PID_setKi(obj->pidHandle_Id,Ki);

    // set the Iq controller gains
    CTRL_setKi(handle,CTRL_Type_PID_Iq,Ki);
    PID_setKi(obj->pidHandle_Iq,Ki);

    // set speed gains
    PID_setKp(obj->pidHandle_spd,Kp_spd);
    }
    else if(EstState == EST_State_RatedFlux)
    {
    _iq Ki_spd = _IQ(0.5*USER_IQ_FULL_SCALE_FREQ_Hz*USER_CTRL_PERIOD_sec*USER_MOTOR_MAX_CURRENT/USER_IQ_FULL_SCALE_CURRENT_A);

    // Set Ki on closing the feedback loop
    PID_setKi(obj->pidHandle_spd,Ki_spd);
    }
    else if(EstState == EST_State_RampDown)
    {
    _iq Kp_spd = _IQ(0.02*USER_IQ_FULL_SCALE_FREQ_Hz*USER_MOTOR_MAX_CURRENT/USER_IQ_FULL_SCALE_CURRENT_A);
    _iq Ki_spd = _IQ(2.0*USER_IQ_FULL_SCALE_FREQ_Hz*USER_CTRL_PERIOD_sec*USER_MOTOR_MAX_CURRENT/USER_IQ_FULL_SCALE_CURRENT_A);

    // Set Kp and Ki of the speed controller
    PID_setKp(obj->pidHandle_spd,Kp_spd);
    PID_setKi(obj->pidHandle_spd,Ki_spd);

    TRAJ_setTargetValue(obj->trajHandle_spdMax,_IQ(USER_MOTOR_RES_EST_CURRENT/USER_IQ_FULL_SCALE_CURRENT_A));
    }

    return;
    } // end of recalcKpKiPmsm() function


    void CTRL_calcMax_Ls_qFmt(CTRL_Handle handle, uint_least8_t *pLs_qFmt)
    {
    CTRL_Obj *obj = (CTRL_Obj *)handle;

    if((EST_isMotorIdentified(obj->estHandle) == false) && (EST_getState(obj->estHandle) == EST_State_Rs))
    {
    float_t Lhf = CTRL_getLhf(handle);
    float_t fullScaleInductance = USER_IQ_FULL_SCALE_VOLTAGE_V/(USER_IQ_FULL_SCALE_CURRENT_A*USER_VOLTAGE_FILTER_POLE_rps);
    float_t Ls_coarse_max = _IQ30toF(EST_getLs_coarse_max_pu(obj->estHandle));
    int_least8_t lShift = ceil(log((Lhf/20.0)/(Ls_coarse_max*fullScaleInductance))/log(2.0));

    *pLs_qFmt = 30 - lShift;
    }

    return;
    } // end of CTRL_calcMax_Ls_qFmt() function


    void recalcKpKi(CTRL_Handle handle)
    {
    CTRL_Obj *obj = (CTRL_Obj *)handle;
    EST_State_e EstState = EST_getState(obj->estHandle);

    if((EST_isMotorIdentified(obj->estHandle) == false) && (EstState == EST_State_Rs))
    {
    float_t Lhf = CTRL_getLhf(handle);
    float_t Rhf = CTRL_getRhf(handle);
    float_t RhfoverLhf = Rhf/Lhf;
    _iq Kp = _IQ(0.25*Lhf*USER_IQ_FULL_SCALE_CURRENT_A/(USER_CTRL_PERIOD_sec*USER_IQ_FULL_SCALE_VOLTAGE_V));
    _iq Ki = _IQ(RhfoverLhf*USER_CTRL_PERIOD_sec);

    // set Rhf/Lhf
    CTRL_setRoverL(handle,RhfoverLhf);

    // set the controller proportional gains
    CTRL_setKp(handle,CTRL_Type_PID_Id,Kp);
    CTRL_setKp(handle,CTRL_Type_PID_Iq,Kp);

    // set the Id controller gains
    CTRL_setKi(handle,CTRL_Type_PID_Id,Ki);
    PID_setKi(obj->pidHandle_Id,Ki);

    // set the Iq controller gains
    CTRL_setKi(handle,CTRL_Type_PID_Iq,Ki);
    PID_setKi(obj->pidHandle_Iq,Ki);
    }

    return;
    } // end of recalcKpKi() function


    void setFeLimitZero(CTRL_Handle handle)
    {
    CTRL_Obj *obj = (CTRL_Obj *)handle;
    EST_State_e EstState = EST_getState(obj->estHandle);

    _iq fe_neg_max_pu;
    _iq fe_pos_min_pu;

    if((EST_isMotorIdentified(obj->estHandle) == false) && (CTRL_getMotorType(handle) == MOTOR_Type_Induction))
    {
    fe_neg_max_pu = _IQ30(0.0);

    fe_pos_min_pu = _IQ30(0.0);
    }
    else
    {
    fe_neg_max_pu = _IQ30(-USER_ZEROSPEEDLIMIT);

    fe_pos_min_pu = _IQ30(USER_ZEROSPEEDLIMIT);
    }

    EST_setFe_neg_max_pu(obj->estHandle, fe_neg_max_pu);

    EST_setFe_pos_min_pu(obj->estHandle, fe_pos_min_pu);

    return;
    } // end of setFeLimitZero() function


    void acim_Dir_qFmtCalc(CTRL_Handle handle)
    {
    CTRL_Obj *obj = (CTRL_Obj *)handle;
    EST_State_e EstState = EST_getState(obj->estHandle);

    if(EstState == EST_State_IdRated)
    {
    EST_setDir_qFmt(obj->estHandle, EST_computeDirection_qFmt(obj->estHandle, 0.7));
    }

    return;
    } // end of acim_Dir_qFmtCalc() function


    //@} //defgroup
    // end of file

    /*void main(void) {
    // Initialization code
    initializePWM();
    initializeDR8301();

    while (1) {
    // Example: Set motor speed to reverse with a specific value
    setMotorSpeed(-1500);

    // Update PWM settings
    updatePWMSettings(targetSpeed, directionFlag);

    // Add any other control logic or periodic tasks here
    }
    }*/

    and also motor_control.c file below. I am write it

    /*
    * motor_control.c
    *
    * Created on: 14-Aug-2024
    * Author: DELL
    */

    // motor_control.c

    #include "motor_control.h"
    #include <stdio.h>

    void motorControlOn(void) {
    // Code to turn the motor on
    printf("Motor turned ON\n");
    }

    void motorControlOff(void) {
    // Code to turn the motor off
    printf("Motor turned OFF\n");
    }

    and also motor_control.h is 

    /*
    * motor_control.h
    *
    * Created on: 14-Aug-2024
    * Author: DELL
    */

    #ifndef MOTOR_CONTROL_H_
    #define MOTOR_CONTROL_H_

    // motor_control.h

    #ifndef MOTOR_CONTROL_H
    #define MOTOR_CONTROL_H

    void motorControlOn(void);
    void motorControlOff(void);

    #endif // MOTOR_CONTROL_H


    #endif /* MOTOR_CONTROL_H_ */

    the errors occur below


    **** Build of configuration Debug for project lab2c ****

    "D:\\Texas_instrument\\ccs\\utils\\bin\\gmake" -k -j 12 all -O

    Building file: "../main.c"
    Invoking: C2000 Compiler
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt --include_path="D:/TI_Progrms/lab2c" --include_path="D:/Texas_instrument/motorware_1_01_00_18/motorware_1_01_00_18" --include_path="D:/Texas_instrument/motorware_1_01_00_18/motorware_1_01_00_18/sw/modules/hal/boards/boostxldrv8301_revB/f28x/f2802x/src" --include_path="D:/Texas_instrument/motorware_1_01_00_18/motorware_1_01_00_18/sw/solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src" --include_path="D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi --preproc_with_compile --preproc_dependency="main.d_raw" "../main.c"
    "../main.c", line 94: warning #225-D: function "SCI_getDataBlocking" declared implicitly
    "../main.c", line 213: warning #225-D: function "SCI_init" declared implicitly
    "../main.c", line 213: warning #551-D: variable "sciObj" is used before its value is set
    "../main.c", line 213: warning #515-D: a value of type "int" cannot be assigned to an entity of type "SCI_Handle"
    "../main.c", line 216: warning #225-D: function "SCI_setBaudRate" declared implicitly
    "../main.c", line 217: warning #225-D: function "SCI_setCharLength" declared implicitly
    "../main.c", line 218: warning #225-D: function "SCI_setNumStopBits" declared implicitly
    "../main.c", line 219: warning #225-D: function "SCI_setParity" declared implicitly
    "../main.c", line 220: warning #225-D: function "SCI_enable" declared implicitly
    Finished building: "../main.c"

    Building target: "lab2c.out"
    Invoking: C2000 Linker
    "D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/bin/cl2000" -v28 -ml -mt -g --diag_warning=225 --diag_wrap=off --display_error_number --abi=coffabi -z -m"lab2c.map" --warn_sections -i"D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/lib" -i"D:/Texas_instrument/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include" --reread_libs --diag_wrap=off --display_error_number --xml_link_info="lab2c_linkInfo.xml" --rom_model -o "lab2c.out" "./CodeStartBranch.obj" "./adc.obj" "./clarke.obj" "./clk.obj" "./cpu.obj" "./ctrl.obj" "./drv8301.obj" "./filter_fo.obj" "./flash.obj" "./gpio.obj" "./hal.obj" "./ipark.obj" "./main.obj" "./memCopy.obj" "./motor_control.obj" "./offset.obj" "./osc.obj" "./park.obj" "./pid.obj" "./pie.obj" "./pll.obj" "./pwm.obj" "./pwr.obj" "./sci.obj" "./spi.obj" "./svgen.obj" "./timer.obj" "./traj.obj" "./uart.obj" "./usDelay.obj" "./user.obj" "./wdog.obj" "D:/Texas_instrument/motorware_1_01_00_18/motorware_1_01_00_18/sw/modules/fast/lib/32b/f28x/f2802x/2802xRevB_Fast_IQ_ROMSymbols.lib" "D:/Texas_instrument/motorware_1_01_00_18/motorware_1_01_00_18/sw/modules/fast/lib/32b/f28x/f2802x/2802xRevB_Fast_ONLY_ROMSymbols.lib" "D:/Texas_instrument/motorware_1_01_00_18/motorware_1_01_00_18/sw/modules/fast/lib/32b/f28x/f2802x/2802xRevB_Fast_RTS_ROMSymbols.lib" "../F28027F.cmd" "D:/Texas_instrument/motorware_1_01_00_18/motorware_1_01_00_18/sw/modules/iqmath/lib/f28x/32b/IQmath.lib" "D:/Texas_instrument/motorware_1_01_00_18/motorware_1_01_00_18/sw/modules/fast/lib/32b/f28x/f2802x/fast_public.lib" -lrts2800_ml.lib
    <Linking>
    warning #10247-D: creating output section ".cio" without a SECTIONS specification
    warning #10210-D: creating ".stack" section with default size of 0x400; use the -stack option to change the default size
    warning #10210-D: creating ".esysmem" section with default size of 0x400; use the -heap option to change the default size
    "../F28027F.cmd", line 126: error #10099-D: program will not fit into available memory, or the section contains a call site that requires a trampoline that can't be generated for this section. run placement with alignment/blocking fails for section ".ebss" size 0x5ef page 1. Available memory ranges:
    RAMM0_M1 size: 0x600 unused: 0x600 max hole: 0x600
    "../F28027F.cmd", line 112: error #10099-D: program will not fit into available memory, or the section contains a call site that requires a trampoline that can't be generated for this section. placement with alignment/blocking fails for section ".text" size 0x7506 page 0. Available memory ranges:
    FLASHB_D size: 0x6000 unused: 0x5e5f max hole: 0x5e5f
    error #10010: errors encountered during linking; "lab2c.out" not built

    >> Compilation failure
    makefile:171: recipe for target 'lab2c.out' failed
    gmake[1]: *** [lab2c.out] Error 1
    makefile:167: recipe for target 'all' failed
    gmake: *** [all] Error 2

    **** Build Finished ****

  • Please only paste what changes you made and what's the errors or questions you have. And please have a clear description of the changes in the example lab to help us to understand your questions. Don't paste all codes and the compiling message as above. Thanks!

    Please take a look at the HAL guide as mentioned before and follow the guide to add your codes for SCI. 

  • /* --COPYRIGHT--,BSD
     * Copyright (c) 2012, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     * --/COPYRIGHT--*/
    //! \file   solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src/hal.c
    //! \brief Contains the various functions related to the HAL object (everything outside the CTRL system) 
    //!
    //! (C) Copyright 2011, Texas Instruments, Inc.
    
    
    // **************************************************************************
    // the includes
    
    // drivers
    
    // modules
    
    // platforms
    #include "hal.h"
    #include "user.h"
    #include "hal_obj.h"
    
    
    
    /*#include "sw/drivers/sci/src/32b/f28x/f2802x/sci.h"
    void HAL_initMotor(void)
    {
        // Configure GPIO for motor control (assuming PWM or digital output)
        // Example: Initialize PWM channels, GPIO pins, etc.
    }
    
    // Turn the motor on
    void HAL_motorOn(void)
    {
        // Set GPIO or PWM to turn the motor on
        // Example: Set PWM duty cycle or GPIO high
    }
    
    // Turn the motor off
    void HAL_motorOff(void)
    {
        // Set GPIO or PWM to turn the motor off
        // Example: Set PWM duty cycle or GPIO low
    }*/
    
    
    
    
    
    
    
    
    
    
    
    
    #ifdef FLASH
    #pragma CODE_SECTION(HAL_setupFlash,"ramfuncs");
    #endif
    
    // **************************************************************************
    // the defines
    
    #define US_TO_CNT(A) ((((long double) A * (long double)USER_SYSTEM_FREQ_MHz) - 9.0L) / 5.0L)
    
    // **************************************************************************
    // the globals
    
    #ifdef F2802xF
    #pragma DATA_SECTION(hal,"rom_accessed_data");
    #endif
    HAL_Obj hal;
    
    
    // **************************************************************************
    // the functions
    
    
    
    void HAL_setupSciA(HAL_Handle handle)
    {
    HAL_Obj *obj = (HAL_Obj *)handle;
    SCI_reset(obj->sciAHandle);
    SCI_enableTx(obj->sciAHandle);
    SCI_enableRx(obj->sciAHandle);
    SCI_disableParity(obj->sciAHandle);
    SCI_setNumStopBits(obj->sciAHandle,SCI_NumStopBits_One);
    SCI_setCharLength(obj->sciAHandle,SCI_CharLength_8_Bits);
    // set baud rate to 115200
    SCI_setBaudRate(obj->sciAHandle,(SCI_BaudRate_e)(0x0061));
    SCI_setPriority(obj->sciAHandle,SCI_Priority_FreeRun);
    SCI_enable(obj->sciAHandle);
    return;
    // end of HAL_setupSciA() function
    }
    
    
    
    void HAL_setupSciB(HAL_Handle handle)
    {
    HAL_Obj *obj = (HAL_Obj *)handle;
    SCI_reset(obj->sciBHandle);
    SCI_enableTx(obj->sciBHandle);
    SCI_enableRx(obj->sciBHandle);
    SCI_disableParity(obj->sciBHandle);
    SCI_setNumStopBits(obj->sciBHandle,SCI_NumStopBits_One);
    SCI_setCharLength(obj->sciBHandle,SCI_CharLength_8_Bits);
    // set baud rate to 115200
    SCI_setBaudRate(obj->sciBHandle,(SCI_BaudRate_e)(0x0061));
    SCI_setPriority(obj->sciBHandle,SCI_Priority_FreeRun);
    SCI_enable(obj->sciBHandle);
    return;
    // end of HAL_setupSciB() function
    }
    
    
    void HAL_enableSciInts(HAL_Handle handle)
    {
    HAL_Obj *obj = (HAL_Obj *)handle;
    // enable the PIE interrupts associated with the SCI interrupts
    // enable SCIB RX interrupt in PIE
    PIE_enableInt(obj->pieHandle,PIE_GroupNumber_9,PIE_InterruptSource_SCIBRX);
    // enable SCI RX interrupts
    // enable SCIB RX interrupt
    SCI_enableRxInt(obj->sciBHandle);
    // enable the cpu interrupt for SCI interrupts
    CPU_enableInt(obj->cpuHandle,CPU_IntNumber_9);
    } // end
    
    
    
    
    
    
    
    
    
    void HAL_cal(HAL_Handle handle)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
    
      // enable the ADC clock
      CLK_enableAdcClock(obj->clkHandle);
    
    
      // Run the Device_cal() function
      // This function copies the ADC and oscillator calibration values from TI reserved
      // OTP into the appropriate trim registers
      // This boot ROM automatically calls this function to calibrate the interal 
      // oscillators and ADC with device specific calibration data.
      // If the boot ROM is bypassed by Code Composer Studio during the development process,
      // then the calibration must be initialized by the application
      ENABLE_PROTECTED_REGISTER_WRITE_MODE;
      (*Device_cal)();
      DISABLE_PROTECTED_REGISTER_WRITE_MODE;
    
      // run offsets calibration in user's memory
      HAL_AdcOffsetSelfCal(handle);
    
      // run oscillator compensation
      HAL_OscTempComp(handle);
    
      // disable the ADC clock
      CLK_disableAdcClock(obj->clkHandle);
    
      return;
    } // end of HAL_cal() function
    
    
    void HAL_OscTempComp(HAL_Handle handle)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
      uint16_t Temperature;
    
      // disable the ADCs
      ADC_disable(obj->adcHandle);
    
      // power up the bandgap circuit
      ADC_enableBandGap(obj->adcHandle);
    
      // set the ADC voltage reference source to internal
      ADC_setVoltRefSrc(obj->adcHandle,ADC_VoltageRefSrc_Int);
    
      // enable the ADC reference buffers
      ADC_enableRefBuffers(obj->adcHandle);
    
      // Set main clock scaling factor (max45MHz clock for the ADC module)
      ADC_setDivideSelect(obj->adcHandle,ADC_DivideSelect_ClkIn_by_2);
    
      // power up the ADCs
      ADC_powerUp(obj->adcHandle);
    
      // enable the ADCs
      ADC_enable(obj->adcHandle);
    
      // enable non-overlap mode
      ADC_enableNoOverlapMode(obj->adcHandle);
    
      // connect channel A5 internally to the temperature sensor
      ADC_setTempSensorSrc(obj->adcHandle, ADC_TempSensorSrc_Int);
    
      // set SOC0 channel select to ADCINA5
      ADC_setSocChanNumber(obj->adcHandle, ADC_SocNumber_0, ADC_SocChanNumber_A5);
    
      // set SOC0 acquisition period to 26 ADCCLK
      ADC_setSocSampleDelay(obj->adcHandle, ADC_SocNumber_0, ADC_SocSampleDelay_64_cycles);
    
      // connect ADCINT1 to EOC0
      ADC_setIntSrc(obj->adcHandle, ADC_IntNumber_1, ADC_IntSrc_EOC0);
    
      // clear ADCINT1 flag
      ADC_clearIntFlag(obj->adcHandle, ADC_IntNumber_1);
    
      // enable ADCINT1
      ADC_enableInt(obj->adcHandle, ADC_IntNumber_1);
    
      // force start of conversion on SOC0
      ADC_setSocFrc(obj->adcHandle, ADC_SocFrc_0);
    
      // wait for end of conversion
      while (ADC_getIntFlag(obj->adcHandle, ADC_IntNumber_1) == 0){}
    
      // clear ADCINT1 flag
      ADC_clearIntFlag(obj->adcHandle, ADC_IntNumber_1);
    
      Temperature = ADC_readResult(obj->adcHandle, ADC_ResultNumber_0);
    
      HAL_osc1Comp(handle, Temperature);
    
      HAL_osc2Comp(handle, Temperature);
    
      return;
    } // end of HAL_OscTempComp() function
    
    
    void HAL_osc1Comp(HAL_Handle handle, const int16_t sensorSample)
    {
    	int16_t compOscFineTrim;
    	HAL_Obj *obj = (HAL_Obj *)handle;
    
    	ENABLE_PROTECTED_REGISTER_WRITE_MODE;
    
        compOscFineTrim = ((sensorSample - getRefTempOffset())*(int32_t)getOsc1FineTrimSlope()
                          + OSC_POSTRIM_OFF + FP_ROUND )/FP_SCALE + getOsc1FineTrimOffset() - OSC_POSTRIM;
    
        if(compOscFineTrim > 31)
          {
            compOscFineTrim = 31;
          }
    	else if(compOscFineTrim < -31)
          {
            compOscFineTrim = -31;
          }
    
        OSC_setTrim(obj->oscHandle, OSC_Number_1, HAL_getOscTrimValue(getOsc1CoarseTrim(), compOscFineTrim));
    
        DISABLE_PROTECTED_REGISTER_WRITE_MODE;
    
        return;
    } // end of HAL_osc1Comp() function
    
    
    void HAL_osc2Comp(HAL_Handle handle, const int16_t sensorSample)
    {
    	int16_t compOscFineTrim;
    	HAL_Obj *obj = (HAL_Obj *)handle;
    
    	ENABLE_PROTECTED_REGISTER_WRITE_MODE;
    
        compOscFineTrim = ((sensorSample - getRefTempOffset())*(int32_t)getOsc2FineTrimSlope()
                          + OSC_POSTRIM_OFF + FP_ROUND )/FP_SCALE + getOsc2FineTrimOffset() - OSC_POSTRIM;
    
        if(compOscFineTrim > 31)
          {
            compOscFineTrim = 31;
          }
    	else if(compOscFineTrim < -31)
          {
            compOscFineTrim = -31;
          }
    
        OSC_setTrim(obj->oscHandle, OSC_Number_2, HAL_getOscTrimValue(getOsc2CoarseTrim(), compOscFineTrim));
    
        DISABLE_PROTECTED_REGISTER_WRITE_MODE;
    
        return;
    } // end of HAL_osc2Comp() function
    
    
    uint16_t HAL_getOscTrimValue(int16_t coarse, int16_t fine)
    {
      uint16_t regValue = 0;
    
      if(fine < 0)
        {
          regValue = ((-fine) | 0x20) << 9;
        }
      else
        {
          regValue = fine << 9;
        }
    
      if(coarse < 0)
        {
          regValue |= ((-coarse) | 0x80);
        }
      else
        {
          regValue |= coarse;
        }
    
      return regValue;
    } // end of HAL_getOscTrimValue() function
    
    
    void HAL_AdcOffsetSelfCal(HAL_Handle handle)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
      uint16_t AdcConvMean;
    
      // disable the ADCs
      ADC_disable(obj->adcHandle);
    
      // power up the bandgap circuit
      ADC_enableBandGap(obj->adcHandle);
    
      // set the ADC voltage reference source to internal
      ADC_setVoltRefSrc(obj->adcHandle,ADC_VoltageRefSrc_Int);
    
      // enable the ADC reference buffers
      ADC_enableRefBuffers(obj->adcHandle);
    
      // power up the ADCs
      ADC_powerUp(obj->adcHandle);
    
      // enable the ADCs
      ADC_enable(obj->adcHandle);
    
      //Select VREFLO internal connection on B5
      ADC_enableVoltRefLoConv(obj->adcHandle);
    
      //Select channel B5 for all SOC
      HAL_AdcCalChanSelect(handle, ADC_SocChanNumber_B5);
    
      //Apply artificial offset (+80) to account for a negative offset that may reside in the ADC core
      ADC_setOffTrim(obj->adcHandle, 80);
    
      //Capture ADC conversion on VREFLO
      AdcConvMean = HAL_AdcCalConversion(handle);
    
      //Set offtrim register with new value (i.e remove artical offset (+80) and create a two's compliment of the offset error)
      ADC_setOffTrim(obj->adcHandle, 80 - AdcConvMean);
    
      //Select external ADCIN5 input pin on B5
      ADC_disableVoltRefLoConv(obj->adcHandle);
    
      return;
    } // end of HAL_AdcOffsetSelfCal() function
    
    
    void HAL_AdcCalChanSelect(HAL_Handle handle, const ADC_SocChanNumber_e chanNumber)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
      ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_0,chanNumber);
      ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_1,chanNumber);
      ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_2,chanNumber);
      ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_3,chanNumber);
      ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_4,chanNumber);
      ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_5,chanNumber);
      ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_6,chanNumber);
      ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_7,chanNumber);
      ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_8,chanNumber);
      ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_9,chanNumber);
      ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_10,chanNumber);
      ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_11,chanNumber);
      ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_12,chanNumber);
      ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_13,chanNumber);
      ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_14,chanNumber);
      ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_15,chanNumber);
    
      return;
    } // end of HAL_AdcCalChanSelect() function
    
    
    uint16_t HAL_AdcCalConversion(HAL_Handle handle)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
      uint16_t index, SampleSize, Mean;
      uint32_t Sum;
      ADC_SocSampleDelay_e ACQPS_Value;
    
      index       = 0;     //initialize index to 0
      SampleSize  = 256;   //set sample size to 256 (**NOTE: Sample size must be multiples of 2^x where is an integer >= 4)
      Sum         = 0;     //set sum to 0
      Mean        = 999;   //initialize mean to known value
    
      //Set the ADC sample window to the desired value (Sample window = ACQPS + 1)
      ACQPS_Value = ADC_SocSampleDelay_7_cycles;
    
      ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_0,ACQPS_Value);
      ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_1,ACQPS_Value);
      ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_2,ACQPS_Value);
      ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_3,ACQPS_Value);
      ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_4,ACQPS_Value);
      ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_5,ACQPS_Value);
      ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_6,ACQPS_Value);
      ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_7,ACQPS_Value);
      ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_8,ACQPS_Value);
      ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_9,ACQPS_Value);
      ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_10,ACQPS_Value);
      ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_11,ACQPS_Value);
      ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_12,ACQPS_Value);
      ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_13,ACQPS_Value);
      ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_14,ACQPS_Value);
      ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_15,ACQPS_Value);
    
      // Enabled ADCINT1 and ADCINT2
      ADC_enableInt(obj->adcHandle, ADC_IntNumber_1);
      ADC_enableInt(obj->adcHandle, ADC_IntNumber_2);
    
      // Disable continuous sampling for ADCINT1 and ADCINT2
      ADC_setIntMode(obj->adcHandle, ADC_IntNumber_1, ADC_IntMode_EOC);
      ADC_setIntMode(obj->adcHandle, ADC_IntNumber_2, ADC_IntMode_EOC);
    
      //ADCINTs trigger at end of conversion
      ADC_setIntPulseGenMode(obj->adcHandle, ADC_IntPulseGenMode_Prior);
    
      // Setup ADCINT1 and ADCINT2 trigger source
      ADC_setIntSrc(obj->adcHandle, ADC_IntNumber_1, ADC_IntSrc_EOC6);
      ADC_setIntSrc(obj->adcHandle, ADC_IntNumber_2, ADC_IntSrc_EOC14);
    
      // Setup each SOC's ADCINT trigger source
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_0, ADC_Int2TriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_1, ADC_Int2TriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_2, ADC_Int2TriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_3, ADC_Int2TriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_4, ADC_Int2TriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_5, ADC_Int2TriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_6, ADC_Int2TriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_7, ADC_Int2TriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_8, ADC_Int1TriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_9, ADC_Int1TriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_10, ADC_Int1TriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_11, ADC_Int1TriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_12, ADC_Int1TriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_13, ADC_Int1TriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_14, ADC_Int1TriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_15, ADC_Int1TriggersSOC);
    
      // Delay before converting ADC channels
      usDelay(US_TO_CNT(ADC_DELAY_usec));
    
      ADC_setSocFrcWord(obj->adcHandle, 0x00FF);
    
      while( index < SampleSize )
        {
          //Wait for ADCINT1 to trigger, then add ADCRESULT0-7 registers to sum
          while (ADC_getIntFlag(obj->adcHandle, ADC_IntNumber_1) == 0){}
    
          //Must clear ADCINT1 flag since INT1CONT = 0
          ADC_clearIntFlag(obj->adcHandle, ADC_IntNumber_1);
    
          Sum += ADC_readResult(obj->adcHandle, ADC_ResultNumber_0);
          Sum += ADC_readResult(obj->adcHandle, ADC_ResultNumber_1);
          Sum += ADC_readResult(obj->adcHandle, ADC_ResultNumber_2);
          Sum += ADC_readResult(obj->adcHandle, ADC_ResultNumber_3);
          Sum += ADC_readResult(obj->adcHandle, ADC_ResultNumber_4);
          Sum += ADC_readResult(obj->adcHandle, ADC_ResultNumber_5);
          Sum += ADC_readResult(obj->adcHandle, ADC_ResultNumber_6);
          Sum += ADC_readResult(obj->adcHandle, ADC_ResultNumber_7);
    
          //Wait for ADCINT2 to trigger, then add ADCRESULT8-15 registers to sum
          while (ADC_getIntFlag(obj->adcHandle, ADC_IntNumber_2) == 0){}
    
          //Must clear ADCINT2 flag since INT2CONT = 0
          ADC_clearIntFlag(obj->adcHandle, ADC_IntNumber_2);
    
          Sum += ADC_readResult(obj->adcHandle, ADC_ResultNumber_8);
          Sum += ADC_readResult(obj->adcHandle, ADC_ResultNumber_9);
          Sum += ADC_readResult(obj->adcHandle, ADC_ResultNumber_10);
          Sum += ADC_readResult(obj->adcHandle, ADC_ResultNumber_11);
          Sum += ADC_readResult(obj->adcHandle, ADC_ResultNumber_12);
          Sum += ADC_readResult(obj->adcHandle, ADC_ResultNumber_13);
          Sum += ADC_readResult(obj->adcHandle, ADC_ResultNumber_14);
          Sum += ADC_readResult(obj->adcHandle, ADC_ResultNumber_15);
    
          index+=16;
    
      } // end data collection
    
      //Disable ADCINT1 and ADCINT2 to STOP the ping-pong sampling
      ADC_disableInt(obj->adcHandle, ADC_IntNumber_1);
      ADC_disableInt(obj->adcHandle, ADC_IntNumber_2);
    
      //Calculate average ADC sample value
      Mean = Sum / SampleSize;
    
      // Clear start of conversion trigger
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_0, ADC_NoIntTriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_1, ADC_NoIntTriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_2, ADC_NoIntTriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_3, ADC_NoIntTriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_4, ADC_NoIntTriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_5, ADC_NoIntTriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_6, ADC_NoIntTriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_7, ADC_NoIntTriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_8, ADC_NoIntTriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_9, ADC_NoIntTriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_10, ADC_NoIntTriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_11, ADC_NoIntTriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_12, ADC_NoIntTriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_13, ADC_NoIntTriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_14, ADC_NoIntTriggersSOC);
      ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_15, ADC_NoIntTriggersSOC);
    
      //return the average
      return(Mean);
    } // end of HAL_AdcCalConversion() function
    
    
    void HAL_disableWdog(HAL_Handle halHandle)
    {
      HAL_Obj *hal = (HAL_Obj *)halHandle;
    
    
      WDOG_disable(hal->wdogHandle);
    
    
      return;
    } // end of HAL_disableWdog() function
    
    
    void HAL_disableGlobalInts(HAL_Handle handle)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
    
      CPU_disableGlobalInts(obj->cpuHandle);
    
      return;
    } // end of HAL_disableGlobalInts() function
    
    
    void HAL_enableAdcInts(HAL_Handle handle)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
    
      // enable the PIE interrupts associated with the ADC interrupts
      PIE_enableAdcInt(obj->pieHandle,ADC_IntNumber_1);
    
    
      // enable the ADC interrupts
      ADC_enableInt(obj->adcHandle,ADC_IntNumber_1);
    
    
      // enable the cpu interrupt for ADC interrupts
     // CPU_enableInt(obj->cpuHandle,CPU_IntNumber_10);
      CPU_enableInt(obj->cpuHandle,CPU_IntNumber_1);
    
      return;
    } // end of HAL_enableAdcInts() function
    
    
    void HAL_enableDebugInt(HAL_Handle handle)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
    
      CPU_enableDebugInt(obj->cpuHandle);
    
      return;
    } // end of HAL_enableDebugInt() function
    
    
    void HAL_enableDrv(HAL_Handle handle)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
      DRV8301_enable(obj->drv8301Handle);
    
      return;
    }  // end of HAL_enableDrv() function
    
    
    void HAL_enableGlobalInts(HAL_Handle handle)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
    
      CPU_enableGlobalInts(obj->cpuHandle);
    
      return;
    } // end of HAL_enableGlobalInts() function
    
    
    void HAL_enablePwmInt(HAL_Handle handle)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
    
      PIE_enablePwmInt(obj->pieHandle,PWM_Number_1);
    
    
      // enable the interrupt
      PWM_enableInt(obj->pwmHandle[PWM_Number_1]);
    
    
      // enable the cpu interrupt for EPWM1_INT
      CPU_enableInt(obj->cpuHandle,CPU_IntNumber_3);
    
      return;
    } // end of HAL_enablePwmInt() function
    
    
    void HAL_setupFaults(HAL_Handle handle)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
      uint_least8_t cnt;
    
    
      // Configure Trip Mechanism for the Motor control software
      // -Cycle by cycle trip on CPU halt
      // -One shot fault trip zone
      // These trips need to be repeated for EPWM1 ,2 & 3
      for(cnt=0;cnt<3;cnt++)
        {
          PWM_enableTripZoneSrc(obj->pwmHandle[cnt],PWM_TripZoneSrc_CycleByCycle_TZ6_NOT);
    
          PWM_enableTripZoneSrc(obj->pwmHandle[cnt],PWM_TripZoneSrc_CycleByCycle_TZ3_NOT);
    
          PWM_enableTripZoneSrc(obj->pwmHandle[cnt],PWM_TripZoneSrc_CycleByCycle_TZ2_NOT);
    
          // What do we want the OST/CBC events to do?
          // TZA events can force EPWMxA
          // TZB events can force EPWMxB
    
          PWM_setTripZoneState_TZA(obj->pwmHandle[cnt],PWM_TripZoneState_EPWM_Low);
          PWM_setTripZoneState_TZB(obj->pwmHandle[cnt],PWM_TripZoneState_EPWM_Low);
        }
    
      return;
    } // end of HAL_setupFaults() function
    
    
    HAL_Handle HAL_init(void *pMemory,const size_t numBytes)
    {
      uint_least8_t cnt;
      HAL_Handle handle;
      HAL_Obj *obj;
    
    
      if(numBytes < sizeof(HAL_Obj))
        return((HAL_Handle)NULL);
    
    
    
    
      // assign the handle
      handle = (HAL_Handle)pMemory;
    
    
      // assign the object
      obj = (HAL_Obj *)handle;
    
    
      //initialize the SCI Handle
    
      obj->sciAHandle =SCI_init((void *)SCIA_BASE_ADDER, sizeof(SCI_Obj));
      obj->sciBHandle =SCI_init((void *)SCIB_BASE_ADDER, sizeof(SCI_Obj));
    
    
    
      // initialize the watchdog driver
      obj->wdogHandle = WDOG_init((void *)WDOG_BASE_ADDR,sizeof(WDOG_Obj));
    
    
      // disable watchdog
      HAL_disableWdog(handle);
    
    
      // initialize the ADC
      obj->adcHandle = ADC_init((void *)ADC_BASE_ADDR,sizeof(ADC_Obj));
    
    
      // initialize the clock handle
      obj->clkHandle = CLK_init((void *)CLK_BASE_ADDR,sizeof(CLK_Obj));
    
    
      // initialize the CPU handle
      obj->cpuHandle = CPU_init(&cpu,sizeof(cpu));
    
    
      // initialize the FLASH handle
      obj->flashHandle = FLASH_init((void *)FLASH_BASE_ADDR,sizeof(FLASH_Obj));
    
    
      // initialize the GPIO handle
      obj->gpioHandle = GPIO_init((void *)GPIO_BASE_ADDR,sizeof(GPIO_Obj));
    
    
      // initialize the current offset estimator handles
      for(cnt=0;cnt<USER_NUM_CURRENT_SENSORS;cnt++)
        {
          obj->offsetHandle_I[cnt] = OFFSET_init(&obj->offset_I[cnt],sizeof(obj->offset_I[cnt]));
        }
    
    
      // initialize the voltage offset estimator handles
      for(cnt=0;cnt<USER_NUM_VOLTAGE_SENSORS;cnt++)
        {
          obj->offsetHandle_V[cnt] = OFFSET_init(&obj->offset_V[cnt],sizeof(obj->offset_V[cnt]));
        }
    
    
      // initialize the oscillator handle
      obj->oscHandle = OSC_init((void *)OSC_BASE_ADDR,sizeof(OSC_Obj));
    
    
      // initialize the PIE handle
      obj->pieHandle = PIE_init((void *)PIE_BASE_ADDR,sizeof(PIE_Obj));
    
    
      // initialize the PLL handle
      obj->pllHandle = PLL_init((void *)PLL_BASE_ADDR,sizeof(PLL_Obj));
    
    
      // initialize the SPIA handle
      obj->spiAHandle = SPI_init((void *)SPIA_BASE_ADDR,sizeof(SPI_Obj));
    
    
      // initialize PWM handles
      obj->pwmHandle[0] = PWM_init((void *)PWM_ePWM1_BASE_ADDR,sizeof(PWM_Obj));
      obj->pwmHandle[1] = PWM_init((void *)PWM_ePWM2_BASE_ADDR,sizeof(PWM_Obj));
      obj->pwmHandle[2] = PWM_init((void *)PWM_ePWM3_BASE_ADDR,sizeof(PWM_Obj));
    
    
      // initialize power handle
      obj->pwrHandle = PWR_init((void *)PWR_BASE_ADDR,sizeof(PWR_Obj));
    
    
      // initialize timer handles
      obj->timerHandle[0] = TIMER_init((void *)TIMER0_BASE_ADDR,sizeof(TIMER_Obj));
      obj->timerHandle[1] = TIMER_init((void *)TIMER1_BASE_ADDR,sizeof(TIMER_Obj));
      obj->timerHandle[2] = TIMER_init((void *)TIMER2_BASE_ADDR,sizeof(TIMER_Obj));
    
    
      // initialize drv8301 interface
      obj->drv8301Handle = DRV8301_init(&obj->drv8301,sizeof(obj->drv8301));
    
      return(handle);
    } // end of HAL_init() function
    
    
    void HAL_setParams(HAL_Handle handle,const USER_Params *pUserParams)
    {
      uint_least8_t cnt;
      HAL_Obj *obj = (HAL_Obj *)handle;
      _iq beta_lp_pu = _IQ(pUserParams->offsetPole_rps/(float_t)pUserParams->ctrlFreq_Hz);
    
    
      HAL_setupSciA(handle);
      HAL_setupSciB(handle);
    
    
      HAL_setNumCurrentSensors(handle,pUserParams->numCurrentSensors);
      HAL_setNumVoltageSensors(handle,pUserParams->numVoltageSensors);
    
    
      for(cnt=0;cnt<HAL_getNumCurrentSensors(handle);cnt++)
        {
          HAL_setOffsetBeta_lp_pu(handle,HAL_SensorType_Current,cnt,beta_lp_pu);
          HAL_setOffsetInitCond(handle,HAL_SensorType_Current,cnt,_IQ(0.0));
          HAL_setOffsetValue(handle,HAL_SensorType_Current,cnt,_IQ(0.0));
        }
    
    
      for(cnt=0;cnt<HAL_getNumVoltageSensors(handle);cnt++)
        {
          HAL_setOffsetBeta_lp_pu(handle,HAL_SensorType_Voltage,cnt,beta_lp_pu);
          HAL_setOffsetInitCond(handle,HAL_SensorType_Voltage,cnt,_IQ(0.0));
          HAL_setOffsetValue(handle,HAL_SensorType_Voltage,cnt,_IQ(0.0));
        }
    
    
      // disable global interrupts
      CPU_disableGlobalInts(obj->cpuHandle);
    
    
      // disable cpu interrupts
      CPU_disableInts(obj->cpuHandle);
    
    
      // clear cpu interrupt flags
      CPU_clearIntFlags(obj->cpuHandle);
    
    
      // setup the clocks
      HAL_setupClks(handle);
    
    
      // Setup the PLL
      HAL_setupPll(handle,PLL_ClkFreq_60_MHz);
    
    
      // setup the PIE
      HAL_setupPie(handle);
    
    
      // run the device calibration
      HAL_cal(handle);
    
    
      // setup the peripheral clocks
      HAL_setupPeripheralClks(handle);
    
    
      // setup the GPIOs
      HAL_setupGpios(handle);
    
    
      // setup the flash
      HAL_setupFlash(handle);
    
    
      // setup the ADCs
      HAL_setupAdcs(handle);
    
    
      // setup the PWMs
      HAL_setupPwms(handle,
                    (float_t)pUserParams->systemFreq_MHz,
                    pUserParams->pwmPeriod_usec,
                    USER_NUM_PWM_TICKS_PER_ISR_TICK);
    
    
      // setup the spiA
      HAL_setupSpiA(handle);
    
    
      // setup the timers
      HAL_setupTimers(handle,
                      (float_t)pUserParams->systemFreq_MHz);
    
    
      // setup the drv8301 interface
      HAL_setupGate(handle);
    
    
      // set the default current bias
     {
       uint_least8_t cnt;
       _iq bias = _IQ12mpy(ADC_dataBias,_IQ(pUserParams->current_sf));
       
       for(cnt=0;cnt<HAL_getNumCurrentSensors(handle);cnt++)
         {
           HAL_setBias(handle,HAL_SensorType_Current,cnt,bias);
         }
     }
    
    
      //  set the current scale factor
     {
       _iq current_sf = _IQ(pUserParams->current_sf);
    
      HAL_setCurrentScaleFactor(handle,current_sf);
     }
    
    
      // set the default voltage bias
     {
       uint_least8_t cnt;
       _iq bias = _IQ(0.0);
       
       for(cnt=0;cnt<HAL_getNumVoltageSensors(handle);cnt++)
         {
           HAL_setBias(handle,HAL_SensorType_Voltage,cnt,bias);
         }
     }
    
    
      //  set the voltage scale factor
     {
       _iq voltage_sf = _IQ(pUserParams->voltage_sf);
    
      HAL_setVoltageScaleFactor(handle,voltage_sf);
     }
    
     return;
    } // end of HAL_setParams() function
    
    
    void HAL_setupAdcs(HAL_Handle handle)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
    
      // disable the ADCs
      ADC_disable(obj->adcHandle);
    
    
      // power up the bandgap circuit
      ADC_enableBandGap(obj->adcHandle);
    
    
      // set the ADC voltage reference source to internal 
      ADC_setVoltRefSrc(obj->adcHandle,ADC_VoltageRefSrc_Int);
    
    
      // enable the ADC reference buffers
      ADC_enableRefBuffers(obj->adcHandle);
    
    
      // power up the ADCs
      ADC_powerUp(obj->adcHandle);
    
    
      // enable the ADCs
      ADC_enable(obj->adcHandle);
    
    
      // set the ADC interrupt pulse generation to prior
      ADC_setIntPulseGenMode(obj->adcHandle,ADC_IntPulseGenMode_Prior);
    
    
      // set the temperature sensor source to external
      ADC_setTempSensorSrc(obj->adcHandle,ADC_TempSensorSrc_Ext);
    
    
      // configure the interrupt sources
      ADC_disableInt(obj->adcHandle,ADC_IntNumber_1);
      ADC_setIntMode(obj->adcHandle,ADC_IntNumber_1,ADC_IntMode_ClearFlag);
      ADC_setIntSrc(obj->adcHandle,ADC_IntNumber_1,ADC_IntSrc_EOC7);
    
    
      //configure the SOCs for drv8301nxfet_revB
      // sample the first sample twice due to errata sprz342f
      ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_0,ADC_SocChanNumber_B1);
      ADC_setSocTrigSrc(obj->adcHandle,ADC_SocNumber_0,ADC_SocTrigSrc_EPWM1_ADCSOCA);
      ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_0,ADC_SocSampleDelay_7_cycles);
    
      ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_1,ADC_SocChanNumber_B1);
      ADC_setSocTrigSrc(obj->adcHandle,ADC_SocNumber_1,ADC_SocTrigSrc_EPWM1_ADCSOCA);
      ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_1,ADC_SocSampleDelay_7_cycles);
    
      ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_2,ADC_SocChanNumber_B3);
      ADC_setSocTrigSrc(obj->adcHandle,ADC_SocNumber_2,ADC_SocTrigSrc_EPWM1_ADCSOCA);
      ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_2,ADC_SocSampleDelay_7_cycles);
    
      ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_3,ADC_SocChanNumber_B7);
      ADC_setSocTrigSrc(obj->adcHandle,ADC_SocNumber_3,ADC_SocTrigSrc_EPWM1_ADCSOCA);
      ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_3,ADC_SocSampleDelay_7_cycles);
    
      ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_4,ADC_SocChanNumber_A3);
      ADC_setSocTrigSrc(obj->adcHandle,ADC_SocNumber_4,ADC_SocTrigSrc_EPWM1_ADCSOCA);
      ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_4,ADC_SocSampleDelay_7_cycles);
    
      ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_5,ADC_SocChanNumber_A1);
      ADC_setSocTrigSrc(obj->adcHandle,ADC_SocNumber_5,ADC_SocTrigSrc_EPWM1_ADCSOCA);
      ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_5,ADC_SocSampleDelay_7_cycles);
    
      ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_6,ADC_SocChanNumber_A0);
      ADC_setSocTrigSrc(obj->adcHandle,ADC_SocNumber_6,ADC_SocTrigSrc_EPWM1_ADCSOCA);
      ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_6,ADC_SocSampleDelay_7_cycles);
    
      ADC_setSocChanNumber(obj->adcHandle,ADC_SocNumber_7,ADC_SocChanNumber_A7);
      ADC_setSocTrigSrc(obj->adcHandle,ADC_SocNumber_7,ADC_SocTrigSrc_EPWM1_ADCSOCA);
      ADC_setSocSampleDelay(obj->adcHandle,ADC_SocNumber_7,ADC_SocSampleDelay_7_cycles);
    
      return;
    } // end of HAL_setupAdcs() function
    
    
    void HAL_setupClks(HAL_Handle handle)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
    
      // enable internal oscillator 1
      CLK_enableOsc1(obj->clkHandle);
    
      // set the oscillator source
      CLK_setOscSrc(obj->clkHandle,CLK_OscSrc_Internal);
    
      // disable the external clock in
      CLK_disableClkIn(obj->clkHandle);
    
      // disable the crystal oscillator
      CLK_disableCrystalOsc(obj->clkHandle);
    
      // disable oscillator 2
      CLK_disableOsc2(obj->clkHandle);
    
      // set the low speed clock prescaler
      CLK_setLowSpdPreScaler(obj->clkHandle,CLK_LowSpdPreScaler_SysClkOut_by_1);
    
      // set the clock out prescaler
      CLK_setClkOutPreScaler(obj->clkHandle,CLK_ClkOutPreScaler_SysClkOut_by_1);
    
      return;
    } // end of HAL_setupClks() function
    
    
    void HAL_setupFlash(HAL_Handle handle)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
    
      FLASH_enablePipelineMode(obj->flashHandle);
    
      FLASH_setNumPagedReadWaitStates(obj->flashHandle,FLASH_NumPagedWaitStates_2);
    
      FLASH_setNumRandomReadWaitStates(obj->flashHandle,FLASH_NumRandomWaitStates_2);
    
      FLASH_setOtpWaitStates(obj->flashHandle,FLASH_NumOtpWaitStates_3);
    
      FLASH_setStandbyWaitCount(obj->flashHandle,FLASH_STANDBY_WAIT_COUNT_DEFAULT);
    
      FLASH_setActiveWaitCount(obj->flashHandle,FLASH_ACTIVE_WAIT_COUNT_DEFAULT);
    
      return;
    } // HAL_setupFlash() function
    
    
    void HAL_setupGate(HAL_Handle handle)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
      DRV8301_setSpiHandle(obj->drv8301Handle,obj->spiAHandle);
      DRV8301_setGpioHandle(obj->drv8301Handle,obj->gpioHandle);
      DRV8301_setGpioNumber(obj->drv8301Handle,GPIO_Number_6);
    } // HAL_setupGate() function
    
    
    void HAL_setupGpios(HAL_Handle handle)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
    
      // PWM1
      GPIO_setMode(obj->gpioHandle,GPIO_Number_0,GPIO_0_Mode_EPWM1A);
    
      // PWM2
      GPIO_setMode(obj->gpioHandle,GPIO_Number_1,GPIO_1_Mode_EPWM1B);
    
      // PWM3
      GPIO_setMode(obj->gpioHandle,GPIO_Number_2,GPIO_2_Mode_EPWM2A);
    
      // PWM4
      GPIO_setMode(obj->gpioHandle,GPIO_Number_3,GPIO_3_Mode_EPWM2B);
    
      // PWM5
      GPIO_setMode(obj->gpioHandle,GPIO_Number_4,GPIO_4_Mode_EPWM3A);
    
      // PWM6
      GPIO_setMode(obj->gpioHandle,GPIO_Number_5,GPIO_5_Mode_EPWM3B);
    
      // EN_GATE
      GPIO_setMode(obj->gpioHandle,GPIO_Number_6,GPIO_6_Mode_GeneralPurpose);
      GPIO_setLow(obj->gpioHandle,GPIO_Number_6);
      GPIO_setDirection(obj->gpioHandle,GPIO_Number_6,GPIO_Direction_Output);
      
      // DC_CAL
      GPIO_setMode(obj->gpioHandle,GPIO_Number_7,GPIO_7_Mode_GeneralPurpose);
    
      // No Connection
      GPIO_setMode(obj->gpioHandle,GPIO_Number_12,GPIO_12_Mode_GeneralPurpose);
      GPIO_setDirection(obj->gpioHandle,GPIO_Number_12,GPIO_Direction_Input);
      GPIO_setPullUp(obj->gpioHandle,GPIO_Number_12,GPIO_PullUp_Disable);
    
      // SPI_SDI if JP4 is soldered, No Connection if JP4 is not soldered
      GPIO_setMode(obj->gpioHandle,GPIO_Number_16,GPIO_16_Mode_SPISIMOA);
    
      // SPI_SDO if JP6 is soldered, No Connection if JP6 is not soldered
      GPIO_setMode(obj->gpioHandle,GPIO_Number_17,GPIO_17_Mode_SPISOMIA);
    
      // SPI_CLK
      GPIO_setMode(obj->gpioHandle,GPIO_Number_18,GPIO_18_Mode_SPICLKA);
    
      // SPI_SCS
      GPIO_setMode(obj->gpioHandle,GPIO_Number_19,GPIO_19_Mode_SPISTEA_NOT);
    
      // FAULTn
      GPIO_setMode(obj->gpioHandle,GPIO_Number_28,GPIO_28_Mode_TZ2_NOT);
    
      // OCTWn
      GPIO_setMode(obj->gpioHandle,GPIO_Number_29,GPIO_29_Mode_TZ3_NOT);
    
      // SPI_SDI if JP5 is soldered, No Connection if JP5 is not soldered
      GPIO_setMode(obj->gpioHandle,GPIO_Number_32,GPIO_32_Mode_GeneralPurpose);
    
      // SPI_SDO if JP7 is soldered, No Connection if JP7 is not soldered
      GPIO_setMode(obj->gpioHandle,GPIO_Number_33,GPIO_33_Mode_GeneralPurpose);
    
      // No Connection
      GPIO_setMode(obj->gpioHandle,GPIO_Number_34,GPIO_34_Mode_GeneralPurpose);
    
      // JTAG
      GPIO_setMode(obj->gpioHandle,GPIO_Number_35,GPIO_35_Mode_JTAG_TDI);
      GPIO_setMode(obj->gpioHandle,GPIO_Number_36,GPIO_36_Mode_JTAG_TMS);
      GPIO_setMode(obj->gpioHandle,GPIO_Number_37,GPIO_37_Mode_JTAG_TDO);
      GPIO_setMode(obj->gpioHandle,GPIO_Number_38,GPIO_38_Mode_JTAG_TCK);
    
    
      GPIO_setMode(obj->gpioHandle,GPIO_Number_28,GPIO_28_Mode_SCIRXDB);
      GPIO_setMode(obj->gpioHandle,GPIO_Number_29,GPIO_29_Mode_SCITXDB);
    
    
      return;
    }  // end of HAL_setupGpios() function
    
    
    void HAL_setupLaunchPadGpio0and1(HAL_Handle handle)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
      // GPIO 0 (LED 2 on the LaunchPad)
      // Since the LaunchPad uses the same GPIO pins for LEDs as PWM pins,
      // the GPIO 0 and 1 are setup outside of the HAL file.
      GPIO_setMode(obj->gpioHandle,GPIO_Number_0,GPIO_0_Mode_GeneralPurpose);
      GPIO_setLow(obj->gpioHandle,GPIO_Number_0);
      GPIO_setDirection(obj->gpioHandle,GPIO_Number_0,GPIO_Direction_Output);
    
      // GPIO 1 (LED 4 on the LaunchPad)
      // Since the LaunchPad uses the same GPIO pins for LEDs as PWM pins,
      // the GPIO 0 and 1 are setup outside of the HAL file.  GPIO 1 will be
      // kept low so that there is no possibility of shoot-through conduction
      // with the high side switch that is controlled by GPIO0.
      GPIO_setMode(obj->gpioHandle,GPIO_Number_1,GPIO_1_Mode_GeneralPurpose);
      GPIO_setLow(obj->gpioHandle,GPIO_Number_1);
      GPIO_setDirection(obj->gpioHandle,GPIO_Number_1,GPIO_Direction_Output);
    
      return;
    }  // end of HAL_setupGpios() function
    
    
    void HAL_setupPie(HAL_Handle handle)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
    
      PIE_disable(obj->pieHandle);
    
      PIE_disableAllInts(obj->pieHandle);
    
      PIE_clearAllInts(obj->pieHandle);
    
      PIE_clearAllFlags(obj->pieHandle);
    
      PIE_setDefaultIntVectorTable(obj->pieHandle);
    
      PIE_enable(obj->pieHandle);
    
      return;
    } // end of HAL_setupPie() function
    
    
    void HAL_setupPeripheralClks(HAL_Handle handle)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
    
      CLK_enableAdcClock(obj->clkHandle);
    
      CLK_enableCompClock(obj->clkHandle,CLK_CompNumber_1);
      CLK_enableCompClock(obj->clkHandle,CLK_CompNumber_2);
      CLK_enableCompClock(obj->clkHandle,CLK_CompNumber_3);
    
      CLK_enableEcap1Clock(obj->clkHandle);
    
      CLK_enablePwmClock(obj->clkHandle,PWM_Number_1);
      CLK_enablePwmClock(obj->clkHandle,PWM_Number_2);
      CLK_enablePwmClock(obj->clkHandle,PWM_Number_3);
      CLK_enablePwmClock(obj->clkHandle,PWM_Number_4);
    
      CLK_disableHrPwmClock(obj->clkHandle);
    
      CLK_disableI2cClock(obj->clkHandle);
    
      CLK_enableSciaClock(obj->clkHandle);
    
      CLK_enableScibClock(obj->clkHandle);
    
      CLK_enableSpiaClock(obj->clkHandle);
      
      CLK_enableTbClockSync(obj->clkHandle);
    
      return;
    } // end of HAL_setupPeripheralClks() function
    
    
    void HAL_setupPll(HAL_Handle handle,const PLL_ClkFreq_e clkFreq)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
    
      // make sure PLL is not running in limp mode
      if(PLL_getClkStatus(obj->pllHandle) != PLL_ClkStatus_Normal)
        {
          // reset the clock detect
          PLL_resetClkDetect(obj->pllHandle);
    
          // ???????
          asm("        ESTOP0");
        }
    
    
      // Divide Select must be ClkIn/4 before the clock rate can be changed
      if(PLL_getDivideSelect(obj->pllHandle) != PLL_DivideSelect_ClkIn_by_4)
        {
          PLL_setDivideSelect(obj->pllHandle,PLL_DivideSelect_ClkIn_by_4);
        }
    
    
      if(PLL_getClkFreq(obj->pllHandle) != clkFreq)
        {
          // disable the clock detect
          PLL_disableClkDetect(obj->pllHandle);
    
          // set the clock rate
          PLL_setClkFreq(obj->pllHandle,clkFreq);
        }
    
    
      // wait until locked
      while(PLL_getLockStatus(obj->pllHandle) != PLL_LockStatus_Done) {}
    
    
      // enable the clock detect
      PLL_enableClkDetect(obj->pllHandle);
    
    
      // set divide select to ClkIn/2 to get desired clock rate
      // NOTE: clock must be locked before setting this register
      PLL_setDivideSelect(obj->pllHandle,PLL_DivideSelect_ClkIn_by_2);
    
      return;
    } // end of HAL_setupPll() function
    
    
    void HAL_setupPwms(HAL_Handle handle,
                       const float_t systemFreq_MHz,
                       const float_t pwmPeriod_usec,
                       const uint_least16_t numPwmTicksPerIsrTick)
    {
      HAL_Obj   *obj = (HAL_Obj *)handle;
      uint16_t   halfPeriod_cycles = (uint16_t)(systemFreq_MHz*pwmPeriod_usec) >> 1;
      uint_least8_t    cnt;
    
    
      // turns off the outputs of the EPWM peripherals which will put the power switches
      // into a high impedance state.
      PWM_setOneShotTrip(obj->pwmHandle[PWM_Number_1]);
      PWM_setOneShotTrip(obj->pwmHandle[PWM_Number_2]);
      PWM_setOneShotTrip(obj->pwmHandle[PWM_Number_3]);
      // first step to synchronize the pwms
      CLK_disableTbClockSync(obj->clkHandle);
    
      for(cnt=0;cnt<3;cnt++)
        {
          // setup the Time-Base Control Register (TBCTL)
          PWM_setCounterMode(obj->pwmHandle[cnt],PWM_CounterMode_UpDown);
          PWM_disableCounterLoad(obj->pwmHandle[cnt]);
          PWM_setPeriodLoad(obj->pwmHandle[cnt],PWM_PeriodLoad_Immediate);
          PWM_setSyncMode(obj->pwmHandle[cnt],PWM_SyncMode_EPWMxSYNC);
          PWM_setHighSpeedClkDiv(obj->pwmHandle[cnt],PWM_HspClkDiv_by_1);
          PWM_setClkDiv(obj->pwmHandle[cnt],PWM_ClkDiv_by_1);
          PWM_setPhaseDir(obj->pwmHandle[cnt],PWM_PhaseDir_CountUp);
          PWM_setRunMode(obj->pwmHandle[cnt],PWM_RunMode_FreeRun);
    
          // setup the Timer-Based Phase Register (TBPHS)
          PWM_setPhase(obj->pwmHandle[cnt],0);
    
          // setup the Time-Base Counter Register (TBCTR)
          PWM_setCount(obj->pwmHandle[cnt],0);
    
          // setup the Time-Base Period Register (TBPRD)
          // set to zero initially
          PWM_setPeriod(obj->pwmHandle[cnt],0);
    
          // setup the Counter-Compare Control Register (CMPCTL)
          PWM_setLoadMode_CmpA(obj->pwmHandle[cnt],PWM_LoadMode_Zero);
          PWM_setLoadMode_CmpB(obj->pwmHandle[cnt],PWM_LoadMode_Zero);
          PWM_setShadowMode_CmpA(obj->pwmHandle[cnt],PWM_ShadowMode_Shadow);
          PWM_setShadowMode_CmpB(obj->pwmHandle[cnt],PWM_ShadowMode_Immediate);
    
          // setup the Action-Qualifier Output A Register (AQCTLA) 
          PWM_setActionQual_CntUp_CmpA_PwmA(obj->pwmHandle[cnt],PWM_ActionQual_Set);
          PWM_setActionQual_CntDown_CmpA_PwmA(obj->pwmHandle[cnt],PWM_ActionQual_Clear);
    
          // setup the Dead-Band Generator Control Register (DBCTL)
          PWM_setDeadBandOutputMode(obj->pwmHandle[cnt],PWM_DeadBandOutputMode_EPWMxA_Rising_EPWMxB_Falling);
          PWM_setDeadBandPolarity(obj->pwmHandle[cnt],PWM_DeadBandPolarity_EPWMxB_Inverted);
    
          // setup the Dead-Band Rising Edge Delay Register (DBRED)
          PWM_setDeadBandRisingEdgeDelay(obj->pwmHandle[cnt],HAL_PWM_DBRED_CNT);
    
          // setup the Dead-Band Falling Edge Delay Register (DBFED)
          PWM_setDeadBandFallingEdgeDelay(obj->pwmHandle[cnt],HAL_PWM_DBFED_CNT);
          // setup the PWM-Chopper Control Register (PCCTL)
          PWM_disableChopping(obj->pwmHandle[cnt]);
    
          // setup the Trip Zone Select Register (TZSEL)
          PWM_disableTripZones(obj->pwmHandle[cnt]);
        }
    
    
      // setup the Event Trigger Selection Register (ETSEL)
      PWM_disableInt(obj->pwmHandle[PWM_Number_1]);
      PWM_setSocAPulseSrc(obj->pwmHandle[PWM_Number_1],PWM_SocPulseSrc_CounterEqualZero);
      PWM_enableSocAPulse(obj->pwmHandle[PWM_Number_1]);
      
    
      // setup the Event Trigger Prescale Register (ETPS)
      if(numPwmTicksPerIsrTick == 3)
        {
          PWM_setIntPeriod(obj->pwmHandle[PWM_Number_1],PWM_IntPeriod_ThirdEvent);
          PWM_setSocAPeriod(obj->pwmHandle[PWM_Number_1],PWM_SocPeriod_ThirdEvent);
        }
      else if(numPwmTicksPerIsrTick == 2)
        {
          PWM_setIntPeriod(obj->pwmHandle[PWM_Number_1],PWM_IntPeriod_SecondEvent);
          PWM_setSocAPeriod(obj->pwmHandle[PWM_Number_1],PWM_SocPeriod_SecondEvent);
        }
      else
        {
          PWM_setIntPeriod(obj->pwmHandle[PWM_Number_1],PWM_IntPeriod_FirstEvent);
          PWM_setSocAPeriod(obj->pwmHandle[PWM_Number_1],PWM_SocPeriod_FirstEvent);
        }
    
    
      // setup the Event Trigger Clear Register (ETCLR)
      PWM_clearIntFlag(obj->pwmHandle[PWM_Number_1]);
      PWM_clearSocAFlag(obj->pwmHandle[PWM_Number_1]);
    
    
      // since the PWM is configured as an up/down counter, the period register is set to one-half 
      // of the desired PWM period
      PWM_setPeriod(obj->pwmHandle[PWM_Number_1],halfPeriod_cycles);
      PWM_setPeriod(obj->pwmHandle[PWM_Number_2],halfPeriod_cycles);
      PWM_setPeriod(obj->pwmHandle[PWM_Number_3],halfPeriod_cycles);
    
      // last step to synchronize the pwms
      CLK_enableTbClockSync(obj->clkHandle);
    
      return;
    }  // end of HAL_setupPwms() function
    
    
    void HAL_setupSpiA(HAL_Handle handle)
    {
      HAL_Obj   *obj = (HAL_Obj *)handle;
    
      SPI_reset(obj->spiAHandle);
      SPI_setMode(obj->spiAHandle,SPI_Mode_Master);
      SPI_setClkPolarity(obj->spiAHandle,SPI_ClkPolarity_OutputRisingEdge_InputFallingEdge);
      SPI_enableTx(obj->spiAHandle);
      SPI_enableTxFifoEnh(obj->spiAHandle);
      SPI_enableTxFifo(obj->spiAHandle);
      SPI_setTxDelay(obj->spiAHandle,0x0010);
      SPI_setBaudRate(obj->spiAHandle,(SPI_BaudRate_e)(0x000d));
      SPI_setCharLength(obj->spiAHandle,SPI_CharLength_16_Bits);
      SPI_setSuspend(obj->spiAHandle,SPI_TxSuspend_free);
      SPI_enable(obj->spiAHandle);
    
      return;
    }  // end of HAL_setupSpiA() function
    
    
    void HAL_setupTimers(HAL_Handle handle,const float_t systemFreq_MHz)
    {
      HAL_Obj  *obj = (HAL_Obj *)handle;
      uint32_t  timerPeriod_0p5ms = (uint32_t)(systemFreq_MHz * (float_t)500.0) - 1;
      uint32_t  timerPeriod_10ms = (uint32_t)(systemFreq_MHz * (float_t)10000.0) - 1;
    
      // use timer 0 for frequency diagnostics
      TIMER_setDecimationFactor(obj->timerHandle[0],0);
      TIMER_setEmulationMode(obj->timerHandle[0],TIMER_EmulationMode_RunFree);
      TIMER_setPeriod(obj->timerHandle[0],timerPeriod_0p5ms);
      TIMER_setPreScaler(obj->timerHandle[0],0);
    
      // use timer 1 for CPU usage diagnostics
      TIMER_setDecimationFactor(obj->timerHandle[1],0);
      TIMER_setEmulationMode(obj->timerHandle[1],TIMER_EmulationMode_RunFree);
      TIMER_setPeriod(obj->timerHandle[1],timerPeriod_10ms);
      TIMER_setPreScaler(obj->timerHandle[1],0);
    
      // use timer 2 for CPU time diagnostics
      TIMER_setDecimationFactor(obj->timerHandle[2],0);
      TIMER_setEmulationMode(obj->timerHandle[2],TIMER_EmulationMode_RunFree);
      TIMER_setPeriod(obj->timerHandle[2],0xFFFFFFFF);
      TIMER_setPreScaler(obj->timerHandle[2],0);
    
      return;
    }  // end of HAL_setupTimers() function
    
    
    void HAL_writeDrvData(HAL_Handle handle, DRV_SPI_8301_Vars_t *Spi_8301_Vars)
    {
      HAL_Obj  *obj = (HAL_Obj *)handle;
    
      DRV8301_writeData(obj->drv8301Handle,Spi_8301_Vars);
      
      return;
    }  // end of HAL_writeDrvData() function
    
    
    void HAL_readDrvData(HAL_Handle handle, DRV_SPI_8301_Vars_t *Spi_8301_Vars)
    {
      HAL_Obj  *obj = (HAL_Obj *)handle;
    
      DRV8301_readData(obj->drv8301Handle,Spi_8301_Vars);
      
      return;
    }  // end of HAL_readDrvData() function
    
    
    void HAL_setupDrvSpi(HAL_Handle handle, DRV_SPI_8301_Vars_t *Spi_8301_Vars)
    {
      HAL_Obj  *obj = (HAL_Obj *)handle;
    
      DRV8301_setupSpi(obj->drv8301Handle,Spi_8301_Vars);
    
      return;
    }  // end of HAL_setupDrvSpi() function
    
    
    void HAL_setDacParameters(HAL_Handle handle, HAL_DacData_t *pDacData)
    {
    	HAL_Obj *obj = (HAL_Obj *)handle;
    
    	pDacData->PeriodMax = PWMDAC_getPeriod(obj->pwmDacHandle[PWMDAC_Number_1]);
    
    	pDacData->offset[0] = _IQ(0.5);
    	pDacData->offset[1] = _IQ(0.5);
    	pDacData->offset[2] = _IQ(0.0);
    	pDacData->offset[3] = _IQ(0.0);
    
    	pDacData->gain[0] = _IQ(1.0);
    	pDacData->gain[1] = _IQ(1.0);
    	pDacData->gain[2] = _IQ(1.0);
    	pDacData->gain[3] = _IQ(1.0);
    
    	return;
    }	//end of HAL_setDacParameters() function
    
    // end of file
    
    #ifndef _HAL_H_
    #define _HAL_H_
    /* --COPYRIGHT--,BSD
     * Copyright (c) 2012, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     * --/COPYRIGHT--*/
    
    //! \file   solutions/instaspin_foc/boards/boostxldrv8301_revB/f28x/f2802xF/src/hal.h
    //! \brief  Contains public interface to various functions related
    //!         to the HAL object
    //!
    //! (C) Copyright 2011, Texas Instruments, Inc.
    
    
    // **************************************************************************
    // the includes
    
    
    // modules
    
    
    // platforms
    #include "hal_obj.h"
    #include "sw/modules/svgen/src/32b/svgen_current.h"
    
    
    //!
    //!
    //! \defgroup HAL HAL
    //!
    //@{
    
    
    #ifdef __cplusplus
    extern "C" {
    #endif
    
    
    // **************************************************************************
    // the defines
    
    
    
    
    //! \brief Sets up the sciA peripheral
    //! \param[in] handle The hardware abstraction layer (HAL) handle
    extern void HAL_setupSciA(HAL_Handle handle);
    //! \brief Sets up the sciB peripheral
    //! \param[in] handle The hardware abstraction layer (HAL) handle
    extern void HAL_setupSciB(HAL_Handle handle);
    
    //! \brief Enables the SCI interrupts
    //! \details Enables the SCI interrupts in the PIE and CPU. Enables the
    //! interrupt to be sent from the SCI peripheral.
    //! \param[in] handle - the hardware abstraction (HAL) handle
    extern void HAL_enableSciInts(HAL_Handle handle);
    
    extern interrupt void sciBRxISR(void);
    extern interrupt void mainISR(void);
    
    
    
    //! \brief Defines LAUNCHPAD which is needed to blink LED
    #define LAUNCHPAD
    
    
    //! \brief Defines that a DRV8301 chip SPI port is used on the board.
    #define DRV8301_SPI
    
    
    #define Device_cal (void   (*)(void))0x3D7C80
    
    //! \brief Defines used in oscillator calibration functions
    //! \brief Defines the scale factor for Q15 fixed point numbers (2^15)
    #define FP_SCALE 32768
    
    //! \brief Defines the quantity added to Q15 numbers before converting to integer to round the number
    #define FP_ROUND FP_SCALE/2
    
    //! \brief Defines the amount to add to Q16.15 fixed point number to shift from a fine trim range of
    //! \brief (-31 to 31) to (1 to 63).  This guarantees that the trim is positive and can
    //! \brief therefore be efficiently rounded
    #define OSC_POSTRIM 32
    #define OSC_POSTRIM_OFF FP_SCALE*OSC_POSTRIM
    
    //! \brief The following functions return reference values stored in OTP.
    
    //! \brief Defines the slope used to compensate oscillator 1 (fine trim steps / ADC code). Stored in fixed point Q15 format
    #define getOsc1FineTrimSlope() (*(int16_t (*)(void))0x3D7E90)()
    
    //! \brief Defines the oscillator 1 fine trim at high temp
    #define getOsc1FineTrimOffset() (*(int16_t (*)(void))0x3D7E93)()
    
    //! \brief Defines the oscillator 1 coarse trim
    #define getOsc1CoarseTrim() (*(int16_t (*)(void))0x3D7E96)()
    
    //! \brief Defines the slope used to compensate oscillator 2 (fine trim steps / ADC code). Stored
    //! \brief in fixed point Q15 format.
    #define getOsc2FineTrimSlope() (*(int16_t (*)(void))0x3D7E99)()
    
    //! \brief Defines the oscillator 2 fine trim at high temp
    #define getOsc2FineTrimOffset() (*(int16_t (*)(void))0x3D7E9C)()
    
    //! \brief Defines the oscillator 2 coarse trim
    #define getOsc2CoarseTrim() (*(int16_t (*)(void))0x3D7E9F)()
    
    //! \brief Defines the ADC reading of temperature sensor at reference temperature for compensation
    #define getRefTempOffset() (*(int16_t (*)(void))0x3D7EA2)()
    
    //! \brief Defines the PWM deadband falling edge delay count (system clocks)
    //!
    #define HAL_PWM_DBFED_CNT         1
    
    
    //! \brief Defines the PWM deadband rising edge delay count (system clocks)
    //!
    #define HAL_PWM_DBRED_CNT         1
    
    
    //! \brief Defines the function to turn LEDs off
    //!
    #define HAL_turnLedOff            HAL_setGpioHigh
    
    
    //! \brief Defines the function to turn LEDs on
    //!
    #define HAL_turnLedOn             HAL_setGpioLow
    
    
    //! \brief Defines the function to turn LEDs on
    //!
    #define HAL_toggleLed             HAL_toggleGpio
    
    // **************************************************************************
    // the typedefs
    
    
    //! \brief Enumeration for the LED numbers
    //!
    typedef enum
    {
      HAL_Gpio_LED2=GPIO_Number_0   //!< GPIO pin number. LaunchPad uses PWM pins for LEDs
    } HAL_LedNumber_e;
      
    
    //! \brief Enumeration for the sensor types
    //!
    typedef enum
    {
      HAL_SensorType_Current=0,      //!< Enumeration for current sensor
      HAL_SensorType_Voltage         //!< Enumeration for voltage sensor
    } HAL_SensorType_e;
    
    
    // **************************************************************************
    // the globals
    
    extern interrupt void mainISR(void);
    
    
    // **************************************************************************
    // the function prototypes
    
    
    //! \brief     Acknowledges an interrupt from the ADC so that another ADC interrupt can 
    //!            happen again.
    //! \param[in] handle     The hardware abstraction layer (HAL) handle
    //! \param[in] intNumber  The interrupt number
    static inline void HAL_acqAdcInt(HAL_Handle handle,const ADC_IntNumber_e intNumber)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
    
      // clear the ADC interrupt flag
      ADC_clearIntFlag(obj->adcHandle,intNumber);
    
    
      // Acknowledge interrupt from PIE group 10 
      PIE_clearInt(obj->pieHandle,PIE_GroupNumber_10);
    
      return;
    } // end of HAL_acqAdcInt() function
    
    
    //! \brief     Acknowledges an interrupt from the PWM so that another PWM interrupt can
    //!            happen again.
    //! \param[in] handle     The hardware abstraction layer (HAL) handle
    //! \param[in] pwmNumber  The PWM number
    static inline void HAL_acqPwmInt(HAL_Handle handle,const PWM_Number_e pwmNumber)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
    
      // clear the PWM interrupt flag
      PWM_clearIntFlag(obj->pwmHandle[pwmNumber]);
    
    
      // clear the SOCA flag
      PWM_clearSocAFlag(obj->pwmHandle[pwmNumber]);
    
    
      // Acknowledge interrupt from PIE group 3
      PIE_clearInt(obj->pieHandle,PIE_GroupNumber_3);
    
      return;
    } // end of HAL_acqPwmInt() function
    
    
    //! \brief      Executes calibration routines
    //! \details    Values for offset and gain are programmed into OTP memory at
    //!             the TI factory.  This calls and internal function that programs
    //!             these offsets and gains into the ADC registers.
    //! \param[in]  handle  The hardware abstraction layer (HAL) handle
    extern void HAL_cal(HAL_Handle handle);
    
    
    //! \brief      Disables global interrupts
    //! \param[in]  handle  The hardware abstraction layer (HAL) handle
    extern void HAL_disableGlobalInts(HAL_Handle handle);
    
    
    //! \brief      Disables the watch dog
    //! \param[in]  handle  The hardware abstraction layer (HAL) handle
    extern void HAL_disableWdog(HAL_Handle handle);
    
    
    //! \brief      Disables the PWM device
    //! \details    Turns off the outputs of the EPWM peripherals which will put
    //!             the power switches into a high impedance state.
    //! \param[in]  handle  The hardware abstraction layer (HAL) handle
    static inline void HAL_disablePwm(HAL_Handle handle)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
      PWM_setOneShotTrip(obj->pwmHandle[PWM_Number_1]);
      PWM_setOneShotTrip(obj->pwmHandle[PWM_Number_2]);
      PWM_setOneShotTrip(obj->pwmHandle[PWM_Number_3]);
    
      return;
    } // end of HAL_disablePwm() function
    
    
    //! \brief      Enables the ADC interrupts
    //! \details    Enables the ADC interrupt in the PIE, and CPU.  Enables the 
    //!             interrupt to be sent from the ADC peripheral.
    //! \param[in]  handle  The hardware abstraction layer (HAL) handle
    extern void HAL_enableAdcInts(HAL_Handle handle);
    
    
    //! \brief      Enables the debug interrupt
    //! \details    The debug interrupt is used for the real-time debugger.  It is
    //!             not needed if the real-time debugger is not used.  Clears
    //!             bit 1 of ST1.
    //! \param[in]  handle  The hardware abstraction layer (HAL) handle
    extern void HAL_enableDebugInt(HAL_Handle handle);
    
    
    //! \brief     Enables global interrupts
    //! \param[in] handle  The hardware abstraction layer (HAL) handle
    extern void HAL_enableGlobalInts(HAL_Handle handle);
    
    
    //! \brief      Enables the 8301 device
    //! \details    Provides the correct timing to enable the drv8301
    //! \param[in]  handle  The hardware abstraction layer (HAL) handle
    extern void HAL_enableDrv(HAL_Handle handle);
    
    
    //! \brief      Enables the PWM devices
    //! \details    Turns on the outputs of the EPWM peripheral which will allow 
    //!             the power switches to be controlled.
    //! \param[in]  handle  The hardware abstraction layer (HAL) handle
    static inline void HAL_enablePwm(HAL_Handle handle)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
      PWM_clearOneShotTrip(obj->pwmHandle[PWM_Number_1]);
      PWM_clearOneShotTrip(obj->pwmHandle[PWM_Number_2]);
      PWM_clearOneShotTrip(obj->pwmHandle[PWM_Number_3]);
    
      return;
    } // end of HAL_enablePwm() function
    
    
    //! \brief     Enables the PWM interrupt
    //! \param[in] handle  The hardware abstraction layer (HAL) handle
    extern void HAL_enablePwmInt(HAL_Handle handle);
    
    
    //! \brief     Gets the ADC delay value
    //! \param[in] handle     The hardware abstraction layer (HAL) handle
    //! \param[in] socNumber  The ADC SOC number
    //! \return    The ADC delay value
    static inline ADC_SocSampleDelay_e HAL_getAdcSocSampleDelay(HAL_Handle handle,
                                                                const ADC_SocNumber_e socNumber)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
      return(ADC_getSocSampleDelay(obj->adcHandle,socNumber));
    } // end of HAL_getAdcSocSampleDelay() function
    
    
    //! \brief      Gets the ADC bias value
    //! \details    The ADC bias contains the feedback circuit's offset and bias.
    //!             Bias is the mathematical offset used when a bi-polar signal
    //!             is read into a uni-polar ADC.
    //! \param[in]  handle        The hardware abstraction layer (HAL) handle
    //! \param[in]  sensorType    The sensor type
    //! \param[in]  sensorNumber  The sensor number
    //! \return     The ADC bias value
    static inline _iq HAL_getBias(HAL_Handle handle,
                                  const HAL_SensorType_e sensorType,
                                  uint_least8_t sensorNumber)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
      _iq bias = _IQ(0.0);
    
      if(sensorType == HAL_SensorType_Current)
        {
          bias = obj->adcBias.I.value[sensorNumber];
        }
      else if(sensorType == HAL_SensorType_Voltage)
        {
          bias = obj->adcBias.V.value[sensorNumber];
        }
    
      return(bias);
    } // end of HAL_getBias() function
    
    
    //! \brief      Gets the current scale factor
    //! \details    The current scale factor is defined as
    //!             USER_ADC_FULL_SCALE_CURRENT_A/USER_IQ_FULL_SCALE_CURRENT_A.
    //!             This scale factor is not used when converting between PU amps
    //!             and real amps.
    //! \param[in]  handle  The hardware abstraction layer (HAL) handle
    //! \return     The current scale factor
    static inline _iq HAL_getCurrentScaleFactor(HAL_Handle handle)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
      return(obj->current_sf);
    } // end of HAL_getCurrentScaleFactor() function
    
    
    //! \brief     Gets the number of current sensors
    //! \param[in] handle  The hardware abstraction layer (HAL) handle
    //! \return    The number of current sensors
    static inline uint_least8_t HAL_getNumCurrentSensors(HAL_Handle handle)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
      
    
      return(obj->numCurrentSensors);
    } // end of HAL_getNumCurrentSensors() function
    
    
    //! \brief     Gets the number of voltage sensors
    //! \param[in] handle  The hardware abstraction layer (HAL) handle
    //! \return    The number of voltage sensors
    static inline uint_least8_t HAL_getNumVoltageSensors(HAL_Handle handle)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
      
    
      return(obj->numVoltageSensors);
    } // end of HAL_getNumVoltageSensors() function
    
    
    //! \brief      Gets the value used to set the low pass filter pole for offset estimation
    //! \details    An IIR single pole low pass filter is used to find the feedback circuit's
    //!             offsets.  This function returns the value of that pole.
    //! \param[in]  handle        The hardware abstraction layer (HAL) handle
    //! \param[in]  sensorType    The sensor type
    //! \param[in]  sensorNumber  The sensor number
    //! \return     The value used to set the low pass filter pole, pu
    static inline _iq HAL_getOffsetBeta_lp_pu(HAL_Handle handle,
                                              const HAL_SensorType_e sensorType,
                                              const uint_least8_t sensorNumber)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
      _iq beta_lp_pu = _IQ(0.0);
      
      if(sensorType == HAL_SensorType_Current)
        {
          beta_lp_pu = OFFSET_getBeta(obj->offsetHandle_I[sensorNumber]);
        }
      else if(sensorType == HAL_SensorType_Voltage)
        {
          beta_lp_pu = OFFSET_getBeta(obj->offsetHandle_V[sensorNumber]);
        }
    
      return(beta_lp_pu);
    } // end of HAL_getOffsetBeta_lp_pu() function
    
    
    //! \brief      Gets the offset value
    //! \details    The offsets that are calculated during the feedback circuits calibrations
    //!             are returned from the IIR filter object.
    //! \param[in]  handle        The hardware abstraction layer (HAL) handle
    //! \param[in]  sensorType    The sensor type
    //! \param[in]  sensorNumber  The sensor number
    //! \return     The offset value
    static inline _iq HAL_getOffsetValue(HAL_Handle handle,
                                         const HAL_SensorType_e sensorType,
                                         const uint_least8_t sensorNumber)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
      _iq offset = _IQ(0.0);
      
      if(sensorType == HAL_SensorType_Current)
        {
          offset = OFFSET_getOffset(obj->offsetHandle_I[sensorNumber]);
        }
      else if(sensorType == HAL_SensorType_Voltage)
        {
          offset = OFFSET_getOffset(obj->offsetHandle_V[sensorNumber]);
        }
    
      return(offset);
    } // end of HAL_getOffsetValue() function
    
    
    //! \brief      Gets the voltage scale factor
    //! \details    The voltage scale factor is defined as
    //!             USER_ADC_FULL_SCALE_VOLTAGE_V/USER_IQ_FULL_SCALE_VOLTAGE_V.
    //!             This scale factor is not used when converting between PU volts
    //!             and real volts.
    //! \param[in]  handle  The hardware abstraction layer (HAL) handle
    //! \return     The voltage scale factor
    static inline _iq HAL_getVoltageScaleFactor(HAL_Handle handle)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
      return(obj->voltage_sf);
    } // end of HAL_getVoltageScaleFactor() function
    
    
    //! \brief      Configures the fault protection logic
    //! \details    Sets up the trip zone inputs so that when a comparator
    //!             signal from outside the micro-controller trips a fault,
    //!             the EPWM peripheral blocks will force the
    //!             power switches into a high impedance state.
    //! \param[in]  handle  The hardware abstraction layer (HAL) handle
    extern void HAL_setupFaults(HAL_Handle handle);
    
    
    //! \brief      Initializes the hardware abstraction layer (HAL) object
    //! \details    Initializes all handles to the microcontroller peripherals.
    //!             Returns a handle to the HAL object.
    //! \param[in]  pMemory   A pointer to the memory for the hardware abstraction layer object
    //! \param[in]  numBytes  The number of bytes allocated for the hardware abstraction layer object, bytes
    //! \return     The hardware abstraction layer (HAL) object handle
    extern HAL_Handle HAL_init(void *pMemory,const size_t numBytes);
    
    
    //! \brief      Initializes the interrupt vector table
    //! \details    Points ADCINT1 to mainISR
    //! \param[in]  handle  The hardware abstraction layer (HAL) handle
    static inline void HAL_initIntVectorTable(HAL_Handle handle)
     {
      HAL_Obj *obj = (HAL_Obj *)handle;
      PIE_Obj *pie = (PIE_Obj *)obj->pieHandle;
    
    
      ENABLE_PROTECTED_REGISTER_WRITE_MODE;
    
      pie->ADCINT1 = &mainISR;
    
      pie->SCIRXINTB = &sciBRxISR;
    
      DISABLE_PROTECTED_REGISTER_WRITE_MODE;
    
      return;
     } // end of HAL_initIntVectorTable() function
    
    
    //! \brief      Reads the ADC data
    //! \details    Reads in the ADC result registers, adjusts for offsets, and
    //!             scales the values according to the settings in user.h.  The
    //!             structure gAdcData holds three phase voltages, three line
    //!             currents, and one DC bus voltage.
    //! \param[in]  handle    The hardware abstraction layer (HAL) handle
    //! \param[in]  pAdcData  A pointer to the ADC data buffer
    static inline void HAL_readAdcData(HAL_Handle handle,HAL_AdcData_t *pAdcData)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
      _iq value;
      _iq current_sf = HAL_getCurrentScaleFactor(handle);
      _iq voltage_sf = HAL_getVoltageScaleFactor(handle);
    
    
      // convert current A
      // sample the first sample twice due to errata sprz342f, ignore the first sample
      value = (_iq)ADC_readResult(obj->adcHandle,ADC_ResultNumber_1);
      value = _IQ12mpy(value,current_sf) - obj->adcBias.I.value[0];      // divide by 2^numAdcBits = 2^12
      pAdcData->I.value[0] = value;
    
      // convert current B
      value = (_iq)ADC_readResult(obj->adcHandle,ADC_ResultNumber_2);
      value = _IQ12mpy(value,current_sf) - obj->adcBias.I.value[1];      // divide by 2^numAdcBits = 2^12
      pAdcData->I.value[1] = value;
    
      // convert current C
      value = (_iq)ADC_readResult(obj->adcHandle,ADC_ResultNumber_3);
      value = _IQ12mpy(value,current_sf) - obj->adcBias.I.value[2];      // divide by 2^numAdcBits = 2^12
      pAdcData->I.value[2] = value;
    
      // convert voltage A
      value = (_iq)ADC_readResult(obj->adcHandle,ADC_ResultNumber_4);
      value = _IQ12mpy(value,voltage_sf) - obj->adcBias.V.value[0];      // divide by 2^numAdcBits = 2^12
      pAdcData->V.value[0] = value;
    
      // convert voltage B
      value = (_iq)ADC_readResult(obj->adcHandle,ADC_ResultNumber_5);
      value = _IQ12mpy(value,voltage_sf) - obj->adcBias.V.value[1];      // divide by 2^numAdcBits = 2^12
      pAdcData->V.value[1] = value;
    
      // convert voltage C
      value = (_iq)ADC_readResult(obj->adcHandle,ADC_ResultNumber_6);
      value = _IQ12mpy(value,voltage_sf) - obj->adcBias.V.value[2];      // divide by 2^numAdcBits = 2^12
      pAdcData->V.value[2] = value;
    
      // read the dcBus voltage value
      value = (_iq)ADC_readResult(obj->adcHandle,ADC_ResultNumber_7);     // divide by 2^numAdcBits = 2^12
      value = _IQ12mpy(value,voltage_sf);
      pAdcData->dcBus = value;
    
      return;
    } // end of HAL_readAdcData() function
    
    
    //! \brief      Reads the ADC data
    //! \details    Reads in the ADC result registers, and
    //!             scales the values according to the settings in user.h.  The
    //!             structure gAdcData holds three phase voltages, three line
    //!             currents, and one DC bus voltage.
    //! \param[in]  handle    The hardware abstraction layer (HAL) handle
    //! \param[in]  pAdcData  A pointer to the ADC data buffer
    static inline void HAL_readAdcDataWithOffsets(HAL_Handle handle,HAL_AdcData_t *pAdcData)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
      _iq value;
      _iq current_sf = HAL_getCurrentScaleFactor(handle);
      _iq voltage_sf = HAL_getVoltageScaleFactor(handle);
    
    
      // convert current A
      // sample the first sample twice due to errata sprz342f, ignore the first sample
      value = (_iq)ADC_readResult(obj->adcHandle,ADC_ResultNumber_1);
      value = _IQ12mpy(value,current_sf);
      pAdcData->I.value[0] = value;
    
      // convert current B
      value = (_iq)ADC_readResult(obj->adcHandle,ADC_ResultNumber_2);
      value = _IQ12mpy(value,current_sf);
      pAdcData->I.value[1] = value;
    
      // convert current C
      value = (_iq)ADC_readResult(obj->adcHandle,ADC_ResultNumber_3);
      value = _IQ12mpy(value,current_sf);
      pAdcData->I.value[2] = value;
    
      // convert voltage A
      value = (_iq)ADC_readResult(obj->adcHandle,ADC_ResultNumber_4);
      value = _IQ12mpy(value,voltage_sf);
      pAdcData->V.value[0] = value;
    
      // convert voltage B
      value = (_iq)ADC_readResult(obj->adcHandle,ADC_ResultNumber_5);
      value = _IQ12mpy(value,voltage_sf);
      pAdcData->V.value[1] = value;
    
      // convert voltage C
      value = (_iq)ADC_readResult(obj->adcHandle,ADC_ResultNumber_6);
      value = _IQ12mpy(value,voltage_sf);
      pAdcData->V.value[2] = value;
    
      // read the dcBus voltage value
      value = (_iq)ADC_readResult(obj->adcHandle,ADC_ResultNumber_7);
      value = _IQ12mpy(value,voltage_sf);
      pAdcData->dcBus = value;
    
      return;
    } // end of HAL_readAdcDataWithOffsets() function
    
    
    //! \brief     Reads the timer count
    //! \param[in] handle       The hardware abstraction layer (HAL) handle
    //! \param[in] timerNumber  The timer number, 0,1 or 2
    //! \return    The timer count
    static inline uint32_t HAL_readTimerCnt(HAL_Handle handle,const uint_least8_t timerNumber)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
      uint32_t timerCnt = TIMER_getCount(obj->timerHandle[timerNumber]);
    
      return(timerCnt);
    } // end of HAL_readTimerCnt() function
    
    
    //! \brief     Reloads the timer
    //! \param[in] handle       The hardware abstraction layer (HAL) handle
    //! \param[in] timerNumber  The timer number, 0,1 or 2
    static inline void HAL_reloadTimer(HAL_Handle handle,const uint_least8_t timerNumber)
    {
      HAL_Obj  *obj = (HAL_Obj *)handle;
    
      // reload the specified timer
      TIMER_reload(obj->timerHandle[timerNumber]);
    
      return;
    }  // end of HAL_reloadTimer() function
    
    
    //! \brief     Sets up the GATE object
    //! \param[in] handle       The hardware abstraction layer (HAL) handle
    void HAL_setupGate(HAL_Handle handle);
    
    
    //! \brief     Starts the timer
    //! \param[in] handle       The hardware abstraction layer (HAL) handle
    //! \param[in] timerNumber  The timer number, 0,1 or 2
    static inline void HAL_startTimer(HAL_Handle handle,const uint_least8_t timerNumber)
    {
      HAL_Obj  *obj = (HAL_Obj *)handle;
    
      // start the specified timer
      TIMER_start(obj->timerHandle[timerNumber]);
    
      return;
    }  // end of HAL_startTimer() function
    
    
    //! \brief     Stops the timer
    //! \param[in] handle       The hardware abstraction layer (HAL) handle
    //! \param[in] timerNumber  The timer number, 0,1 or 2
    static inline void HAL_stopTimer(HAL_Handle handle,const uint_least8_t timerNumber)
    {
      HAL_Obj  *obj = (HAL_Obj *)handle;
    
      // stop the specified timer
      TIMER_stop(obj->timerHandle[timerNumber]);
    
      return;
    }  // end of HAL_stopTimer() function
    
    
    //! \brief     Sets the timer period
    //! \param[in] handle       The hardware abstraction layer (HAL) handle
    //! \param[in] timerNumber  The timer number, 0,1 or 2
    //! \param[in] period       The timer period
    static inline void HAL_setTimerPeriod(HAL_Handle handle,const uint_least8_t timerNumber, const uint32_t period)
    {
      HAL_Obj  *obj = (HAL_Obj *)handle;
    
      // set the period
      TIMER_setPeriod(obj->timerHandle[timerNumber], period);
    
      return;
    }  // end of HAL_setTimerPeriod() function
    
    
    //! \brief     Gets the timer period
    //! \param[in] handle       The hardware abstraction layer (HAL) handle
    //! \param[in] timerNumber  The timer number, 0,1 or 2
    //! \return    The timer period
    static inline uint32_t HAL_getTimerPeriod(HAL_Handle handle,const uint_least8_t timerNumber)
    {
      HAL_Obj  *obj = (HAL_Obj *)handle;
    
      uint32_t timerPeriod = TIMER_getPeriod(obj->timerHandle[timerNumber]);
    
      return(timerPeriod);
    }  // end of HAL_getTimerPeriod() function
    
    
    //! \brief     Sets the ADC SOC sample delay value
    //! \param[in] handle       The hardware abstraction layer (HAL) handle
    //! \param[in] socNumber    The SOC number
    //! \param[in] sampleDelay  The delay value for the ADC
    static inline void HAL_setAdcSocSampleDelay(HAL_Handle handle,
                                                const ADC_SocNumber_e socNumber,
                                                const ADC_SocSampleDelay_e sampleDelay)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
      ADC_setSocSampleDelay(obj->adcHandle,socNumber,sampleDelay);
    
      return;
    } // end of HAL_setAdcSocSampleDelay() function
    
    
    //! \brief     Sets the ADC bias value
    //! \param[in] handle        The hardware abstraction layer (HAL) handle
    //! \param[in] sensorType    The sensor type
    //! \param[in] sensorNumber  The sensor number
    //! \param[in] bias          The ADC bias value
    static inline void HAL_setBias(HAL_Handle handle,
                                   const HAL_SensorType_e sensorType,
                                   uint_least8_t sensorNumber,
                                   const _iq bias)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
    
      if(sensorType == HAL_SensorType_Current)
        {
          obj->adcBias.I.value[sensorNumber] = bias;
        }
      else if(sensorType == HAL_SensorType_Voltage)
        {
          obj->adcBias.V.value[sensorNumber] = bias;
        }
    
      return;
    } // end of HAL_setBias() function
    
    
    //! \brief      Sets the GPIO pin high
    //! \details    Takes in the enumeration GPIO_Number_e and sets that GPIO
    //!             pin high.
    //! \param[in]  handle      The hardware abstraction layer (HAL) handle
    //! \param[in]  gpioNumber  The GPIO number
    static inline void HAL_setGpioHigh(HAL_Handle handle,const GPIO_Number_e gpioNumber)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
      
    
      // set GPIO high
      GPIO_setHigh(obj->gpioHandle,gpioNumber);
    
      return;
    } // end of HAL_setGpioHigh() function
    
    
    //! \brief      Toggles the GPIO pin
    //! \details    Takes in the enumeration GPIO_Number_e and toggles that GPIO
    //!             pin.
    //! \param[in]  handle      The hardware abstraction layer (HAL) handle
    //! \param[in]  gpioNumber  The GPIO number
    static inline void HAL_toggleGpio(HAL_Handle handle,const GPIO_Number_e gpioNumber)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
    
      // set GPIO high
      GPIO_toggle(obj->gpioHandle,gpioNumber);
    
      return;
    } // end of HAL_setGpioHigh() function
    
    
    //! \brief      Sets the GPIO pin low
    //! \details    Takes in the enumeration GPIO_Number_e and clears that GPIO
    //!             pin low.
    //! \param[in]  handle      The hardware abstraction layer (HAL) handle
    //! \param[in]  gpioNumber  The GPIO number
    static inline void HAL_setGpioLow(HAL_Handle handle,const GPIO_Number_e gpioNumber)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
      
    
      // set GPIO low
      GPIO_setLow(obj->gpioHandle,gpioNumber);
    
      return;
    } // end of HAL_setGpioLow() function
    
    
    //! \brief     Sets the current scale factor in the hardware abstraction layer
    //! \param[in] handle      The hardware abstraction layer (HAL) handle
    //! \param[in] current_sf  The current scale factor
    static inline void HAL_setCurrentScaleFactor(HAL_Handle handle,const _iq current_sf)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
      
    
      obj->current_sf = current_sf;
    
      return;
    } // end of HAL_setCurrentScaleFactor() function
    
    
    //! \brief     Sets the number of current sensors
    //! \param[in] handle             The hardware abstraction layer (HAL) handle
    //! \param[in] numCurrentSensors  The number of current sensors
    static inline void HAL_setNumCurrentSensors(HAL_Handle handle,const uint_least8_t numCurrentSensors)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
      
    
      obj->numCurrentSensors = numCurrentSensors;
    
      return;
    } // end of HAL_setNumCurrentSensors() function
    
    
    //! \brief     Sets the number of voltage sensors
    //! \param[in] handle             The hardware abstraction layer (HAL) handle
    //! \param[in] numVoltageSensors  The number of voltage sensors
    static inline void HAL_setNumVoltageSensors(HAL_Handle handle,const uint_least8_t numVoltageSensors)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
      
    
      obj->numVoltageSensors = numVoltageSensors;
    
      return;
    } // end of HAL_setNumVoltageSensors() function
    
    
    //! \brief     Sets the value used to set the low pass filter pole for offset estimation
    //! \param[in] handle        The hardware abstraction layer (HAL) handle
    //! \param[in] sensorType    The sensor type
    //! \param[in] sensorNumber  The sensor number
    //! \param[in] beta_lp_pu    The value used to set the low pass filter pole, pu
    static inline void HAL_setOffsetBeta_lp_pu(HAL_Handle handle,
                                               const HAL_SensorType_e sensorType,
                                               const uint_least8_t sensorNumber,
                                               const _iq beta_lp_pu)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
      if(sensorType == HAL_SensorType_Current)
        {
          OFFSET_setBeta(obj->offsetHandle_I[sensorNumber],beta_lp_pu);
        }
      else if(sensorType == HAL_SensorType_Voltage)
        {
          OFFSET_setBeta(obj->offsetHandle_V[sensorNumber],beta_lp_pu);
        }
    
      return;
    } // end of HAL_setOffsetBeta_lp_pu() function
    
    
    //! \brief     Sets the offset initial condition value for offset estimation
    //! \param[in] handle        The hardware abstraction layer (HAL) handle
    //! \param[in] sensorType    The sensor type
    //! \param[in] sensorNumber  The sensor number
    //! \param[in] initCond      The initial condition value
    static inline void HAL_setOffsetInitCond(HAL_Handle handle,
                                             const HAL_SensorType_e sensorType,
                                             const uint_least8_t sensorNumber,
                                             const _iq initCond)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
      if(sensorType == HAL_SensorType_Current)
        {
          OFFSET_setInitCond(obj->offsetHandle_I[sensorNumber],initCond);
        }
      else if(sensorType == HAL_SensorType_Voltage)
        {
          OFFSET_setInitCond(obj->offsetHandle_V[sensorNumber],initCond);
        }
    
      return;
    } // end of HAL_setOffsetInitCond() function
    
    
    //! \brief     Sets the initial offset value for offset estimation
    //! \param[in] handle        The hardware abstraction layer (HAL) handle
    //! \param[in] sensorType    The sensor type
    //! \param[in] sensorNumber  The sensor number
    //! \param[in] value         The initial offset value
    static inline void HAL_setOffsetValue(HAL_Handle handle,
                                          const HAL_SensorType_e sensorType,
                                          const uint_least8_t sensorNumber,
                                          const _iq value)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
      if(sensorType == HAL_SensorType_Current)
        {
          OFFSET_setOffset(obj->offsetHandle_I[sensorNumber],value);
        }
      else if(sensorType == HAL_SensorType_Voltage)
        {
          OFFSET_setOffset(obj->offsetHandle_V[sensorNumber],value);
        }
    
      return;
    } // end of HAL_setOffsetValue() function
    
    
    //! \brief     Sets the voltage scale factor in the hardware abstraction layer
    //! \param[in] handle      The hardware abstraction layer (HAL) handle
    //! \param[in] voltage_sf  The voltage scale factor
    static inline void HAL_setVoltageScaleFactor(HAL_Handle handle,const _iq voltage_sf)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
      
      obj->voltage_sf = voltage_sf;
    
      return;
    } // end of HAL_setVoltageScaleFactor() function
    
    
    //! \brief      Sets the hardware abstraction layer parameters
    //! \details    Sets up the microcontroller peripherals.  Creates all of the scale
    //!             factors for the ADC voltage and current conversions.  Sets the initial
    //!             offset values for voltage and current measurements.
    //! \param[in]  handle       The hardware abstraction layer (HAL) handle
    //! \param[in]  pUserParams  The pointer to the user parameters
    extern void HAL_setParams(HAL_Handle handle,const USER_Params *pUserParams);
    
    
    //! \brief      Sets up the ADCs (Analog to Digital Converters)
    //! \param[in]  handle  The hardware abstraction layer (HAL) handle
    extern void HAL_setupAdcs(HAL_Handle handle);
    
    
    //! \brief      Sets up the clocks
    //! \details    Sets up the micro-controller's main oscillator
    //! \param[in]  handle  The hardware abstraction layer (HAL) handle
    extern void HAL_setupClks(HAL_Handle handle);
    
    
    //! \brief     Sets up the FLASH.
    //! \param[in] handle  The hardware abstraction layer (HAL) handle
    extern void HAL_setupFlash(HAL_Handle handle);
    
    
    //! \brief     Sets up the GPIO (General Purpose I/O) pins
    //! \param[in] handle  The hardware abstraction layer (HAL) handle
    extern void HAL_setupGpios(HAL_Handle handle);
    
    
    //! \brief          Setup GPIO 0 and 1 as outputs for the LaunchPad project lab 1 experiment
    //! \details        Since the LaunchPad uses the same GPIO pins for LEDs as PWM pins,
    //!                 the GPIO 0 and 1 are setup as an extra step.  GPIO 1 will be
    //!                 kept low so that there is no possibility of shoot-through conduction
    //!                 with the high side switch that is controlled by GPIO0.
    //! \param[in]      handle  The hardware abstraction layer (HAL) handle
    extern void HAL_setupLaunchPadGpio0and1(HAL_Handle handle);
    
    
    //! \brief     Sets up the peripheral clocks
    //! \param[in] handle  The hardware abstraction layer (HAL) handle
    extern void HAL_setupPeripheralClks(HAL_Handle handle);
    
    
    //! \brief     Sets up the PIE (Peripheral Interrupt Expansion)
    //! \param[in] handle  The hardware abstraction layer (HAL) handle
    extern void HAL_setupPie(HAL_Handle handle);
    
    
    //! \brief     Sets up the PLL (Phase Lock Loop)
    //! \param[in] handle   The hardware abstraction layer (HAL) handle
    //! \param[in] clkFreq  The clock frequency
    extern void HAL_setupPll(HAL_Handle handle,const PLL_ClkFreq_e clkFreq);
    
    
    //! \brief     Sets up the PWMs (Pulse Width Modulators)
    //! \param[in] handle          The hardware abstraction layer (HAL) handle
    //! \param[in] systemFreq_MHz  The system frequency, MHz
    //! \param[in] pwmPeriod_usec  The PWM period, usec
    //! \param[in] numPwmTicksPerIsrTick  The number of PWM clock ticks per ISR clock tick
    extern void HAL_setupPwms(HAL_Handle handle,
                       const float_t systemFreq_MHz,
                       const float_t pwmPeriod_usec,
                       const uint_least16_t numPwmTicksPerIsrTick);
    
    
    //! \brief     Sets up the spiA peripheral
    //! \param[in] handle   The hardware abstraction layer (HAL) handle
    extern void HAL_setupSpiA(HAL_Handle handle);
    
    
    //! \brief     Sets up the timers
    //! \param[in] handle          The hardware abstraction layer (HAL) handle
    //! \param[in] systemFreq_MHz  The system frequency, MHz
    extern void HAL_setupTimers(HAL_Handle handle,const float_t systemFreq_MHz);
    
    
    //! \brief      Updates the ADC bias values
    //! \details    This function is called before the motor is started.  It sets the voltage
    //!             and current measurement offsets.
    //! \param[in]  handle  The hardware abstraction layer (HAL) handle
    static inline void HAL_updateAdcBias(HAL_Handle handle)
    {
      uint_least8_t cnt;
      HAL_Obj *obj = (HAL_Obj *)handle;
      _iq bias;
    
    
      // update the current bias
      for(cnt=0;cnt<HAL_getNumCurrentSensors(handle);cnt++)
        {
          bias = HAL_getBias(handle,HAL_SensorType_Current,cnt);
          
          bias += OFFSET_getOffset(obj->offsetHandle_I[cnt]);
    
          HAL_setBias(handle,HAL_SensorType_Current,cnt,bias);
        }
    
    
      // update the voltage bias
      for(cnt=0;cnt<HAL_getNumVoltageSensors(handle);cnt++)
        {
          bias = HAL_getBias(handle,HAL_SensorType_Voltage,cnt);
    
          bias += OFFSET_getOffset(obj->offsetHandle_V[cnt]);
    
          HAL_setBias(handle,HAL_SensorType_Voltage,cnt,bias);
        }
    
      return;
    } // end of HAL_updateAdcBias() function
    
    
    //! \brief     Writes DAC data to the PWM comparators for DAC (digital-to-analog conversion) output
    //! \param[in] handle    The hardware abstraction layer (HAL) handle
    //! \param[in] pDacData  The pointer to the DAC data
    static inline void HAL_writeDacData(HAL_Handle handle,HAL_DacData_t *pDacData)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
      // convert values from _IQ to _IQ15
      uint_least8_t cnt;
      _iq period;
      _iq dacData_sat_dc;
      _iq value;
      uint16_t cmpValue[4];
    
      period = (_iq)pDacData->PeriodMax;
    
      for(cnt=0;cnt<4;cnt++)
    	{
    	  dacData_sat_dc = _IQmpy(pDacData->value[cnt], pDacData->gain[cnt]) + pDacData->offset[cnt];
    	  value = _IQmpy(dacData_sat_dc, period);
    	  cmpValue[cnt] = (uint16_t)_IQsat(value, period, 0);
    	}
    
      // write the DAC data
      if(obj->pwmDacHandle[PWMDAC_Number_1])
      {
    	  PWMDAC_write_CmpA(obj->pwmDacHandle[PWMDAC_Number_1], cmpValue[0]);
    	  PWMDAC_write_CmpB(obj->pwmDacHandle[PWMDAC_Number_1], cmpValue[1]);
      }
    
      if(obj->pwmDacHandle[PWMDAC_Number_2])
      {
    	  PWMDAC_write_CmpA(obj->pwmDacHandle[PWMDAC_Number_2], cmpValue[2]);
    	  PWMDAC_write_CmpB(obj->pwmDacHandle[PWMDAC_Number_2], cmpValue[3]);
      }
    
      return;
    } // end of HAL_writeDacData() function
    
    
    //! \brief     Writes PWM data to the PWM comparators for motor control
    //! \param[in] handle    The hardware abstraction layer (HAL) handle
    //! \param[in] pPwmData  The pointer to the PWM data
    static inline void HAL_writePwmData(HAL_Handle handle,HAL_PwmData_t *pPwmData)
    {
      uint_least8_t cnt;
      HAL_Obj *obj = (HAL_Obj *)handle;
      PWM_Obj *pwm;
      _iq period;
      _iq pwmData_neg;
      _iq pwmData_sat;
      _iq pwmData_sat_dc;
      _iq value;
      uint16_t value_sat;
    
      for(cnt=0;cnt<3;cnt++)
        {
          pwm = (PWM_Obj *)obj->pwmHandle[cnt];
          period = (_iq)pwm->TBPRD;
          pwmData_neg = _IQmpy(pPwmData->Tabc.value[cnt],_IQ(-1.0));
          pwmData_sat = _IQsat(pwmData_neg,_IQ(0.5),_IQ(-0.5));
          pwmData_sat_dc = pwmData_sat + _IQ(0.5);
          value = _IQmpy(pwmData_sat_dc, period);
          value_sat = (uint16_t)_IQsat(value, period, _IQ(0.0));
    
          // write the PWM data
          PWM_write_CmpA(obj->pwmHandle[cnt],value_sat);
        }
    
      return;
    } // end of HAL_writePwmData() function
    
    
    //! \brief     Reads PWM compare register A
    //! \param[in] handle    The hardware abstraction layer (HAL) handle
    //! \param[in] pwmNumber  The PWM number
    //! \return    The PWM compare value
    static inline uint16_t HAL_readPwmCmpA(HAL_Handle handle,const PWM_Number_e pwmNumber)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
      // the compare value to be returned
      uint16_t pwmValue;
    
      pwmValue = PWM_get_CmpA(obj->pwmHandle[pwmNumber]);
    
      return(pwmValue);
    } // end of HAL_readPwmCmpA() function
    
    
    //! \brief     Reads PWM compare mirror register A
    //! \param[in] handle    The hardware abstraction layer (HAL) handle
    //! \param[in] pwmNumber  The PWM number
    //! \return    The PWM compare value
    static inline uint16_t HAL_readPwmCmpAM(HAL_Handle handle,const PWM_Number_e pwmNumber)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
      // the compare value to be returned
      uint16_t pwmValue;
    
      pwmValue = PWM_get_CmpAM(obj->pwmHandle[pwmNumber]);
    
      return(pwmValue);
    } // end of HAL_readPwmCmpAM() function
    
    
    //! \brief     Reads PWM compare register B
    //! \param[in] handle    The hardware abstraction layer (HAL) handle
    //! \param[in] pwmNumber  The PWM number
    //! \return    The PWM compare value
    static inline uint16_t HAL_readPwmCmpB(HAL_Handle handle,const PWM_Number_e pwmNumber)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
      // the compare value to be returned
      uint16_t pwmValue;
    
      pwmValue = PWM_get_CmpB(obj->pwmHandle[pwmNumber]);
    
      return(pwmValue);
    } // end of HAL_readPwmCmpB() function
    
    
    //! \brief     Reads PWM period register
    //! \param[in] handle    The hardware abstraction layer (HAL) handle
    //! \param[in] pwmNumber  The PWM number
    //! \return    The PWM period value
    static inline uint16_t HAL_readPwmPeriod(HAL_Handle handle,const PWM_Number_e pwmNumber)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
      // the period value to be returned
      uint16_t pwmPeriodValue;
    
      pwmPeriodValue = PWM_getPeriod(obj->pwmHandle[pwmNumber]);
    
      return(pwmPeriodValue);
    } // end of HAL_readPwmPeriod() function
    
    //! \brief     Set trigger point in the middle of the low side pulse
    //! \param[in] handle    The hardware abstraction layer (HAL) handle
    //! \param[in] ignoreShunt  The low side shunt that should be ignored
    //! \param[in] midVolShunt  The middle length of output voltage
    static inline void HAL_setTrigger(HAL_Handle handle,const SVGENCURRENT_IgnoreShunt_e ignoreShunt,
    									const SVGENCURRENT_VmidShunt_e midVolShunt)
    {
      HAL_Obj *obj = (HAL_Obj *)handle;
    
      PWM_Obj *pwm1 = (PWM_Obj *)obj->pwmHandle[PWM_Number_1];
      PWM_Obj *pwm2 = (PWM_Obj *)obj->pwmHandle[PWM_Number_2];
      PWM_Obj *pwm3 = (PWM_Obj *)obj->pwmHandle[PWM_Number_3];
      PWM_Obj *pwm;
    
      uint16_t nextPulse1 = (pwm1->CMPA + pwm1->CMPAM) / 2;
      uint16_t nextPulse2 = (pwm2->CMPA + pwm2->CMPAM) / 2;
      uint16_t nextPulse3 = (pwm3->CMPA + pwm3->CMPAM) / 2;
      uint16_t pwmCMPA1 = pwm1->CMPA;
      uint16_t pwmCMPA2 = pwm2->CMPA;
      uint16_t pwmCMPA3 = pwm3->CMPA;
    
      if(ignoreShunt == use_all)
        {
          if((nextPulse1 <= nextPulse2) && (nextPulse1 <= nextPulse3))
            {
              pwm = pwm1;
            }
          else if((nextPulse2 <= nextPulse1) && (nextPulse2 <= nextPulse3))
            {
              pwm = pwm2;
            }
          else
            {
              pwm = pwm3;
            }
        }
      else
      {
    	  if(midVolShunt == Vmid_a)
    	  {
    		  pwm = pwm1;
    	  }
    	  else if(midVolShunt == Vmid_b)
    	  {
    		  pwm = pwm2;
    	  }
    	  else
    	  {
    		  pwm = pwm3;
    	  }
      }
    
      pwmCMPA1 = pwm->CMPA;
      pwmCMPA2 = pwm->CMPAM;
      if(pwmCMPA2 >= (pwmCMPA1 + pwm->DBFED))
      {
    	  pwmCMPA3 = (pwmCMPA2 - (pwmCMPA1 + pwm->DBFED)) / 2 + 1;
    	  if(pwmCMPA3 < (pwm1->TBPRD>>1))
    	  {
    		  pwm1->CMPB = pwmCMPA3;
    	  }
    	  else
    	  {
    		  pwm1->CMPB = (pwm1->TBPRD>>1);
    	  }
    	  PWM_setSocAPulseSrc(obj->pwmHandle[PWM_Number_1],PWM_SocPulseSrc_CounterEqualCmpBDecr);
      }
      else
      {
    	  pwmCMPA3 = ((pwmCMPA1 + pwm->DBFED) - pwmCMPA2 ) / 2 + 1;
    	  if(pwmCMPA3 < (pwm1->TBPRD>>1))
    	  {
    		  pwm1->CMPB = pwmCMPA3;
    	  }
    	  else
    	  {
    		  pwm1->CMPB = (pwm1->TBPRD>>1);
    	  }
    	  PWM_setSocAPulseSrc(obj->pwmHandle[PWM_Number_1],PWM_SocPulseSrc_CounterEqualCmpBIncr);
      }
    
      return;
    } // end of HAL_setTrigger() function
    
    
    //! \brief     Selects the analog channel used for calibration
    //! \param[in] handle      The hardware abstraction layer (HAL) handle
    //! \param[in] chanNumber  The channel number
    void HAL_AdcCalChanSelect(HAL_Handle handle, const ADC_SocChanNumber_e chanNumber);
    
    
    //! \brief     Reads the converted value from the selected calibration channel
    //! \param[in] handle     The hardware abstraction layer (HAL) handle
    //! \return    The converted value
    uint16_t HAL_AdcCalConversion(HAL_Handle handle);
    
    
    //! \brief     Executes the offset calibration of the ADC
    //! \param[in] handle     The hardware abstraction layer (HAL) handle
    void HAL_AdcOffsetSelfCal(HAL_Handle handle);
    
    
    //! \brief     Converts coarse and fine oscillator trim values into a single 16bit word value
    //! \param[in] handle     The hardware abstraction layer (HAL) handle
    //! \param[in] coarse     The coarse trim portion of the oscillator trim
    //! \param[in] fine       The fine trim portion of the oscillator trim
    //! \return    The combined trim value
    uint16_t HAL_getOscTrimValue(int16_t coarse, int16_t fine);
    
    
    //! \brief     Executes the oscillator 1 and 2 calibration functions
    //! \param[in] handle     The hardware abstraction layer (HAL) handle
    void HAL_OscTempComp(HAL_Handle handle);
    
    
    //! \brief     Executes the oscillator 1 calibration based on input sample
    //! \param[in] handle     The hardware abstraction layer (HAL) handle
    void HAL_osc1Comp(HAL_Handle handle, const int16_t sensorSample);
    
    
    //! \brief     Executes the oscillator 2 calibration based on input sample
    //! \param[in] handle     The hardware abstraction layer (HAL) handle
    void HAL_osc2Comp(HAL_Handle handle, const int16_t sensorSample);
    
    
    //! \brief     Writes data to the driver
    //! \param[in] handle         The hardware abstraction layer (HAL) handle
    //! \param[in] Spi_8301_Vars  SPI variables
    void HAL_writeDrvData(HAL_Handle handle, DRV_SPI_8301_Vars_t *Spi_8301_Vars);
    
    
    //! \brief     Reads data from the driver
    //! \param[in] handle         The hardware abstraction layer (HAL) handle
    //! \param[in] Spi_8301_Vars  SPI variables
    void HAL_readDrvData(HAL_Handle handle, DRV_SPI_8301_Vars_t *Spi_8301_Vars);
    
    
    //! \brief     Sets up the SPI interface for the driver
    //! \param[in] handle         The hardware abstraction layer (HAL) handle
    //! \param[in] Spi_8301_Vars  SPI variables
    void HAL_setupDrvSpi(HAL_Handle handle, DRV_SPI_8301_Vars_t *Spi_8301_Vars);
    
    //! \brief     Writes DAC data to the PWM comparators for DAC (digital-to-analog conversion) output
    //! \param[in] handle    The hardware abstraction layer (HAL) handle
    //! \param[in] pDacData  The pointer to the DAC data
    void HAL_setDacParameters(HAL_Handle handle, HAL_DacData_t *pDacData);
    
    #ifdef __cplusplus
    }
    #endif // extern "C"
    
    //@} // ingroup
    #endif // end of _HAL_H_ definition
    
    
    

    The code provided includes the hal.c and hal.h files. The SCI function has been added according to your instructions in the HAL guide. Are there any modifications or changes needed in the code? Please help me. Please  Modifies and re-send it.