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/TMS320F28035: CLA task interrupt with CPU

Part Number: TMS320F28035
Other Parts Discussed in Thread: CONTROLSUITE

Tool/software: Code Composer Studio

I am working with DRV8301-HC-C2-KIT . project is instaspin BLDC.

I am trying to add a calculation routine in CLA. At some conditions the cla task1 have to trigger.

I have written the code and the cla task1 is executing only once.

What setting are to be done for looping the cla task1 with software interrupt.

Please help. 

  • Try any example in

    {CONTROLSUITE}\device_support\f2803x\v130\DSP2803x_examples_cla_ccsv5\

    For example, you have to use macro

    Cla1ForceTask1andWait();

    If you want to force task 1 in cla 1

    this macros are located in "DSP2803x_Cla_defines.h"

  • I have tried this Cla1ForceTask1andWait(); but this call will wait for the cla to complete the execution. But I have to work the cla task in the background. That is the cpu will not be delayed or interrupted by the cla task
  • try Cla1ForceTask1() that not wait
  • Please suggest the register settings
  • I don't understand:

    If you want to launch a task in CLA

    and then execute some operation with CPU

    you can use "Cla1ForceTask1AndWait()".

    I don't understand what settings are you intend ...

  • // the following code sets up the CLA and assigns memory for CLA use
    // It assigns only the program memory by default,
    // the User can edit the file, for data RAM allocation to the CLA
    // It also forces Task 8 which is used to carry out any initialization function
    // on variables residing in the CLAtoCPUMsgRAM

    void CLA_C_Init()
    {
    // This code assumes the CLA clock is already enabled in
    // the call to DevInit();
    //
    // EALLOW: is needed to write to EALLOW protected registers
    // EDIS: is needed to disable write to EALLOW protected registers
    //
    // The symbols used in this calculation are defined in the CLA
    // assembly code and in the CLAShared.h header file

    EALLOW;
    Cla1Regs.MVECT1 = ((Uint16)Cla1Task1 - (Uint16)&Cla1Prog_Start);
    Cla1Regs.MVECT2 = ((Uint16)Cla1Task2 - (Uint16)&Cla1Prog_Start);
    Cla1Regs.MVECT3 = ((Uint16)Cla1Task3 - (Uint16)&Cla1Prog_Start);
    Cla1Regs.MVECT4 = ((Uint16)Cla1Task4 - (Uint16)&Cla1Prog_Start);
    Cla1Regs.MVECT5 = ((Uint16)Cla1Task5 - (Uint16)&Cla1Prog_Start);
    Cla1Regs.MVECT6 = ((Uint16)Cla1Task6 - (Uint16)&Cla1Prog_Start);
    Cla1Regs.MVECT7 = ((Uint16)Cla1Task7 - (Uint16)&Cla1Prog_Start);
    Cla1Regs.MVECT8 = ((Uint16)Cla1Task8 - (Uint16)&Cla1Prog_Start);

    // Copy the CLA program code from its load address to the CLA program memory
    // Once done, assign the program memory to the CLA
    //
    // Make sure there are at least two SYSCLKOUT cycles between assigning
    // the memory to the CLA and when an interrupt comes in
    // Call this function even if Load and Run address is the same!
    MemCopy(&Cla1funcsLoadStart, &Cla1funcsLoadEnd, &Cla1funcsRunStart);


    asm(" RPT #3 || NOP");

    Cla1Regs.MMEMCFG.bit.PROGE = 1; // Configure the RAM as CLA program memory
    Cla1Regs.MMEMCFG.bit.RAM0E = 1; // configure RAM L1, F28035 as CLA Data memory 0
    Cla1Regs.MMEMCFG.bit.RAM1E = 1; // Configure RAM L2, F28035 as CLA data memory 1


    // Enable the IACK instruction to start a task
    // Enable the CLA interrupt 8 and interrupt 2
    asm(" RPT #3 || NOP");

    Cla1Regs.MCTL.bit.IACKE = 1;
    Cla1Regs.MIER.all = M_INT8;

    // No need to wait, the task will finish by the time
    // we configure the ePWM and ADC modules

    Cla1ForceTask8();

    EDIS;

    }
    I have done the cla init like this,
    for the software trigger from the main() what are the steps.
  • Have you enabled "Cla1Regs.MIER" bit of task you want to SW force ?

  • main() .......
    //code for cla1 task calling//
    if (CAL==1)
    {
    Find_Pos();
    EALLOW;

    asm(" RPT #3 || NOP");
    Cla1Regs.MCTL.bit.IACKE = 1;
    Cla1Regs.MIER.all = M_INT1;
    Cla1ForceTask1();
    EDIS;
    After this I fuse the code and check the flag CAL in Watch widow.
    Its Value changing only once. When the next call to cla1 task it is not changing. That is only the first time it is working.
  • Two questions:

    1. when the next call, what is the value of "Cla1Regs.MIOVF.bit.INT1" ?
    2. You set CAL in main code and you clear in CLA ?
  • 1. when the next call, what is the value of "Cla1Regs.MIOVF.bit.INT1" ?
    "Cla1Regs.MIOVF.bit.INT1" I am not checked.
    2. You set CAL in main code and you clear in CLA ?
    CAL is used to check whether the cla task is over or not.
    There is some other options for that. I am new in CLA.
    The Flag CAL clear when Enter in cla1 task and set when exit by the interrupt cla1 task(). CAL is a clatocpu memory.
    The Cla task is consists of around 4K bytes. So I cannot wait the cpu for the cla1task execution.

    Is  there any application example with Both CPU and CLA functions with software triggered CLA tasks.

    I think it will help me to solve the problem fast.

  • You can use

    MIRUN

    register to check CLA RUN status instead of CAL

    Go to page 709 of www.ti.com/.../spruhx5d.pdf



    If you say that CLA task not end I suspect there are some loops In the CLA
  • I agree with Mauro.

    Make sure the task as finished by hitting a MSTOP. When this happens the MIRUN bit for the task that was executed will be cleared.

    sal