CHAPTER 2-1: Clock
52 FM4 Peripheral Manual, Doc. No. 002-04856 Rev. *E
4. Clock Setup Procedure Examples
This section explains procedure examples of setting up clocks.
Setup Procedure Examples
Figure 4-1 Example of Clock Setup Procedure (Power-on -> High-speed CR Run Mode -> Desired Clock Mode)
(Except TYPE5-M4 products)
Access the Clock Stabilization Wait Time Register
(CSW_TMR). Set the main clock oscillation
Access the Interrupt Enable Register (INT_ENR).
Set the oscillation stabilization wait interrupt.
Enable the main clock oscillation in the System Clock
Mode Control Register (SCM_CTL:MOSCE=1).
High-speed CR / low-speed CR oscillation stabilization
wait completed. high-speed CR runs as a master clock.
with SCM:STR:RCM=SCM_CTL:RCS, changing.
the mode to the selected clock mode.
Access each bus prescaler register.
BSC_PSR : Base Clock Prescaler
Set bus clock frequency division.
Enable the sub oscillation.
Access the PLL Clock Stabilization Wait Time
Register (PSW_TMR). Set the PLL oscillation
stabilization wait time and PLL input clock.
Access the Interrupt Enable Register (INT_ENR).
Set the oscillation stabilization wait interrupt.
Access the PLL control register1, 2 (PLL_CTL1,
PLL_CTL2). Set the PLL multiplication ratio.
Enable the PLL oscillation in the System Clock
Mode Control Register (SCM_CTL:PLLE=1).
Access the Interrupt Clear Register (INT_CLR).
Clear the oscillation satbilization wait interrupt factor.
Check main clock oscillation stable bit of the System
Clock Mode Status Register (SCM_STR:MORDY=1).
Waiting for high-speed CR / low-speed CR
Set the master clock switch control bit of the System Clock Mode Control
Register (SCM_CTL:RCS) to desired clock mode.
APBC0_PSR : APB0 Prescaler
TTC_PSR : Trace Clock Prescaler
Check PLL oscillation stable bit of the System
Clock Mode Status Register (SCM_STR:PLRDY=).
APBC1_PSR : APB1 Prescaler
APBC2_PSR : APB2 Prescaler