Datasheet
SAM9G45 [DATASHEET]
Atmel-6438O-ATARM-SAM9G45-Datasheet_08-Dec-15
342
The bit number within the Peripheral Clock Control registers (PMC_PCER, PMC_PCDR, and PMC_PCSR) is the
Peripheral Identifier defined at the product level. Generally, the bit number corresponds to the interrupt source
number assigned to the peripheral.
25.9 Programmable Clock Output Controller
The PMC controls two signals to be output on external pins PCKx. Each signal can be independently programmed
via the PMC_PCKx registers.
PCKx can be independently selected between the Slow clock, the Master Clock, the PLLACK/PLLADIV2, the
UTMI PLL output and the main clock by writing the CSS and CSSMCK fields in PMC_PCKx. Each output signal
can also be divided by a power of 2 between 1 and 64 by writing the PRES (Prescaler) field in PMC_PCKx.
Each output signal can be enabled and disabled by writing 1 in the corresponding bit, PCKx of PMC_SCER and
PMC_SCDR, respectively. Status of the active programmable output clocks are given in the PCKx bits of
PMC_SCSR (System Clock Status Register).
Moreover, like the PCK, a status bit in PMC_SR indicates that the Programmable Clock is actually what has been
programmed in the Programmable Clock registers.
As the Programmable Clock Controller does not manage with glitch prevention when switching clocks, it is strongly
recommended to disable the Programmable Clock before any configuration change and to re-enable it after the
change is actually performed.
25.10 Programming Sequence
1. Enabling the 12 MHz Main Oscillator:
The main oscillator is enabled by setting the MOSCEN field in the CKGR_MOR. In some cases it may be
advantageous to define a start-up time. This can be achieved by writing a value in the OSCOUNT field in the
CKGR_MOR.
Once this register has been correctly configured, the user must wait for MOSCS field in the PMC_SR to be
set. This can be done either by polling the status register or by waiting the interrupt line to be raised if the
associated interrupt to MOSCS has been enabled in the PMC_IER.
2. Setting PLLA and divider:
All parameters needed to configure PLLA and the divider are located in the CKGR_PLLAR.
The DIVA field is used to control divider itself. A value between 0 and 255 can be programmed. Divider
output is divider input divided by DIVA parameter. By default DIVA parameter is set to 0 which means that
divider is turned off.
The OUTA field is used to select the PLLA output frequency range.
The MULA field is the PLLA multiplier factor. This parameter can be programmed between 0 and 254. If
MULA is set to 0, PLLA will be turned off, otherwise the PLLA output frequency is PLLA input frequency
multiplied by (MULA + 1).
The PLLACOUNT field specifies the number of slow clock cycles before LOCKA bit is set in the PMC_SR
after CKGR_PLLAR has been written.
Once the PMC_PLLAR has been written, the user must wait for the LOCKA bit to be set in the PMC_SR.
This can be done either by polling the status register or by waiting the interrupt line to be raised if the
associated interrupt to LOCKA has been enabled in the PMC_IER. All parameters in CKGR_PLLAR can be
programmed in a single write operation. If at some stage one of the following parameters, MULA, DIVA is
modified, LOCKA bit will go low to indicate that PLLA is not ready yet. When PLLA is locked, LOCKA will be
set again. The user is constrained to wait for LOCKA bit to be set before using the PLLA output clock.