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.

TMS320F28335: Error in dclf32.h header file while compiling a code based on PI algorithm.(tms320f28335)

Part Number: TMS320F28335
Other Parts Discussed in Thread: C2000WARE

Hi,

I have been using tms320f28335 for close loop PI control of load current.For that i have written a code,but i am getting error messages in DCLF32.h header file.

I have attached the code and the error messages.

Kindly provide the solution and  confirm weather the issue is with the code or in  DCL header structure.

#include "DSP28x_Project.h"


// Device Headerfile and Examples Include File
#include "DCL.h"
#include "DSP2833x_Device.h"
#include "DSP2833x_Examples.h"
#include "DSP2833x_GlobalPrototypes.h"

#include "DCLF32.h"

#include "DCL_fdlog.h"

//#include "DCLC28.h"

#include "math.h"
//
// Function Prototypes
//
float rk = 20.0f;

float yk;

float lk;

float uk;

float Duty;

struct dcl_pi pi1;
DCL_PI pi1 = PI_DEFAULTS;

//

// Function Prototypes

//

Uint16 LoopCount;

Uint16 ConversionCount;

void adc_isr(void);

void gpio_select(void);

void InitAdc(void);

void InitEPwm1(void);

void control_Isr(void);

float DCL_runPI_C1(DCL_PI *p, float rk, float yk);


float voltage1;

float cmpa;

//

// Main

//

void main(void)

{

InitSysCtrl();

DINT;

InitPieCtrl();

EALLOW;

#if (CPU_FRQ_150MHZ) // Default - 150 MHz SYSCLKOUT

//

// HSPCLK = SYSCLKOUT/2*ADC_MODCLK2 = 150/(2*3) = 25.0 MHz

//

#define ADC_MODCLK 0x3

#endif

#if (CPU_FRQ_100MHZ)

//

// HSPCLK = SYSCLKOUT/2*ADC_MODCLK2 = 100/(2*2) = 25.0 MHz

//

#define ADC_MODCLK 0x2

#endif

EDIS;

EALLOW;

SysCtrlRegs.HISPCP.all = ADC_MODCLK;

EDIS;

IER = 0x0000;

IFR = 0x0000;

InitPieVectTable();

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

PieVectTable.ADCINT = &adc_isr;

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

EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0;
EDIS;
EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1;
EDIS;
InitAdc (); // For this example, init the ADC
//gpio_select();

// InitEPwm1();

PieCtrlRegs.PIEIER1.bit.INTx6 = 1;

IER |= M_INT1;


EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
LoopCount = 0;
ConversionCount = 0;

/* initialise controller variables */

pi1.Kp=2.0f;

pi1.Ki=1.0f;

pi1.Umax=0.8f;

pi1.Umin=0.2f;

rk = 20.0f; // initial value for control reference

lk = 1.0f; // control loop not saturated

//

// Enable SOCA from ePWM to start SEQ1

//
// control loop not saturated
AdcRegs.ADCMAXCONV.all = 0x0001; // Setup 2 conv's on SEQ1

AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x3; // Setup ADCINA3 as 1st SEQ1 conv.

AdcRegs.ADCCHSELSEQ1.bit.CONV01 = 0x2; // Setup ADCINA2 as 2nd SEQ1 conv.
AdcRegs.ADCTRL2.bit.EPWM_SOCA_SEQ1 = 1;


AdcRegs.ADCTRL2.bit.INT_ENA_SEQ1 = 1; // Enable SEQ1 interrupt (every EOS)

EPwm1Regs.ETSEL.bit.SOCAEN = 1; // Enable SOC on A group
EPwm1Regs.ETSEL.bit.SOCASEL = 4; // Select SOC from from CPMA on upcount
EPwm1Regs.ETPS.bit.SOCAPRD = 1; // Generate pulse on 1st event
EPwm1Regs.CMPA.half.CMPA = 1875; // Set compare A value
EPwm1Regs.TBPRD = 3750; // Set period for ePWM1
EPwm1Regs.TBCTL.bit.CTRMODE = 0; // count up and start

for (;;)

{
LoopCount++;
}

}

