English
Language : 

SAM4L Datasheet, PDF (104/1185 Pages) ATMEL Corporation – ATSAM ARM-based Flash MCU
Figure 10-2. Synchronous Clock Generation
BPM
Power Save Mode
ATSAM4L4/L2
Main Clock
Sources
MCSEL
Prescaler
0
Main Clock
1
CPUDIV
CPUSEL
Mask
CPUMASK
CPU Clocks
AHB Clocks
APBx Clocks
10.6.1.1
10.6.1.2
Selecting the Main Clock Source
The common main clock can be connected to RCSYS or a set of other clock sources. For details
about the other main clock sources, refer to Section 10.7.1 ”Main Clock Control” on page 110.
By default, the main clock will be connected to RCSYS. The user can connect the main clock to
an other source by writing the MCSEL field in the MCCTRL register. This must only be done
after that unit has been enabled and is ready, otherwise a deadlock will occur. Care should also
be taken that the new frequency of the synchronous clocks does not exceed the maximum fre-
quency for each clock domain.
Selecting Synchronous Clock Division Ratio
The main clock feeds an 8-bit prescaler, which can be used to generate the synchronous clocks.
By default, the synchronous clocks run on the undivided main clock. The user can select a pres-
caler division for the CPU clock by writing CPUDIV in CPUSEL register to one and CPUSEL in
CPUSEL register to the value, resulting in a CPU clock frequency:
fCPU = fmain / 2(CPUSEL+1)
Similarly, the clock for the APBx can be divided by writing their respective registers. To ensure
correct operation, frequencies must be selected so that fCPU ≥ fAPBx. Also, frequencies must
never exceed the specified maximum frequency for each clock domain.
CPUSEL and PBxSEL can be written without halting or disabling peripheral modules. Writing
CPUSEL and PBxSEL allows a new clock setting to be written to all synchronous clocks at the
same time. It is possible to keep one or more clocks unchanged by writing a one to the registers.
This way, it is possible to, e.g., scale CPU and speed according to the required performance,
while keeping the APBx frequency constant.
For modules connected to the AHB bus, the APB clock frequency must be set to the same fre-
quency as the CPU clock.
42023C–SAM–02/2013
104