TWR-K60N512-KEIL Freescale Semiconductor, TWR-K60N512-KEIL Datasheet - Page 47

no-image

TWR-K60N512-KEIL

Manufacturer Part Number
TWR-K60N512-KEIL
Description
K60N512 Keil Tower Kit
Manufacturer
Freescale Semiconductor
Series
Kinetisr
Type
MCUr

Specifications of TWR-K60N512-KEIL

Rohs Compliant
YES
Contents
4 Boards, Documentation, DVD
Peak Reflow Compatible (260 C)
Yes
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
For Use With/related Products
Freescale Tower System, K60N512
4.3.3.1 Code example and explanation
// Using the RTC OSC as Ref Clk
// Configure and enable the RTC OSC
// select the load caps (application dependent) and the oscillator enable bit
// note that other bits in this register may need to be set depending on the intended use of
the RTC
// select the RTC oscillator as the MCG reference clock
// ensure MCG_C2 is in the reset state, key item is RANGE = 0 to select the correct FRDIV
factor
// Select the Reference Divider and clear IREFS to select the osc
// CLKS=0, select the FLL as the clock source for MCGOUTCLK
// FRDIV=0, set the FLL ref divider to divide by 1
// IREFS=0, select the external clock
// IRCLKEN=0, disable IRCLK (can enable if desired)
// IREFSTEN=0, disable IRC in stop mode (can keep it enabled in stop if desired)
// wait for Reference clock to switch to external reference
// Wait for clock status bits to update
// Can select the FLL operating range/freq by means of the DRS and DMX32 bits
// Must first ensure the system clock dividers are set to keep the core and
// bus clocks within spec.
// core = FLL (48 MHz), bus = FLL (48 MHz), flexbus = PLL (48 MHz), flash = PLL/2 (24 MHz)
// In this example DMX32 is set and DRS is set to 1 = 48 MHz from a 32.768 kHz
// crystal
4.4 Clocking system device hardware implementation
It is possible to provide all the system level clocks from internal sources. However, if the
PLL is to be used or an accurate reference clock is required, an external clock must be
provided. This can be from an externally generated clock source that provides a square
wave clock or it can be from an internal oscillator using an external crystal or resonator.
There are two independent on-chip crystal oscillators, one for the RTC and one to
provide a reference for the main system clocks.
The RTC clock source comes only from the dedicated RTC oscillator. In many cases, the
RTC oscillator will require only an external 32 kHz crystal. The oscillator feedback
resistor is integrated within the device along with selectable internal load capacitors.
Freescale Semiconductor
RTC_CR |= RTC_CR_SC16P_MASK | RTC_CR_SC8P_MASK | RTC_CR_OSCE_MASK;
time_delay_ms(1000); // wait for the RTC oscillator to initialize
SIM_SOPT2 |= SIM_SOPT2_MCGCLKSEL_MASK;
MCG_C2 = 0x0;
MCG_C1 = 0x0;
while (MCG_S & MCG_S_IREFST_MASK){}
while (((MCG_S & MCG_S_CLKST_MASK) >> MCG_S_CLKST_SHIFT) != 0x0){}
SIM_CLKDIV1 = SIM_CLKDIV1_OUTDIV1(0) | SIM_CLKDIV1_OUTDIV2(0)
MCG_C4 |= MCG_C4_DMX32_MASK | MCG_C4_DRST_DRS(1);
| SIM_CLKDIV1_OUTDIV3(0) | SIM_CLKDIV1_OUTDIV4(1);
Kinetis Quick Reference User Guide, Rev. 0, 11/2010
Chapter 4 Clocking System
47

Related parts for TWR-K60N512-KEIL