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;

}