Lab 10: CLA Floating-Point FIR Filter
C2000 Microcontroller Workshop - Control Law Accelerator 10 - 19
and __cla_scratchpad_end. The scratchpad size is designated using the linker
defined symbol CLA_SCRATCHPAD_SIZE. We are reserving a 0x100 word memory
hole to be used as the compiler scratchpad area. This value can be changed based on
your application. At the top of Lab_10.cmd notice the preprocessor option setting for
including the scratchpad. We will make use of this setting later in the lab exercise.
Setup CLA Initialization
During the CLA initialization, the CPU memory block L3DPSARAM needs to be configured as
CLA program memory. This memory space contains the CLA Task routines. A one-time force
of the CLA Task 8 will be executed to clear the delay buffer. The CLA Task 1 has been
configured to run an FIR filter. The CLA needs to be configured to start Task 1 on the ADCINT1
interrupt trigger. The next section will setup the PIE interrupt for the CLA.
5. Open ClaTasks_C.cla and notice Task 1 has been configured to run an FIR filter.
Within this code the ADC result integer (i.e. the filter input) is being first converted to
floating-point, and then at the end the floating-point filter output is being converted back
to integer. Also, notice Task 8 is being used to initialize the filter delay line. The .cla
extension is recognized by the compiler as a CLA C file, and the compiler will generate
CLA specific code. At the beginning of the file notice the line that includes the
F2806x_Cla_typedefs.h header file. This file is needed to make the CLA C
compiler work correctly with the peripheral register header files when unsupported data
types are used.
6. Edit Cla_10.c to implement the CLA operation as described in the objective for this
lab exercise. Configure the L3DPSARAM memory block to be mapped to CLA program
memory space. Configure the L2DPSARAM memory block to be mapped to CLA data
memory space for the CLA C compiler scratchpad. Set Task 1 peripheral interrupt
source to ADCINT1 and set the other Task peripheral interrupt source inputs to no
source. Enable CLA Task 1 interrupt. Enable the use of the IACK instruction to trigger
a task, and then enable Task 8 interrupt.
7. Open Main_10.c and add a line of code in main() to call the InitCla() function.
There are no passed parameters or return values. You just type
InitCla();
at the desired spot in main().
8. In Main_10.c comment out the line of code in main() that calls the InitDma()
function. The DMA is no longer being used. The CLA will directly access the ADC
RESULT0 register.
Setup PIE Interrupt for CLA
Recall that ePWM2 is triggering the ADC at a 50 kHz rate. In the IQmath FIR Filter lab exercise,
the ADC generated an interrupt to the CPU, and the CPU implemented the FIR filter in the ADC
ISR. Then in the DMA lab exercise, the ADC instead triggered the DMA, and the DMA
generated an interrupt to the CPU, where the CPU implemented the FIR filter in the DMA ISR.
For this lab exercise, the ADC is instead triggering the CLA, and the CLA will directly read the
ADC result register and run a task implementing an FIR filter. The CLA will generate an