Multipurpose Clock Generator (MCG)
MCF51CN128 Reference Manual, Rev. 6
Freescale Semiconductor
6-23
6.5.3.2
Example 2: Moving from PEE to BLPI Mode: Bus Frequency =16 kHz
In this example, the MCG moves through the proper operational modes from PEE mode with an 8MHz
crystal configured for an 16 MHz bus frequency (see previous example) to BLPI mode with a 16 kHz bus
frequency.First, the code sequence is described. Then a flowchart is included that illustrates the sequence.
1. First, PEE must transition to PBE mode:
a) MCGC1 = 0x98 (%10011000)
– CLKS (bits 7 and 6) set to %10 to switch the system clock source to the external reference
clock
b) Loop until CLKST (bits 3 and 2) in MCGSC are %10, indicating that the external reference
clock is selected to feed MCGOUT
2. Then, PBE must transition directly to FBE mode or first through BLPE mode and then to FBE
mode:
a) BLPE: If a transition through BLPE mode is desired, first set LP (bit 3) in MCGC2 to 1
b) BLPE/FBE: MCGC3 = 0x18(%00011000)
– PLLS (bit 6) clear to 0 to select the FLL. At this time, with an RDIV value of %011, the PLL
reference divider of 8 is switched to an FLL divider of 256 (see
reference frequency of 8 MHz / 256 = 31.25 kHz. If RDIV was not previously set to %011
(necessary to achieve required 31.25-39.06 kHz FLL reference frequency with an 8 MHz
external source frequency), it must be changed prior to clearing the PLLS bit. In BLPE
mode,changing this bit only prepares the MCG for FLL usage in FBE mode. With PLLS =
0, the VDIV value does not matter.
– DIV32 (bit 4) set to 1 (if previously cleared), automatically switches RDIV bits to the proper
reference divider for the FLL clock (divide-by-256)
c) BLPE: If transitioning through BLPE mode, clear LP (bit 3) in MCGC2 to 0 here to switch to
FBE mode
d) FBE: Loop until PLLST (bit 5) in MCGSC is clear, indicating that the current source for the
PLLS clock is the FLL
e) FBE: Optionally, loop until LOCK (bit 6) in the MCGSC is set, indicating that the FLL has
acquired lock. Although the FLL is bypassed in FBE mode, it remains enabled and running.
3. Next, FBE mode transitions into FBI mode:
a) MCGC1 = 0x5C (%01011100)
– CLKS (bits7 and 6) in MCGSC1 set to %01 to switch the system clock to the internal
reference clock
– IREFS (bit 2) set to 1 to select the internal reference clock as the reference clock source
– RDIV (bits 5-3) remain unchanged because the reference divider does not affect the internal
reference.
b) Loop until IREFST (bit 4) in MCGSC is 1, indicating the internal reference clock has been
selected as the reference clock source
c) Loop until CLKST (bits 3 and 2) in MCGSC are %01, indicating that the internal reference
clock is selected to feed MCGOUT