//

// cpu_timer0_isr -


void gpio_select()


{


EALLOW;

GpioCtrlRegs.GPAPUD.bit.GPIO0 = 0; // Enable pullup on GPIO0

GpioCtrlRegs.GPAPUD.bit.GPIO1 = 0; // Enable pullup on GPIO0

GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 1; // GPIO0 = PWM1A

GpioCtrlRegs.GPAMUX1.bit.GPIO1 = 1; // GPIO0 = PWM1B

EDIS;

}

void InitEPwm1()

{

EPwm1Regs.TBCTL.bit.CTRMODE = 0; // Count up down

EPwm1Regs.TBPRD = 3750; // Set timer period

EPwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE; // Disable phase loading

EPwm1Regs.TBPHS.half.TBPHS = 0x0000; // Phase is 0

EPwm1Regs.TBCTR = 0x0000; // Clear counter

EPwm1Regs.TBCTL.bit.HSPCLKDIV = 0x001; // Clock ratio to SYSCLKOUT

EPwm1Regs.TBCTL.bit.CLKDIV = 000;

EPwm1Regs.TBCTL.bit.SYNCOSEL=1;

EPwm1Regs.CMPA.half.CMPA =1875; // Set compare A value

EPwm1Regs.CMPB = 1875; // Set Compare B value

EPwm1Regs.CMPCTL.bit.LOADAMODE=1;

EPwm1Regs.CMPCTL.bit.SHDWAMODE=0;

/* EPwm1Regs.DBCTL.bit.OUT_MODE=3;

EPwm1Regs.DBCTL.bit.POLSEL=2;

EPwm1Regs.DBCTL.bit.IN_MODE=0;

EPwm1Regs.DBRED=100;

EPwm1Regs.DBFED=100;*/

EPwm1Regs.AQCTLA.bit.ZRO=2; // Set PWM1A on Zero

EPwm1Regs.AQCTLA.bit.CAU=1;

EPwm1Regs.ETSEL.bit.SOCAEN = 1; // Enable SOC on A group

EPwm1Regs.ETSEL.bit.SOCASEL = 1; // Select SOC from from CPMA on upcount

EPwm1Regs.ETPS.bit.SOCAPRD = 1; // Generate pulse on 1st event

}

__interrupt void adc_isr(void)

{

yk=((int)AdcRegs.ADCRESULT0 >>4)*300.0f/4095.0f;

//Voltage2[ConversionCount] = AdcRegs.ADCRESULT1 >>4;

//DCL_runClamp_C1(float *data, float Umax, float Umin);

//

lk=0.0f;

uk = DCL_runPI_C1(&pi1, rk, yk);

if (uk>0.8f){

uk=0.8f;

}

else if (uk<0.1f){

uk=0.1f;

}

//uk=0.5f;

EPwm1Regs.CMPA.half.CMPA =(EPwm1Regs.TBPRD)*uk; // Set compare A value

EPwm1Regs.CMPB = EPwm1Regs.TBPRD*uk; // Set Compare B value

// If 40 conversions have been logged, start over

//

//

// Reinitialize for next ADC sequence

//
if(ConversionCount == 9)
{
ConversionCount = 0;
}
else
{
ConversionCount++;
}

AdcRegs.ADCTRL2.bit.RST_SEQ1 = 1; // Reset SEQ1

AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1; // Clear INT SEQ1 bit

PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Acknowledge interrupt to PIE

return;

}

ERROR:

>> Compilation failure

subdir_rules.mk:72: recipe for target 'Example_2833xAdcSoc.obj' failed

"C:/ti/c2000/C2000Ware_4_03_00_00/libraries/control/DCL/c28/include/DCLF32.h",

          line 146: error: expected an expression

      v = DCL_DISABLE_INTS;

                          ^

 

 

