Atmel Evaluation Kit for the SAM4E Series of Flash Microcontrollers ATSAM4E-EK ATSAM4E-EK Data Sheet
![Atmel](https://files.manualsbrain.com/attachments/0369829915bda09f9c2e00fb805a7753579683b5/common/fit/150/50/8d2bf08978ec3e5bc63f4343ac5e91ce8d0e40045619fa520d910d64af8f/brand_logo.png)
Product codes
ATSAM4E-EK
SAM4E [DATASHEET]
Atmel-11157D-ATARM-SAM4E16-SAM4E8-Datasheet_12-Jun-14
592
7.
Select the master clock and processor clock
The master clock and the processor clock are configurable via PMC_MCKR.
The CSS field is used to select the clock source of the master clock and processor clock dividers. By default,
the selected clock source is the main clock.
the selected clock source is the main clock.
The PRES field is used to define the processor clock and master clock prescaler. The user can choose
between different values (1, 2, 3, 4, 8, 16, 32, 64). Prescaler output is the selected clock source frequency
divided by the PRES value.
between different values (1, 2, 3, 4, 8, 16, 32, 64). Prescaler output is the selected clock source frequency
divided by the PRES value.
Once the PMC_MCKR has been written, the user must wait for the MCKRDY bit to be set in the PMC_SR.
This can be done either by polling MCKRDY in PMC_SR or by waiting for the interrupt line to be raised if the
associated interrupt source (MCKRDY) has been enabled in PMC_IER. PMC_MCKR must not be
programmed in a single write operation. The programming sequence for PMC_MCKR is as follows:
This can be done either by polling MCKRDY in PMC_SR or by waiting for the interrupt line to be raised if the
associated interrupt source (MCKRDY) has been enabled in PMC_IER. PMC_MCKR must not be
programmed in a single write operation. The programming sequence for PMC_MCKR is as follows:
If a new value for CSS field corresponds to PLL clock,
̶
Program the PRES field in PMC_MCKR.
̶
Wait for the MCKRDY bit to be set in PMC_SR.
̶
Program the CSS field in PMC_MCKR.
̶
Wait for the MCKRDY bit to be set in PMC_SR.
If a new value for CSS field corresponds to main clock or slow clock,
̶
Program the CSS field in PMC_MCKR.
̶
Wait for the MCKRDY bit to be set in the PMC_SR.
̶
Program the PRES field in PMC_MCKR.
̶
Wait for the MCKRDY bit to be set in PMC_SR.
If at some stage parameters CSS or PRES is modified, the MCKRDY bit goes low to indicate that the master
clock and the processor clock are not yet ready. The user must wait for MCKRDY bit to be set again before
using the master and processor clocks.
clock and the processor clock are not yet ready. The user must wait for MCKRDY bit to be set again before
using the master and processor clocks.
Note:
IF PLLx clock was selected as the master clock and the user decides to modify it by writing in CKGR_PLLxR, the
MCKRDY flag will go low while PLLx is unlocked. Once PLLx is locked again, LOCKx goes high and MCKRDY is set.
While PLLx is unlocked, the master clock selection is automatically changed to slow clock for PLLA. For further
information, see
MCKRDY flag will go low while PLLx is unlocked. Once PLLx is locked again, LOCKx goes high and MCKRDY is set.
While PLLx is unlocked, the master clock selection is automatically changed to slow clock for PLLA. For further
information, see
Code Example:
write_register(PMC_MCKR,0x00000001)
wait (MCKRDY=1)
write_register(PMC_MCKR,0x00000011)
wait (MCKRDY=1)
The master clock is main clock divided by 2.
8.
Select the programmable clocks
Programmable clocks are controlled via registers, PMC_SCER, PMC_SCDR and PMC_SCSR.
Programmable clocks can be enabled and/or disabled via PMC_SCER and PMC_SCDR. Three
programmable clocks can be used. PMC_SCSR indicates which programmable clock is enabled. By default
all programmable clocks are disabled.
programmable clocks can be used. PMC_SCSR indicates which programmable clock is enabled. By default
all programmable clocks are disabled.
PMC_PCKx registers are used to configure programmable clocks.
The CSS field is used to select the programmable clock divider source. Several clock options are available:
main clock, slow clock, master clock, PLLACK, . The slow clock is the default clock source.
main clock, slow clock, master clock, PLLACK, . The slow clock is the default clock source.
The PRES field is used to control the programmable clock prescaler. It is possible to choose between
different values (1, 2, 4, 8, 16, 32, 64). Programmable clock output is prescaler input divided by PRES
parameter. By default, the PRES value is set to 0 which means that PCKx is equal to slow clock.
different values (1, 2, 4, 8, 16, 32, 64). Programmable clock output is prescaler input divided by PRES
parameter. By default, the PRES value is set to 0 which means that PCKx is equal to slow clock.