Because of the Thanksgiving holiday in the U.S., TI E2E™ design support forum responses may be delayed from November 25 through December 2. Thank you for your patience.

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.

CCS/TMS320F28335: TMS320F28335

Part Number: TMS320F28335
Other Parts Discussed in Thread: C2000WARE

Tool/software: Code Composer Studio

Hi,

I have found the below code in the TI forum for PI control  , which i am trying to run in code composer v6, but am getting a error " #include "DCLF32.h" in this part . Kindly help me as am new to code composer 

#include "DSP28x_Project.h"     // Device Headerfile and Examples Include File
#include "DCL.h"
#include "DCLF32.h"
#include "DCL_fdlog.h"
#include "DCLC28.h"
float32_t rk = 20.0f;
float32_t yk;
float32_t lk;
float32_t uk;
float Duty;
DCL_PI pi1 = PI_DEFAULTS;
//
// Function Prototypes
//
Uint16 LoopCount;
Uint16 ConversionCount;
void adc_isr(void);
void gpio_select(void);
void InitEPwm1(void);
void control_Isr(void);
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
    InitAdc();  // For this example, init the ADC
    gpio_select();
    InitEPwm1();
    PieCtrlRegs.PIEIER1.bit.INTx6 = 1;
    IER |= M_INT1;
       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.
       /* 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
       //
       AdcRegs.ADCTRL2.bit.EPWM_SOCA_SEQ1 = 1;
       AdcRegs.ADCTRL2.bit.INT_ENA_SEQ1 = 1;  // Enable SEQ1 interrupt (every EOS)
                            // control loop not saturated
    EINT;           // Enable Global interrupt INTM
    ERTM;           // Enable Global realtime interrupt DBGM
    for(;;);
}
//
// 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 = PWM1A
        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=(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
    //
    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;
}
  • Is the error you are getting that the compiler could not open the header file "DCLF32.h"? 

    If so, then please refer to this page:  http://software-dl.ti.com/ccs/esd/documents/sdto_ccs_build-errors.html#error-could-not-open-source-file-xxx-h-

    Basically you need to make sure that the path to this header file is added to the Compiler's --include_path option inside your project (under Project Properties->Build->Compiler->Include Options). If you have C2000Ware installed, this header file is in the \libraries\control\DCL\c28\include directory inside C2000Ware, so you would need that path to the compiler options.

    Hope this helps.

     

  • Hi Aarti ,

    No that's not the error , the error is in the DCL32.h source file and the errors are like float32_t undefined .

    Am getting a total of something around 80 errors in that source file

    Thank you , I appreciate your help

    Regards,

    Prithvi

  • Prithvi,

    It is difficult to say what is triggering the error without more specifics or access to your project. It sounds more like a generic C code error rather than a CCS specific error. You might get some clues for identifying the source of the error by searching the E2E forum or even the internet for similar errors.

    Also if this is a custom project with your own source code, (ie) not an example project from TI, I would suggest comparing your code with an example from TI that uses DCLF32.h. You may be missing some other required header files, etc.

    If the above suggestions do not help resolve the error, we may need to have a look at your project to provide more suggestions.
  • Hi Aarti,

    I dont think the code which i posted is an example , because i got it from this forum . I suppose the Project you asked for is the code which i posted earlier , can you please try running that code and may be find out what the error is ?

    Can you suggest me a program for PI Control of Three Phase Inverter by controlling the PWM signal ? it would be really helpful.

    I thank you so much for your help and valuable time .

    with regards,

    Prithvi 

  • Prithvi Raj said:
    I suppose the Project you asked for is the code which i posted earlier

    Actually I was asking for the entire project, not just the source code for this one source file. Clearly the project requires other resources (source/header files, maybe libraries etc) for it to build successfully. I would require the complete project. To create an archive of the project that you can attach to this forum post, please follow the procedure here: 
    http://software-dl.ti.com/ccs/esd/documents/ccs_sharing-projects.html#sharing-linked-file-projects

    Prithvi Raj said:
    Can you suggest me a program for PI Control of Three Phase Inverter by controlling the PWM signal ?

    The best place to ask this question is the device forum. Please start a new thread for this question and post it to the C2000 Microcontrollers forum.

  • Hi Aarti,

    I am sorry for replying late ,

    I am not supposed to have internet facility in my machine where i have CCS V.6 , will it be possible to communicate through gmail, so that i can share you the whole project for your kind guidance .

    I ll attach my mail id : primeprithvi@gmail.com 

    If this is not comfortable is there any other way to share the project ?

    Thank you so much for your kind guidance .

    With regards,

    Prithvi

  • I would prefer to keep all communications on this public forum or you can also share the code privately via private conversation (but that is also initiated from this forum).

    If the machine with CCS does not internet access, perhaps you could export the project (as described in the link I provided earlier) and copy it to a flash drive. Take it to a machine with internet access and attach it here.
  • Hi Aarti,

    Greetings,

    I am attaching the Project completely , Please check it out.

    Thank you for your valuable time .

    With regards,

    Prithvi

    Controller.zip

  • Prithvi,

    I looked at the project and unfortunately it is simply not complete enough to build properly.

    For instance, I was able to get past the "identifier "float32_t" is undefined" errors by adding this to Example_controller.c:
    typedef float float32_t;

    However, that just exposes all the other compiler errors for several "undefined identifiers". This is a general C programming error, not something specific to CCS. Basically there are many definitions missing which likely means that you are missing some source or header files required to resolve those definitions.

    Unfortunately, since this code is not from TI, I'm afraid there isn't much more we can do to help here.
  • Hi Aarti,

    Thank you so much for your kind help and your valuable time .

    If you dont mind can you please provide me any project related to PWM Control using PI or PID Control method ?, i am asking you this because i am not getting a reply in other forum as you do here. 

    Really appreciate for what you are doing .

    Thank you.

    With regards,

    Prithvi 

  • Prithvi,

    Prithvi Raj said:
    If you dont mind can you please provide me any project related to PWM Control using PI or PID Control method ?, i am asking you this because i am not getting a reply in other forum as you do here. 

    I'm sorry but I just don't have the expertise on that topic to direct you properly. Your best bet is to post this as a new question to the C2000 microcontroller device forum. 

  • Hi Aarti,

    Thank you so much for all your patient responses and your valuable time . Its really a wonderful thing that you replied , i never got a clear response like this in this forum.

    I will try in the other forum to get a solution .

    With regards,

    Prithvi

  • Hi Aarti,

    After our last conversation , I managed to put up a program with reference to HVPM Program , but i am getting a build error and i am not able to address that error . 

    Can you please guide me through this ?

    3323.Controller.zip

    Thank you. 

    With regards,

    Prithvi

  • Prithvi,

    I would request that you please start a new thread for this new issue/question as it helps to keep the conversations focused on a single problem and that also makes it more useful to other customers who are searching for similar topics.

    When you create a new thread, please include details about the exact build error you are seeing. The more detailed and focused your question is, the better guidance we can provide. Thanks for your understanding.