A typical CLA initialization sequence
is performed by the main CPU as described in this section.
- Copy CLA code into the CLA
program RAM: The source for the CLA code can initially reside in the
Flash or a data stream from a communications peripheral or anywhere the main CPU
can access. The debugger can also be used to load code directly to the CLA
program RAM during development.
- Initialize CLA data RAM, if
necessary: Populate the CLA data RAM with any required data coefficients
or constants.
- Configure the CLA registers:
Configure the CLA registers, but keep interrupts disabled until later (leave
MIER = 0):
- Enable the CLA
peripheral clock using the assigned PCLKCRn register: The
peripheral clock control (PCLKCRn) registers are defined in the
System Control and Interrupts chapter.
- Populate the CLA task
interrupt vectors:
- Select the task
interrupt sources: For each task select the interrupt source in
the CLA1TASKSRCSELx register. If a task is software triggered, select no
interrupt.
- Enable IACK to start a
task from software, if desired: To enable the IACK instruction
to start a task set the MCTL[IACKE] bit. Using the IACK instruction
avoids having to set and clear the EALLOW bit.
- Map CLA data RAM to
CLA space, if necessary:
- Map CLA program RAM to
CLA space:
- Initialize the PIE vector
table and registers: When a CLA task completes, the associated interrupt
in the PIE is flagged. The CLA overflow and underflow flags also have associated
interrupts within the PIE.
- Enable CLA tasks/interrupts:
Set appropriate bits in the interrupt enable register (MIER) to allow the
CLA to service interrupts. Note that a CLA task only triggers on a level
transition (a falling edge) of the configured interrupt source. If a peripheral
is enabled and an interrupt fires before the CLA is configured, then the CLA
does not recognize the interrupt edge and does not respond. To avoid this,
configure the CLA before the peripherals or clear any pending peripheral
interrupts before setting bits in the MIER register.
- Initialize other peripherals:
Initialize any peripherals (such as ePWM, ADC, and others) that generate
interrupt triggers for enabled CLA tasks.
The CLA is now ready to
service interrupts and the message RAMs can be used to pass data between the
CPU and the CLA. Mapping of the CLA program and data RAMs typically occurs
only during the initialization process. If the RAM mapping needs to be
changed after initialization, the CLA interrupts must be disabled and all
tasks must be completed (by checking the MIRUN register) prior to modifying
the RAM ownership.