"C:/ti/c2000/C2000Ware_4_03_00_00/libraries/control/DCL/c28/include/DCLF32.h",

          line 173: error: struct "dcl_css" has no field "sts"

      if (p->css->sts & STS_UPDATE_PENDING)

                  ^

 

"C:/ti/c2000/C2000Ware_4_03_00_00/libraries/control/DCL/c28/include/DCLF32.h",

          line 173: error: expected an expression

      if (p->css->sts & STS_UPDATE_PENDING)

                                          ^

 

"C:/ti/c2000/C2000Ware_4_03_00_00/libraries/control/DCL/c28/include/DCLF32.h",

          line 175: error: expected an expression

          v = DCL_DISABLE_INTS;

                              ^

"C:/ti/c2000/C2000Ware_4_03_00_00/libraries/control/DCL/c28/include/DCLF32.h",

          line 261: error: expected a ";"

  {

  ^

 

"C:/ti/c2000/C2000Ware_4_03_00_00/libraries/control/DCL/c28/include/DCLF32.h",

          line 323: error: expected a ";"

  {

  ^

 

"C:/ti/c2000/C2000Ware_4_03_00_00/libraries/control/DCL/c28/include/DCLF32.h",

          line 430: error: expected an expression

      v = DCL_DISABLE_INTS;

                          ^

 

 

"C:/ti/c2000/C2000Ware_4_03_00_00/libraries/control/DCL/c28/include/DCLF32.h",

          line 458: error: struct "dcl_pi2" has no field "css"

      if (p->css->sts & STS_UPDATE_PENDING)

             ^

 

"C:/ti/c2000/C2000Ware_4_03_00_00/libraries/control/DCL/c28/include/DCLF32.h",

          line 458: error: expected an expression

      if (p->css->sts & STS_UPDATE_PENDING)

                                          ^

 

"C:/ti/c2000/C2000Ware_4_03_00_00/libraries/control/DCL/c28/include/DCLF32.h",

          line 460: error: expected an expression

          v = DCL_DISABLE_INTS;

                              ^

 

                          ^

 

          ^

 

"C:/ti/c2000/C2000Ware_4_03_00_00/libraries/control/DCL/c28/include/DCLF32.h",

          line 555: error: expected an expression

      v = DCL_DISABLE_INTS;

                          ^

 

"C:/ti/c2000/C2000Ware_4_03_00_00/libraries/control/DCL/c28/include/DCLF32.h",

          line 568: error: struct "dcl_df11" has no field "css"

      if (p->css->sts & STS_UPDATE_PENDING)

             ^

 

"C:/ti/c2000/C2000Ware_4_03_00_00/libraries/control/DCL/c28/include/DCLF32.h",

          line 568: error: expected an expression

      if (p->css->sts & STS_UPDATE_PENDING)

                                          ^

 

"C:/ti/c2000/C2000Ware_4_03_00_00/libraries/control/DCL/c28/include/DCLF32.h",

          line 570: error: expected an expression

          v = DCL_DISABLE_INTS;

                              ^

 

"C:/ti/c2000/C2000Ware_4_03_00_00/libraries/control/DCL/c28/include/DCLF32.h",

          line 590: error: identifier "bool" is undefined

  static inline bool DCL_isStableDF11(DCL_DF11 *p)

                ^

 

 

"C:/ti/c2000/C2000Ware_4_03_00_00/libraries/control/DCL/c28/include/DCLF32.h",

          line 641: error: struct "dcl_df11" has no field "css"

      p->sps->b0 = Kp * (Ki * p->css->T + 2.0f) / 2.0f;

                                 ^

 

"C:/ti/c2000/C2000Ware_4_03_00_00/libraries/control/DCL/c28/include/DCLF32.h",

          line 642: error: struct "dcl_df11" has no field "css"

      p->sps->b1 = Kp * (Ki * p->css->T - 2.0f) / 2.0f;

                                 ^

 

"C:/ti/c2000/C2000Ware_4_03_00_00/libraries/control/DCL/c28/include/DCLF32.h",

          line 733: error: expected an expression

      v = DCL_DISABLE_INTS;

                          ^

 

 

"C:/ti/c2000/C2000Ware_4_03_00_00/libraries/control/DCL/c28/include/DCLF32.h",

          line 746: error: struct "dcl_df13" has no field "css"

      if (p->css->sts & STS_UPDATE_PENDING)

             ^

 

"C:/ti/c2000/C2000Ware_4_03_00_00/libraries/control/DCL/c28/include/DCLF32.h",

          line 746: error: expected an expression

      if (p->css->sts & STS_UPDATE_PENDING)

                                          ^

 

"C:/ti/c2000/C2000Ware_4_03_00_00/libraries/control/DCL/c28/include/DCLF32.h",

          line 748: error: expected an expression

          v = DCL_DISABLE_INTS;

                              ^

 

 

21 errors detected in the compilation of "../Example_2833xAdcSoc.c".

gmake: *** [Example_2833xAdcSoc.obj] Error 1

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

 

**** Build Finished ****

 

  • Hi Ayush,

    It seemed odd are these errors in "DCLF32.h" shouldn't exist long as "DCL.h" is included, in which you have and it was included in DCLF32.h by default.

    Can you double-check if DCL.h exists and the content of DCL.h havn't been tempered with?

    Thanks,

    Sen Wang

  • Hi Sen Wang,

    Yes, DCL.h exists at the required location. I have made only one change of replacing float32_t with float in dcl files because earlier error was coming where float32_t variables were undefined.

    i have checked all header files but nowhere the variablesDCL_DISABLE_INTS,STS_UPDATE_PENDING,structure of css is defined.Do we have to add it manually?

    Thanks and Regards

    Ayush

  • Hi Ayush,

    css strcts, and DCL_DISABLE_INTS,STS_UPDATE_PENDING are part of DCL.h. It is possible that you've accidentally removed a section of a code. Can you try re-installating the C2000Ware too see if this problem persist?

    Best,

    Sen Wang

  • Hi Sen Wang,

    I have re installed the c2000ware.the previous error  has been resolved.But new error mentioned below has been coming:

    >> Compilation failure
    makefile:146: recipe for target 'Example_2833xAdcSoc.out' failed
    warning: cannot resolve archive
    C:/ti/c2000/C2000Ware_5_01_00_00/libraries/math/FPUfastRTS/c28/lib/rts2800_f
    pu32_fast_supplement.lib to a compatible library, as no input files have
    been encountered; build attribute information from input files is needed to
    determine library compatibility

    undefined first referenced
    symbol in file
    --------- ----------------
    _DCL_runPI_C1 ./Example_2833xAdcSoc.obj

    error: unresolved symbols remain
    error: errors encountered during linking; "Example_2833xAdcSoc.out" not built
    gmake: *** [Example_2833xAdcSoc.out] Error 1
    gmake: Target 'all' not remade because of errors.

    **** Build Finished ****

    Here the function has been defined in code as well as in header file.Still the error is coming.

  • Hi Ayush,

    DCL_runPI_C1 is an external assembly function, therefore please make sure to copy the "DCL_PI_C1.asm" file from the DCL source folder (c2000ware/libraries/control/DCL/c28/source/) to your ccs project.

     

    For the rts library, try using the EABI-format library instead, in properties of the ccs project, click on Build -> C2000 Linker -> File Search Path, and modify the name "rts2800_fpu32_fast_supplement.lib" to "rts2800_fpu32_fast_supplement_eabi.lib". If this doesn't work or you're using COFF binary format, then use "rts2800_fpu32_fast_supplement_coff.lib" instead.

    Best,

    Sen Wang