AN663 P RECISION 32™ M CU F A M I L Y C LOCKING O PTIONS 1. Introduction The 32-bit Precision32™ MCU family features a highly configurable clock structure. The advanced highperformance bus (AHB) and advanced peripheral bus (APB) have many options available for clocking. In addition, firmware can disable most peripheral clocks to save power. The clock to the module must be enabled before firmware can modify the registers. The first initialization step in all peripheral initialization routines should enable the clock to the module. The corresponding Precision32 family reference manual contains detailed descriptive and usage information on each of the clock sources mentioned in this document. 2. Clock Sources The AHB drives the core and memory on ARM® Cortex™-M3 devices. The APB drives the peripherals and peripheral registers. The AHB on the Precision32 devices has several options for clock sources: Low Power Oscillator, Low Frequency Oscillator, RTC Oscillator, External Oscillator, PLL Oscillator, and USB Oscillator. The APB clock is either equal to AHB or a divide by 2 version of it, so it is always synchronized with the AHB clock. Table 1 describes the oscillators that can serve as clock sources for the AHB bus. Figure 1 shows an example clock control block diagram. Table 1. AHB Clock Source Summary Oscillator Name Short Name Module Frequency Use Case Low Power Oscillator LPOSCn LPOSCn 20 MHz or 2.5 MHz High frequency and lower power consumption required Low Frequency Oscillator LFOSCn RTCn 16.4 kHz Low power, slow frequency required; no room for external RTC watch crystal RTC Oscillator RTCnOSC RTCn 32.768 kHz Low power, slow, accurate frequency required; room for external RTC watch crystal External Oscillator EXTOSCn EXTOSCn Crystal: 10 kHz to 25 MHz CMOS: 10 kHz to 50 MHz RC or C: up to 1.6 MHz Very accurate frequency required; room for external components PLL Oscillator PLLnOSC PLLn 23 MHz to maximum device frequency Flexible, fast, and accurate frequency required USB Oscillator USBnOSC USBn 48 MHz Very accurate fast frequency required; no flexibility needed Rev. 0.1 2/12 Copyright © 2012 by Silicon Laboratories AN663 AN663 Clock Control RAM RTC0 Oscillator Memory Area 2 LFOSC0 AHB clock Memory Area 3 LPOSC0 AHB Clock Divider Memory Area 4 Peripheral 0 External Oscillator PLL0 Oscillator Peripheral 1 APB Clock Divider APB clock Peripheral 2 Peripheral 3 USB0 Oscillator Peripheral 4 Figure 1. Example Precision32 Clock Control Block Diagram 2 Flash Rev. 0.1 AN663 2.1. Low Power Oscillator (LPOSCn) The low power oscillator is the default oscillator after reset. The default, factory-calibrated frequency of this oscillator is 20 MHz, but a divide by 8 version is also available as an AHB clock source. This oscillator starts very quickly and automatically turns on and off as needed. This oscillator consumes less power than other oscillators, but may not be as accurate over voltage and temperature. There are no configuration bits for this oscillator. Figure 2 shows the block diagram for the low power oscillator. LPOSCn Module Divided LPOSCn Clock Low Power Oscillator LPOSCn Clock Automatic Start/ Stop Control Figure 2. Low Power Oscillator Block Diagram 2.2. Low Frequency Oscillator (LFOSCn) The low frequency oscillator is part of the RTC module and can be selected as an RTC timer clock source in addition to the AHB clock source. The factory-calibrated output frequency of this oscillator is 16.4 kHz. This oscillator consumes less power than other oscillators, but will not be as accurate as the external RTC watch crystal. Figure 3 shows the block diagram for the low frequency and RTC oscillators. Rev. 0.1 3 AN663 2.3. RTC Oscillator (RTCnOSC) The RTC oscillator is part of the RTC module and is derived from the 32.768 kHz watch crystal or CMOS oscillator. This oscillator can be a source for the AHB or selected as the RTC timer clock source. The load capacitance for the watch crystal is internal and adjustable, so no external components other than the crystal are required. The crystal should be connected directly across the RTC1 and RTC2 pins on the device, and these pins should be configured for analog input mode. The RTC oscillator is more accurate than the low frequency oscillator, allowing for precision timekeeping with the 32-bit RTC timer. Figure 3 shows the block diagram for the low frequency and RTC oscillators. RTCn Module RTCnOSC_OUT RTCnOSC Clock External CMOS Clock Load Capacitance RTCn_OUT RTC1 Additional RTC Module Components RTC1 RTC External Oscillator Control RTC2 External Crystal RTC1 32.768 kHz RTC Timer Low Frequency Oscillator LFOSCn Clock RTC2 Frequency Adjust Figure 3. Low Frequency and RTC Oscillator Block Diagram 4 Rev. 0.1 AN663 2.4. External Oscillator (EXTOSCn) The AHB clock may be derived from the external oscillator module. The external oscillator supports four different external oscillators: crystal, CMOS, RC, and C. Figure 4 depicts a block diagram for the external oscillator module. External RC Oscillator External C Oscillator VIO XTAL2 XTAL2 EXTOSCn Module XTAL1 External Crystal XTAL2 External Oscillator Control EXTOSCn Clock XTAL1 10 M XTAL2 External CMOS Oscillator XTAL2 Figure 4. External Oscillator Block Diagram Rev. 0.1 5 AN663 2.4.1. Crystal Mode When operating in crystal mode, the external oscillator module supports crystals ranging from 10 kHz to 25 MHz. The module requires a 10 Mresistor across the crystal pins and two loading capacitors between the crystal pins and ground. Both of the crystal pins must be configured for analog input mode. Figure 5 shows the external crystal oscillator hardware configuration. SiM3xxxx Device C XTAL1 10 M C EXTOSCn Module XTAL2 Figure 5. External Crystal Oscillator Configuration The capacitors provide the load capacitance required by the crystal for correct oscillation. These capacitors are “in series” as seen by the crystal and “in parallel” with the stray capacitance of the XTAL1 and XTAL2 pins. Note: The recommended load capacitance depends upon the crystal and the manufacturer. Refer to the crystal data sheet when completing these calculations. Equation 1 describes the equation for determining the load capacitance for the two capacitors. The CA and CB values are the capacitors connected to the crystal leads. The CS value is the total stray capacitance of the PCB, which is typically between 2 pF and 5 pF per pin for a typical layout where the crystal is as close as possible to the pins. CA CB C L = --------------------- + C S CA + CB Equation 1. Crystal Load Capacitors If CA and CB are the same (C), the resulting equation is shown in Equation 2. C C L = ---- + C S 2 Equation 2. Simplified Crystal Load Capacitors For example, using Equation 2 with a 32.768 kHz tuning-fork crystal with a recommended load capacitance of 12.5 pF placed as close to the pins as possible (3 pF per pin) results in crystal load capacitors of 13 pF each. Crystal oscillator circuits are quite sensitive to PCB layout. The crystal should be placed as close as possible to the XTAL pins on the device. The traces should be as short as possible and shielded with ground plane from any other traces that could introduce noise or interference. 6 Rev. 0.1 AN663 2.4.2. CMOS Mode When operating in CMOS mode, the external oscillator module supports CMOS oscillators with output frequencies ranging from 10 kHz to 50 MHz. The external CMOS clock should be connected directly to the XTAL2 pin configured in digital input mode. The XTAL1 pin should be left floating. The CMOS oscillator mode is available with a divide by 2 stage, ensuring the clock has a 50% duty cycle. 2.4.3. RC Mode The external oscillator module supports output frequencies up to 1.6 MHz when operating in RC mode. The RC components should be connected to XTAL2 configured for analog mode, while XTAL1 should be left floating. Figure 6 shows the external RC oscillator hardware configuration. SiM3xxxx Device VIO XTAL1 EXTOSCn Module R XTAL2 C Figure 6. External RC Oscillator Configuration The capacitor used in the RC network should have a value no greater than 100 pF, and the resistor should be no smaller than 10 k. For very small capacitors, the parasitic capacitance in the PCB layout may dominate the total capacitance. The oscillation frequency can be determined by Equation 3, where f is the frequency in MHz, R is the pull-up resistor value in k., and C is the capacitor value in the XTAL2 pin in pF. 3 1.23 10 f = --------------------------RC Equation 3. RC Oscillation Frequency The RC Oscillator mode is only available with a divide by 2 stage, which ensures that the clock derived from the external oscillator has a duty cycle of 50%. The equation for the EXTOSCn output frequency is shown in Equation 4. 3 f 1.23 10 f OUT = --- = --------------------------2 2RC Equation 4. EXTOSCn Output Frequency in RC Mode Rev. 0.1 7 AN663 2.4.4. C Mode When operating in C mode, the external oscillator module supports frequencies up to 1.6 MHz. The capacitor should connect directly to XTAL2 configured for analog mode. XTAL1 should be left floating. Figure 7 shows the external C oscillator hardware configuration. SiM3xxxx Device XTAL1 EXTOSCn Module XTAL2 C Figure 7. External C Oscillator Configuration To determine the required module settings, select the capacitor to be used and find the frequency of oscillation according to Equation 5, where f is the frequency of oscillation in MHz, C is the capacitor value in pF, VDD is the device power supply in Volts, and KF is the K Factor. KF f = --------------------C V DD Equation 5. C Oscillation Frequency The C oscillator mode is only available with a divide by 2 stage, which ensures that the clock derived from the external oscillator has a duty cycle of 50%. The equation for the EXTOSCn output frequency is shown in Equation 6. f KF f OUT = --- = ------------------------------2 2 C V DD Equation 6. EXTOSCn Output Frequency in C Mode 8 Rev. 0.1 AN663 2.5. PLL Oscillator (PLLnOSC) The PLLn module available on SiM3xxxx devices is a digital PLL capable of generating output frequencies between 23 MHz and the maximum device operating frequency. The PLL has configurable output ranges and frequencies, multiple reference clock inputs, locking on either the falling or rising edge of the reference, DCO frequency LSB dithering to provide finer average output frequencies, spectrum spreading to reduce generated system noise, low jitter, and fast lock times. The PLLn module also supports three output modes: free-running DCO, frequency-locked, and phase-locked. The PLL can lock on a reference frequency and then switch to free-running DCO mode to save power. Figure 8 displays the PLLn module block diagram. PLLn Module RTCn Oscillator Divided Low Power Oscillator EXTOSCn Clock USBn Oscillator Reference Frequency (FREF) N+1 M+1 Phase and Frequency Adjuster OUTMD CAL DITHER RANGE Digitally-Controlled Oscillator (DCO) Spectrum Spreading Output Frequency (FDCO) Figure 8. PLL Module Block Diagram Rev. 0.1 9 AN663 2.6. USB Oscillator (USBnOSC) The USB oscillator is part of the USBn module and operates at a factory-calibrated 48 MHz. When connected to the USB bus, the clock recovery mechanism can constantly adjust the oscillator frequency relative to the full-speed frame reference, creating a very accurate clock source. This oscillator is within the USB specification across voltage and temperature, allowing the application system to be hardware USB certified without an external oscillator. This oscillator can be used as the AHB clock source even if the USB peripheral is not used. Figure 9 displays the USBn module block diagram. USBn Module USBnOSC Clock Recovery Internal USBn Oscillator EXTOSCn PLLnOSC D+ D- Serial Interface Engine Transceiver Figure 9. USB Module Block Diagram 10 Rev. 0.1 AN663 3. Clocks and the Peripherals The APB clock drives most peripherals and their registers. The exceptions to this are lower power peripherals that run from the RTC Oscillator or the Low Frequency Oscillator directly. For peripherals that run from the APB clock, disabling the clock to the module in the device clock control module (CLKCTRL) will disable the clock to both the module and the module’s registers. For peripherals that run from another clock source, disabling the clock to the module will disable the clock to the module’s registers only and the module will continue to run. 4. Reset Behavior On SiM3xxxx devices, the low power oscillator (LPOSCn) is the default oscillator after a reset. In addition, the clocks to most peripherals are disabled to save power. The clock to the module must be enabled before firmware can modify the registers. The first initialization step in all peripheral initialization routines should enable the clock to the module. Rev. 0.1 11 AN663 CONTACT INFORMATION Silicon Laboratories Inc. 400 West Cesar Chavez Austin, TX 78701 Tel: 1+(512) 416-8500 Fax: 1+(512) 416-9669 Toll Free: 1+(877) 444-3032 Please visit the Silicon Labs Technical Support web page: https://www.silabs.com/support/pages/contacttechnicalsupport.aspx and register to submit a technical support request. The information in this document is believed to be accurate in all respects at the time of publication but is subject to change without notice. Silicon Laboratories assumes no responsibility for errors and omissions, and disclaims responsibility for any consequences resulting from the use of information included herein. Additionally, Silicon Laboratories assumes no responsibility for the functioning of undescribed features or parameters. Silicon Laboratories reserves the right to make changes without further notice. Silicon Laboratories makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does Silicon Laboratories assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation consequential or incidental damages. Silicon Laboratories products are not designed, intended, or authorized for use in applications intended to support or sustain life, or for any other application in which the failure of the Silicon Laboratories product could create a situation where personal injury or death may occur. Should Buyer purchase or use Silicon Laboratories products for any such unintended or unauthorized application, Buyer shall indemnify and hold Silicon Laboratories harmless against all claims and damages. Silicon Laboratories and Silicon Labs are trademarks of Silicon Laboratories Inc. Other products or brandnames mentioned herein are trademarks or registered trademarks of their respective holders. 12 Rev. 0.1