See the InitAuxPll() function in your
device’s controlSUITE installation for an example.
If USB functionality is needed, the
auxiliary clock (AUXPLLCLK) must be configured to produce 60 MHz. The procedure is
similar to the system clock setup:
- Select the reference clock source
(AUXOSCCLK) by writing to CLKSRCCTL2.AUXOSCCLKSRCSEL.
- Wait two AUXOSCCLK cycles.
- Set up the auxiliary PLL. If the
PLL is not needed, bypass the PLL and power the PLL down by writing a 0 to
AUXPLLCTL1.PLLEN. To use the PLL:
- Set the desired auxiliary
clock divider by writing to AUXCLKDIVSEL.AUXPLLDIV.
- ) Configure CPU Timer 2
to be clocked from AUXPLL. Keep the counter frozen.
- ) Power down the AUXPLL
by clearing AUXPLLCTL1[PLLEN].
- Set the integral and
fractional multipliers simultaneously. This automatically enables the
PLL. Be sure that the product of AUXOSCCLK and the multiplier is in the
range specified in the data sheet.
- Wait for the PLL to lock
by polling the AUXPLLSTS.LOCKS bit. This takes 16 µs plus 1024
AUXOSCCLK cycles.
- Connect the auxiliary PLL output clock (AUXPLLRAWCLK) to
AUXPLLCLK by writing a 1 to AUXPLLCTL1.PLLCLKEN.
- Start CPU Timer 2. In a large for() loop, continue
polling the TCR[TIF] overflow flag. If the flag is set, the AUXPLL
started correctly. If not set, repeat steps (c) through (g). The
auxiliary clock configuration can be changed at run time. Changing the
AUXOSCCLK source automatically bypasses the PLL and sets the multiplier
to zero. Changing the multiplier from one non-zero value to another
temporarily bypasses the PLL until the PLL re-locks.
The auxiliary clock configuration can
be changed at run time. Changing the AUXOSCCLK source automatically bypasses the PLL
and sets the multiplier to zero. Changing the multiplier from one non-zero value to
another temporarily bypasses the PLL until the PLL re-locks.
Note: If the AUXOSCCLK source is changed
on the same AUXOSCCLK cycle as the multiplier, the PLL is disabled but the
AUXPLLMULT register shows the written value. This can happen when the system PLL is
enabled before configuring the auxiliary PLL (CPUCLK >> AUXOSCCLK). To avoid
this issue, wait 2 AUXOSCCLK cycles between changing the clock source and writing to
AUXPLLMULT.