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.

TMS320F280041: CLA

Part Number: TMS320F280041
Other Parts Discussed in Thread: C2000WARE

Customer using C2000™ Piccolo™ F28004x Series LaunchPad™Development Kit with CCSv9.1.

They have started using a CLA example project in CCSv9.1 that is structured similar to what they would like to do in their application. (C:\ti\C2000\C2000Ware_2_00_00_02\device_support\f28004x\examples\cla).  project name: cla_ex1_background_task.

 

It has 3 tasks, Task1 samples the internal ADC trigged by an EPWM pulse and performs a FIR Low Pass filter. A flag is set to notify the Background Task that a sample is ready.  Task7 is an initialization task trigged to run by software and a Background Task which runs continuously collecting sample from Task1 and preserving them in a circular buffer.  The circular buffer, “buffer”, is declared in the CPU main function and placed in CLADataRAM using the pragma

 

#pragma DATA_SECTION(buffer, "Cla1DataRam");

volatile float buffer[BUFFER_SIZE];

 

This buffer is accessible by both the CPU and the CLA. The example plots the buffer using CCS. They tried a small example by placing a 32-bit counter in Task1, incrementing the counter in Task1 and viewing the counter in the end-of-task interrupt service routine cla1Isr1().  They added the following code in cla_ex1_background_task.c

 

#pragma DATA_SECTION(Task1_Count, "Cla1DataRam");

volatile unsigned long Task1_Count;

 

and added to cla_ex1_background_task_shared.h

extern volatile unsigned long Task1_Count;

 

The Task1 code now has a statement “Task1_counter++” inserted after the ReadFlag

 

f_filteredValueReady = true;

Task1_Count++;

 

And they initialized Task1_Counter to zero in Task1.

 

When they put a breakpoint in the end-of-task1 interrupt service routine, they expect to see the variable Task1_Counter increment by 1 on each iteration. However, the value displayed for Task1_Counter in CCS is undefined (like random) so there is misalignment or something.  Missing something about the CLA.

unsigned long CLA_Counter = 0; //Global

#pragma CODE_SECTION(cla1Isr1, ".TI.ramfunc")

#endif

__attribute__((interrupt)) void cla1Isr1 ()

{

   CLA_Counter = Task1_Count;

   EALLOW;

   //

   // Clear the ADC interrupt flag so the next SOC can

   AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1U;

   // Acknowledge the end-of-task interrupt for task 1

   //

   PieCtrlRegs.PIEACK.bit.ACK11 = 1U;

   EDIS;

}

  • Hi Lawrence,

    I am looking into this and plan to have questions or recommendations for you by the end of today (Thursday).

    Regards

    Lori

  • Lawrence,

    As the project is supplied, the Cla1DataRam memory (RAMLS2) appears to be full.  Adding the counter to this memory should cause a build error.

    Was the linker command file or project changed in some way to get it to build?

    Please check the .map file to see where the counter ended up and if that memory is accessible by the CLA and CPU.

    Regards

    Lori

  • Lori,

    Yes customer modified the project.  Task1_Count is allocated to page 1 RAMLS2 at address 0x9000

    If needed I can share the project.

    Regards,

    Lawrence 

  • Lawrence,

    Have you checked that the counter was initialized correctly?   You indicated above the init is done in Task 1, but the init routine in the example is in Task 7.

    - Open a memory window to the counter 

    - Run past where the task is forced to init variables

    - If you have the CLA connected, it the CLA will halt at the mdebugstop and you can step through the CLA init code.

    //
    // Force task 7, the one time initialization task
    //
    Cla1Regs.MIFRC.bit.INT7 = 1U;

  • Lawrence Wong said:
    If needed I can share the project.

    Thanks for the offer.  It may take more time, but (within reason) I would rather teach how to debug an issue to enable others to do so :) 

    -Lori

  • Hi Lawrence,

    I wanted to see if further assistance is needed to resolve this issue or if my previous post helped.  If the issue is resolved, please press the "verified answer button" to let me know.  If not, provide further details.

    Regards

    Lori