Lab 9: CLA Floating-Point FIR Filter
9 - 18 TMS320F2837xD Microcontroller Workshop - Control Law Accelerator
Lab 9: CLA Floating-Point FIR Filter
Objective
The objective of this lab exercise is to become familiar with operation and programming of the
CLA. In this lab exercise, the ePWM1A generated 2 kHz, 25% duty cycle symmetric PWM
waveform will be filtered using the CLA. The CLA will directly read the ADC result register and a
task will run a low-pass FIR filter on the sampled waveform. The filtered result will be stored in a
circular memory buffer. Note that the CLA is operating concurrently with the CPU. As an
operational test, the filtered and unfiltered waveforms will be displayed using the graphing feature
of Code Composer Studio.
Lab 9: CLA Floating-Point FIR Filter
CPU copies
result to
buffer during
CLA ISR
ADC
RESULT0
ePWM2
jumper
wire
ADCINA0
...
data
memory
Display
using CCS
TB Counter
Compare
Action Qualifier
ePWM1
ePWM2 triggering ADC on period
match using SOCA trigger every
20 µs (50 kHz)
CLA
Cla1Task1
Cla1Task2
Cla1Task8
Recall that a task is similar to an interrupt service routine. Once a task is triggered it runs to
completion. In this lab exercise two tasks will be used. Task 1 contains the low-pass filter. Task
8 contains a one-time initialization routine that is used to clear (set to zero) the filter delay chain.
Since there are tradeoffs between the conveniences of C programming and the performance
advantages of assembly language programming, three different task scenarios will be explored:
1. Filter and initialization tasks both in C
2. Filter task in assembly, initialization task in C
3. Filter and initialization tasks both in assembly
These three scenarios will highlight the flexibility of programming the CLA tasks, as well as show
the required configuration steps for each. Note that scenarios 1 and 2 are the most likely to be
used in a real application. There is little to be gained by putting the initialization task in assembly
with scenario 3, but it is shown here for completeness as an all-assembly CLA setup.