28.6.1 Divider and Phase Lock Loop Programming

Each PLL is controlled the same way. The internal clock frequency is configured by setting PMC_PLL_CTRL1.MUL and PMC_PLL_CTRL1.FRACR.

PLLA can apply a division ratio on this internal clock to generate the clock for the PMC (PLLACK). UPLL always divides the internal clock by two to generate the clock for the PMC (UPLLCK) and the UTMI USB.

The COREPLLCK operating frequency is defined by the following formula:

f COREPLLCK = f ref MUL + 1 + FRACR 2 22

The PLLA clock frequency is defined by the following formula:


f PLLA Clock = f COREPLLCK DIVPMC + 1

The UPLL clock frequency is defined by the following formula:


f UPLL Clock = f COREUPLLCK 2

Each PLL sends a lock signal to the PMC to indicate its lock status. Once the lock signal has risen, the clock generated by the PLL is stable and can be sent to the PMC.

This signal reports the lock status of the PLL by setting the corresponding PMC_PLL_CTRL0.ENLOCK to ‘1’.

If the lock status is disabled, a start-up time can be used instead in the PMC_PLL_UPDT register. The start-up time is expressed as a number of MD_SLCK cycles. Once the counter has reached the specified value, a flag rises. The start-up time field can only be written while all PLLs are disabled (i.e., their PLLEN fields are null).

If both a start-up time and the lock are enabled, the lock sent by the PLL is read once the start-up time has elapsed.

If neither the start-up time nor the lock are enabled, there is no way to know the lock status of the PLL.

The PLL also embeds an unlock status that informs when the PLL lock is lost. When enabled, this status is read once the start-up time (if defined) has elapsed.

The lock and unlock status can be used as interrupts.

See the following figure.

Figure 28-4. PLL Controls

Follow the steps below to enable a PLL:

  1. Define the ID (ID=n) and start-up time by configuring the fields PMC_PLL_UPDT.ID and PMC_PLL_UPDT.STUPTIM. Set PMC_PLL_UPDT.UPDATE to ‘0’.
  2. Configure PMC_PLL_ACR. See recommended values in the Electrical Characteristics section.
  3. Define the MUL and FRACR to be applied to PLL(n) in PMC_PLL_CTRL1.

    If UPLL is being configured, follow Step 4. to Step 7., otherwise jump to Step 8.

  4. Write PMC_PLL_ACR.UTMIBG to ‘1’ to enable the UTMI internal bandgap.
  5. Wait 10 µs.
  6. Write PMC_PLL_ACR.UTMIVR to ‘1’ to enable the UTMI internal regulator.
  7. Wait 10 µs.
  8. Set PMC_PLL_UPDT.UPDATE to ‘1’. PMC_PLL_UPDT.ID must equal the one written during Step 1., otherwise the update is cancelled.
  9. In PMC_PLL_CTRL0, write a ‘1’ to ENLOCK and to ENPLL and configure DIVPMC (for PLLA only, as UPLL has a fixed divider value) and ENPLLCK.
  10. Set PMC_PLL_UPDT.UPDATE to ‘1’. PMC_PLL_UPDT.ID must equal the one written during Step 1. otherwise the update is cancelled.
  11. Wait for the lock bit to rise by polling the PMC_PLL_ISR0 or by enabling the corresponding interrupt in PMC_PLL_IER.
  12. Disable the interrupt (if enabled).
  13. Enable the unlock interrupt to quickly detect a failure on the generation of the PLL clock.

Once enabled (PMC_PLL_CTRL0.ENPLL=1), the PLL core generates its core clock (COREPLLCK).

Once the PLL has been enabled and has locked, the PLL configuration can be modified without switching off the cell.

The clock generated by the PLL is sent to the PMC if ENPLLCK is set to ‘1’ and the PMC_PLL_UPDT.UPDATE bit has then been written to ‘1’.

To disable a PLL, the following sequence must be applied:

  1. If the PLL drives a section of the system that is active, modify the source clock of the system.
  2. Define the ID (ID=n) of the PLL to be switched off in PMC_UPDT. The bit UPDATE in this register must be set at 0 in this step.
  3. In PMC_PLL_CTRL0, set ENPLLCK to 0 and leave ENPLL at ‘1’.
  4. Set PMC_PLL_UPDT.UPDATE to ‘1’. PMC_PLL_UPDT.ID must equal the one written during step 2, otherwise the update is cancelled.
  5. Write a ‘0’ to PMC_PLL_CTRL0.ENPLL.
  6. If a UPLL is being powered down, write a ‘0’ to PMC_PLL_ACR.UTMIBG and PMC_PLL_ACR.UTMIVR.
  7. Set PMC_PLL_UPDT.UPDATE to ‘1’. PMC_PLL_UPDT.ID must equal the one written during Step 2., otherwise the update is cancelled.