This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to use CLA in TMS320F28075 for 3phase pll

Other Parts Discussed in Thread: TMS320F28075, CONTROLSUITE

hi, I am new to the concept of using CLA  can anyone share me a proper document for configuring and using a project using 3phase pll in CLA.

using TMS320F28075. 

  • Joseph,

    We do not have a ready example that does this, 

    I would begin with an example of CLA that is already working for F28075 like

    C:\ti\controlSUITE\device_support\F2807x\v200\F2807x_examples_Cpu1\cla_adc_fir32

    and the use the user guide located at C:\ti\controlSUITE\libs\app_libs\solar\v1.2

    to add it to the project, 

    you will have to change the triggers of the CLA task to be the one running at the PLL call rate.

    Above is the best advise i can provide at this moment. 

  • #pragma DATA_SECTION(X,"Cla1ToCpuMsgRAM")
    int32_t X;

    But it doesn't get incremented eventhough i use X++ in a task and the variable is declared as extern in the shared file .

    __interrupt void Cla1Task7 ( void )
    {
    ABC_DQ0_POS_CLA abc_dq0_pos1;


    abc_dq0_pos1.a = ADC_g_u16InputVoltagePhRMsg;
    abc_dq0_pos1.b = ADC_g_u16InputVoltagePhYMsg;
    abc_dq0_pos1.c = ADC_g_u16InputVoltagePhBMsg;
    __mdebugstop();
    X ++;
    }

    __interrupt void Cla1Task8()
    {
    __mdebugstop();
    SPLL_3ph_SRF_CLA_init(50,0.00005,spll1);

    }

    The ADC_g_u16InputVoltagePhRMsg, ADC_g_u16InputVoltagePhYMsg,ADC_g_u16InputVoltagePhBMsg;

    which are defined as below in main and as extern in shared.h are working fine.

    #pragma DATA_SECTION(ADC_g_u16InputVoltagePhRMsg,"CpuToCla1MsgRAM");
    Uint16 ADC_g_u16InputVoltagePhRMsg;
    #pragma DATA_SECTION(ADC_g_u16InputVoltagePhYMsg,"CpuToCla1MsgRAM");
    Uint16 ADC_g_u16InputVoltagePhYMsg;
    #pragma DATA_SECTION(ADC_g_u16InputVoltagePhBMsg,"CpuToCla1MsgRAM");
    Uint16 ADC_g_u16InputVoltagePhBMsg;

    what may be the reason for the different behavior of 

    Cla1ToCpuMsgRAM variable X;

    this reply has been modified

  • Joseph,

    Just a clarification the example i pointed to you is CLA Assembly only, you will need the C based example

    C:\ti\controlSUITE\device_support\F2807x\v200\F2807x_examples_Cpu1\cla_sqrt\cpu01

    For the debug question, you do need to put the MDEBUGSTOP instructions before and after the CLA task routines to stop the ?? 

    processors.wiki.ti.com/.../Control_Law_Accelerator_(C2000_CLA)_Debug_on_CCS_FAQ

     How do I insert a breakpoint into CLA code?

    Assembly code: First add the MDEBUGSTOP instruction into the code where you would like to halt. Then rebuild and load the code. Remember that the MDEBUGSTOP instruction must not be within 3 instructions (before or after) a branch (MBCNDD), call (MCCNDD) or return (MRCNDD) instruction. When the CLA halts the MDEBUGSTOP instruction will be in the D2 (decode 2) phase of the pipeline. From there you can single step the CLA or run to the next breakpoint or MSTOP.
    C Code: Use the __mdebugstop() intrinsic to insert a breakpoint. Then rebuild and load the code. When the CLA halts the MDEBUGSTOP instruction will be in the D2 (decode 2) phase of the pipeline. From there you can single step the CLA or run to the next breakpoint or MSTOP.
    Did you do this??
    Otherwise the CLA may not be stopped at all and may just jump to the routine and finish it, in your case because your regular task is task 7 , end of task 7 may appear as the beginning on Task 8, and it may look as if Task 8 is repeatedly executing 
  • Thanks for your advice ,

    The issue that i am facing now is i am using two tasks one for initialization(task 8) and other(task 7) for processing . the initialization task is called using cla1forcetask8andWait() ( only once), the processing task is called using Adc interrupt trigger. Ihave used the __mdebugstop(); the task is given below.

    • The issue is while debugging the debugger executes task 8 again and again.

    in the register view ' MIRUN = 8 ';

    • I have created a variable using

    #pragma DATA_SECTION(X,"Cla1ToCpuMsgRAM")
    int32_t X;



    But it doesn't get incremented eventhough i use X++ in a task and the variable is declared as extern in the shared file .


    __interrupt void Cla1Task7 ( void )
    {
    ABC_DQ0_POS_CLA abc_dq0_pos1;


    abc_dq0_pos1.a = ADC_g_u16InputVoltagePhRMsg;
    abc_dq0_pos1.b = ADC_g_u16InputVoltagePhYMsg;
    abc_dq0_pos1.c = ADC_g_u16InputVoltagePhBMsg;
    __mdebugstop();
    X ++;
    }



    __interrupt void Cla1Task8()
    {
    __mdebugstop();
    SPLL_3ph_SRF_CLA_init(50,0.00005,spll1);

    }





    The ADC_g_u16InputVoltagePhRMsg, ADC_g_u16InputVoltagePhYMsg,ADC_g_u16InputVoltagePhBMsg;

    which are defined as below in main and as extern in shared.h are working fine.

    #pragma DATA_SECTION(ADC_g_u16InputVoltagePhRMsg,"CpuToCla1MsgRAM");
    Uint16 ADC_g_u16InputVoltagePhRMsg;
    #pragma DATA_SECTION(ADC_g_u16InputVoltagePhYMsg,"CpuToCla1MsgRAM");
    Uint16 ADC_g_u16InputVoltagePhYMsg;
    #pragma DATA_SECTION(ADC_g_u16InputVoltagePhBMsg,"CpuToCla1MsgRAM");
    Uint16 ADC_g_u16InputVoltagePhBMsg;





    what may be the reason for the different behavior of

    Cla1ToCpuMsgRAM variable X;

  • Hi Guys,

    I also have the same problem. My code in .cla file is:

    int16 loopCounter1;
    
    //
    // Task 1
    //
    __interrupt void Cla1Task1 ( void )
    {
    #if (CLA_DEBUG==1)
    __mdebugstop();
    #endif
            Uint32 sdfmReadFlagRegister;
            loopCounter1++;
            if(loopCounter1 == 100) {
            	loopCounter1 = 0;
            }
    }

    But the variable loopCounter1 is never incremented. I use CCS 6.1.3 and controlSuite 3.4.0.

    I will try with the updated versions CCS 6.2 and controlSuite 3.4.1 and let you know.

  • Hi Joseph,
    Do you get this warning?
    <Linking>
    warning #10247-D: creating output section ".bss_cla" without a SECTIONS specification
  • Hi Prakash,

    i think no,

    u can solve the issue by defining
    #pragma DATA_SECTION(loopCounter1 ,"Cla1ToCpuMsgRAM")
    int16 loopCounter1 ;

    my issue is with linker file ...
    i am still trying to understand it (linker file)..
  • Hi Joseph,
    Even without Cla1ToCpuMsgRAM it works for me in a different program.
    e2e.ti.com/.../541834
    I have explained it more clearly here.
  • Got solution for my problem.

    If you are using the default linker command file you will notice the cla compiler sections (including .bss_cla) are placed in a #if #endif block with the condition being CLA_C=1. You need to define this in the project properties under

    c2000 Linker -> Advanced Options -> Command file preprocessing -> in the "--define" box add CLA_C=1 (no spaces before and after =)

    I set this and it worked. Hope it helps you.
  • Hi Joseph,
    Also you should predefine CPU1 and _FLASH.
    c2000 Compiler -> Advanced Options -> Predefined Symbols-> in the "--define, -D" box add CPU1 and _FLASH