Understanding S08P Internal Clock Source

Similar documents
Working around ERR7026 according to application needs

i.mx 6Solo/6DualLite Product Lifetime Usage Estimates

Three-Phase Power Meter Hardware Design Reference Manual

Adding a run control interface into an existing CodeWarrior for MCU v10.x project

General C Functions for the etpu Covers the MCF523x, MPC5500, MPC5600, MPC5700, MPX40 and all etpu-equipped Devices

TWR-KV10Z32 Sample Code Guide for CodeWarrior Board configuration, software, and development tools

DDR Validation Tool Getting Started Guide

TWR-KV10Z32 Sample Code Guide for IAR Board configuration, software, and development tools

Watt Saver Software Component (WSC)

FRDM-K64F Board Errata

HVP-KV10Z32 User s Guide

Using DMA for Pulse Counting on S32K

Generating a Quick and Controlled Waveform With the DAC

S12VR Hardware Design. Guidelines. 1 Introduction. 2 Hardware Design. Guidelines. 2.1 Voltage regulator. Freescale Semiconductor

Mask Set Errata for Mask 2N27B

Getting Started with Freescale MQX RTOS for Kinetis SDK and MDK-ARM Keil

How to setup pre-build steps in CodeWarrior for Microcontrollers v10.x

Processor Expert Software for i.mx Processors Version 1.0

Freedom FRDM-MC-LVBLDC Development Platform User s Guide

HVP-KV31F120M User s Guide

HVP-MC56F82748 User s Guide

i.mxrt1050 Product Lifetime Usage Estimates

Flash Core Voltage Supply Requirements and Considerations

Quick Start Guide for FRDM-FXS-MULTI-B

Table of Contents 1 Typical Applications General Description Block Diagram Pinout System Connections Typical A

Integrate TWR-EPD Software with MQX RTOS Based on the TWR-K21F120M Platform

Quick Start Guide for TWR-S08MM128-KIT TOWER SYSTEM MC9S08MM128. The industry s most complete solution for portable medical applications

Getting Started with Freescale MQX RTOS for Kinetis SDK and Kinetis Design Studio IDE

Building U-Boot in CodeWarrior ARMv8

CodeWarrior Development Studio for StarCore 3900FP DSP v SP3 Release Notes

MQX RTOS Release Notes for Kinetis SDK v1.2.0 for KL33Z64 for FRDM-KL43Z Freescale Freedom Development Platform

i.mx 6ULL Product Usage Lifetime Estimates

MM912_634, Silicon Analog Mask (M91W) / Digital Mask (N53A) Errata

Emulating I2C Bus Master by using FlexIO

Emulating I2S bus on KE06

TWR-LS1021A Getting Started

i.mx 6 Android JB 4.3_1.1.1 Patch Release Notes

PMSM Field-Oriented Control Using MC56F84789 DSC With Encoders Demo Guide

Freedom FRDM-KV31F Development Platform User s Guide

MQX RTOS Release Notes for Kinetis SDK FRDM- KV10Z Freescale Freedom Development Platform

Getting Started with Freescale MQX RTOS for Kinetis SDK and ARM GCC

Single Chip Module (SCM) Package-on- Package (PoP) Assembly Guide

Mask Set Errata for Mask 0N22G

i.mx 6UltraLite Product Usage Lifetime Estimates

Emulating Dual SPI Using FlexIO

Using FCCU on MPC5744P

Using an External GCC Toolchain with CodeWarrior for Power Architecture

FRDM-KL03Z User s Guide

MMPF0100 Errata for Mask 1N47F and 1N18J

Using the MPC5777M MCAN Module to Exchange CAN FD Messages

Freescale Semiconductor Data Sheet: Technical Data

Collecting Linux Trace without using CodeWarrior

Kinetis Bootloader to Update Multiple Devices in a Field Bus Network

i.mx 7 Dual/Solo Product Lifetime Usage

FRDM-KE02Z User s Manual

CodeWarrior Development Studio Processor Expert RTOS Adapter User Guide

KIT34901EFEVB Evaluation Board

P1010RDB-PB Quick Start Guide

Kinetis Updater User's Guide

PCIe Certification Guide for i.mx 6Dual/6Quad and i.mx 6Solo/6DualLite

Freescale MQX USB Stack for TWR-K24F120M GA User s Guide

TWR-LS1021A Getting Started

SPI topics: watchdog, serial output and parity check

Freescale MKW40Z IEEE Software Quick Start Guide

MPXHZ6130A, 15 to 130 kpa, Absolute, Integrated Pressure Sensor

Getting Started with MQX RTOS for Kinetis SDK

MC34708, Silicon Errata

Kinetis SDK Release Notes for the TWR-K24F120M Tower System Module

Using an FFT on the Sigma-Delta ADCs

Configuring DDR in U-Boot using QCVS

Kinetis KE1xF512 MCUs

Getting Started with the MCU Flashloader

Intelligent Sensing Framework 2.1 for Kinetis Errata Sheet

OpenSDA on TWR-KW2x. User s Guide Rev 1.1

Kinetis SDK Freescale Freedom FRDM-KL03Z Platform User s Guide

1 Introduction. Freescale Semiconductor Application Note. Document Number: AN3460 Rev. 0, 06/2007

FRDM-KL26Z User s Guide

AIOP Task Aware Debug

Component Development Environment Getting Started Guide

WPR1500-LDO MP Receiver V2.1 Reference Design User s Guide

KITVALVECNTLEVM Valve Controller SoC Evaluation Kit

MPXH6300A, 20 to 300 kpa, Absolute, Integrated, Pressure Sensor

Kinetis Bootloader v1.2.0 Release Notes

MMA845x Driver: Quick Start Guide

MAC57D5xx Start-Up Sequence

EMC Design Tips for Kinetis E Family

Model Based Development Toolbox MagniV for S12ZVC Family of Processors

Freescale MQX RTOS TWR-K64F120M Release Notes

MP3V5050V, -50 to 0 kpa, Gauge Pressure Sensor

KIT33972AEWEVBE Evaluation Board

Kinetis USB-KW41Z Wireless Protocol Sniffer Quick Start Guide

for Freescale MPC55xx/MPC56xx Microcontrollers V2.10 Quick Start

ORDERING INFORMATION # of Ports Pressure Type Device Name

Comparison of MC9S08QE128 and MCF51QE128 Microcontrollers Scott Pape and Eduardo Montanez Systems Engineering, Freescale Microcontroller Division

Kinetis SDK v Release Notes for KV5x Derivatives

for StarCore DSP Architectures Quick Start for the Windows Edition

Power Consumption and Measurement of i.mx RT1020

Load Position-Independent Code (PIC) on a Kinetis Platform Using the IAR EWARM Compiler

Freescale Kinetis Software Development Kit Release Notes

KITUSBSPIEVME USB-to-SPI Interface Board Featuring the MC68HC908JW32

Transcription:

Freescale Semiconductor Application Note Document Number: AN4763 Rev. 0, 8/2013 Understanding S08P Internal Clock Source By: William Jiang 1 Introduction The S08P family integrates an internal clock source module (ICS) which provides clock source options for the system. The clock source can be from an internal reference clock or external reference clock. To use an external crystal or resonator as the reference clock, the external oscillator module (XOSC) must be enabled. With both the ICS module and the XOSC module, the family can provide six operational modes and one stop mode to meet different application requirements. This application note describes the use of both modules as well as the ICS operation mode switch with the sample code provided. Contents 1. Introduction................................ 1 2. Overview of ICS............................. 1 2.1.ICS Module............................. 2 3. Overview of XOSC.......................... 3 4. ICS Operation Mode......................... 4 5. Conclusion................................. 9 6. References................................. 9 7. Glossary.................................. 10 2 Overview of ICS The following figure shows the ICS module block diagram: Freescale Semiconductor, Inc., 2013. All rights reserved.

Overview of ICS 2.1 ICS Module Figure 1. ICS block diagram The ICS module provides several clock source options for S08P devices. The module contains a frequency-locked loop (FLL) that is controllable by either an internal or external reference clock. The internal reference clock has nine trim bits available, and can be trimmed from 31.25 khz to 39.0625 khz. The typical trim value at the factory is 32.768 khz, 31.25 khz, or 39.0625 khz, depending on the different devices. The module can select a clock from the FLL or bypass the FLL as a source of the MCU system clock. The selected clock source is passed through a reduced bus divider controlled by BDIV to generate ICSOUT, which allows a lower output clock frequency to be derived. The FLL loop locks the frequency to the fixed 512 multiplied by the reference frequency. Assume the FLL reference frequency (ICSFFCLK) is Fref, then the FLL output frequency after lock (Fdcoout) is (Fref 512). In addition, the FLL reference frequency must be within the range of 31.25 khz to 39.0625 khz. This can be fullfilled via ICS_C1[RDIV] bits and the XOSC ICS_OSCSC[RANGE] bit. The digitally-controlled oscillator (DCO) is optimized for 16 MHz to 20 MHz frequency range. The total deviation of DCO output from trimmed frequency for over fixed voltage and temperature range of 0 to 70º C can be within ± 1%. In Figure1, ICSOUT is the bus clock provided to the core and all peripherals. ICSFFCLK is the fixed reference clock, and it must be no more than 1/4 of the ICSOUT frequency to be valid. This clock can be used as a FlexTimer clock source. ICSIRCLK is internal reference clock output, and can be selected as the clock source to the WDOG module. The frequency of ICSIRCLK can be trimmed via ICS_C3[SCTRIM] and ICS_C4[SCFTRIM] bits. Writing a larger value to the trim bits slows down the ICSIRCLK frequency, while writing a smaller value to the trim bits speeds up the ICSIRCLK frequency. 2 Freescale Semiconductor

Overview of XOSC ICSLCLK is derived from the DCO, and is a BDC alternate clock, which can be used by development tools to speed up BDC communications in systems where the bus clock is slow. ICSBDCCLK is the actual BDC clock. CORECLK is the core clock, and in this family it is the same as ICSOUT. 3 Overview of XOSC The external oscillator (XOSC) module allows an external crystal, ceramic resonator, or other external clock sources to produce the external reference clock. The oscillator is a Pierce-type oscillator. The output of the XOSC module can be used as the reference of ICS to generate a system bus clock, and/or a clock source of watchdog (WDOG), real-time counter (RTC), and/or analog-to-digital (ADC) modules. It supports an external clock from 4 MHz to 20 MHz in high range mode (high frequency mode) and 32 khz crystals in low range mode (low frequency mode) as shown in the following table. Table 1. XOSC Modes ICS_OSCSC[RANG E] ICS_OSCSC[HG O] Mode Frequency Range Connection 0 0 Low freqency, low power 0 1 Low frequency, high gain 1 0 High frequency, low Power 1 1 High frequency, high gain 32 khz Crystal Connection 1 32 khz Crystal Connection 2 4 MHz to 20 MHz Crystal Connection 3 4 MHz to 20 MHz Crystal Connection 2 The possible crystal/resonator connections are shown in the following figures. Figure 2. Crystal connection 1 Freescale Semiconductor 3

ICS Operation Mode Figure 3. Crystal connection 2 Figure 4. Crystal connection 3 The recommended component values for Rs, Rf, C1 and C2 can be found in the device data sheet. In addition, the XOSC also supports direct input from an external clock in bypass mode ( ICS_OSCSC[OSCEN] = 0, and ICS_OSCSC[OSCOS] = 0) as shown in the figure below: 4 ICS Operation Mode Figure 5. Clock connection The ICS has seven modes of operation: FEI, FEE, FBI, FBILP, FBE, FBELP, and stop. Figure 6 shows the seven states of the ICS as a state diagram. The arrows indicate the allowed movements between the states. Out of reset, it is in FEI mode. To enter one of other modes, the arrow must be followed. When in low power mode (FBELP or FBILP), FLL is disabled, so the BDC alternate clock ICSLCLK is not active and will not be used as BDC clock source for BDC communications (for example, when the 4 Freescale Semiconductor

ICS Operation Mode BDM debugger is used). In this case, the MCU bus clock must be selected as the BDC clock for BDC communications. When FLL is engaged (FEx) or bypassed (FBx), the reference clock to FLL must be configured within 31.25 khz to 39.0625 khz. Stop mode is entered whenever the MCU enters a STOP state. In this mode, all ICS clock signals are static except in the following cases: ICSIRCLK will be active in stop mode when all the following conditions occur: IRCLKEN bit is written to 1; IREFSTEN bit is written to 1. Figure 6. ICS operation mode The following code fragment shows how to transition to clock mode from FEI to FEE mode. void FEI_to_FEE(void) / enable OSC with high gain, high range and select oscillator output as OSCOUT ICS_OSCSC = ICS_OSCSC_OSCEN_MASK ICS_OSCSC_OSCSTEN_MASK / enable stop #if defined(cryst_high_gain) ICS_OSCSC_HGO_MASK / Rs must be added and be large up to 200K #if (EXT_CLK_CRYST >=4000) ICS_OSCSC_RANGE_MASK ICS_OSCSC_OSCOS_MASK;/ for crystal only Freescale Semiconductor 5

ICS Operation Mode asm ; / wait for OSC to be initialized while(!(ics_oscsc & ICS_OSCSC_OSCINIT_MASK) / divide down external clock frequency to be within 31.25K to 39.0625K #if (EXT_CLK_CRYST == 8000) / 8MHz ICS_C1_RDIV = 3;/ now the divided frequency is 8000/256 = 31.25K #elif (EXT_CLK_CRYST == 4000) / 4MHz ICS_C1_RDIV = 2;/ now the divided frequency is 4000/128 = 31.25K #elif (EXT_CLK_CRYST == 16000) / 16MHz ICS_C1_RDIV = 4;/ now the divided frequency is 16000/512 = 31.25K #elif (EXT_CLK_CRYST == 20000) / 20MHz ICS_C1_RDIV = 4;/ now the divided frequency is 20000/512 = 39.0625K #elif (EXT_CLK_CRYST == 32) ICS_C1_RDIV = 0; #else #error "Error: crystal value not supported!\n"; / change FLL reference clock to external clock ICS_C1_IREFS = 0; / wait for the reference clock to be changed to external asm ; while(ics_s & ICS_S_IREFST_MASK / wait for FLL to lock while(!(ics_s & ICS_S_LOCK_MASK) if(((ics_c2 & ICS_C2_BDIV_MASK)>>5)!= 0) 6 Freescale Semiconductor

ICS Operation Mode ICS_C2_BDIV = 0; / clear Loss of lock sticky bit ICS_S = ICS_S_LOLS_MASK; The following code fragment shows how to transition to clock mode from FEE to FEI mode: void FEE_to_FEI(void) ICS_C1_IREFS = 1;/ select internal reference for FLL / wait for the reference clock to be changed asm ; while(!(ics_s & ICS_S_IREFST_MASK) / wait for FLL to lock while(!(ics_s & ICS_S_LOCK_MASK) / clear Loss of lock sticky bit ICS_S = ICS_S_LOLS_MASK; if(((ics_c2 & ICS_C2_BDIV_MASK)>>5)!= 0) ICS_C2_BDIV = 0; The following code fragment shows how to transition to clock mode from FEI to FBE mode: void FEI_to_FBE(void) / assume external crystal is 8Mhz or 4MHz / change clock source to external reference clock ICS_C1_IREFS = 0; ICS_C1_CLKS = 2; ICS_C2_LP = 0; / wait for the reference clock to be changed Freescale Semiconductor 7

ICS Operation Mode asm ; while(ics_s_clkst!= 2 while(ics_s_irefst / now external clock is the system clock if(((ics_c2 & ICS_C2_BDIV_MASK)>>5)!= 0) ICS_C2_BDIV = 0; / now system/bus clock is external clock / clear Loss of lock sticky bit ICS_S = ICS_S_LOLS_MASK; The following code fragment shows how to transition to clock mode from FBE to FEI mode: void FBE_to_FEI(void) ICS_C1_IREFS = 1;/ select internal reference clock ICS_C1_CLKS = 0; / select the internal clock as clock source / wait for the clock source to be changed asm ; while(ics_s_clkst while(ics_s_irefst!= 1 / now system clock source is internal clock if(((ics_c2 & ICS_C2_BDIV_MASK)>>5)!= 0) ICS_C2_BDIV = 0; / clear Loss of lock sticky bit ICS_S = ICS_S_LOLS_MASK; 8 Freescale Semiconductor

Conclusion The following code fragment shows how to transition to clock mode from FEI to FBI mode: void FEI_to_FBI(void) / change clock source to internal reference clock ICS_C1_CLKS = 1; ICS_C2_LP = 0; / wait for the reference clock to be changed asm ; while(ics_s_clkst!=1 / now internal reference clock is the system clock if(((ics_c2 & ICS_C2_BDIV_MASK)>>5)!= 0) ICS_C2_BDIV = 0; / now system/bus clock is around 32KHz / clear Loss of lock sticky bit ICS_S = ICS_S_LOLS_MASK; The following code fragment shows how to transition to clock mode from FBI to FBILP mode: void FBI_to_FBILP(void) ICS_C2_LP = 1;/ enter low power mode 5 Conclusion This application note describes S08P internal clock source related modules, and introduces the external clock connections and ICS operation mode switch with example code fragments to help users understand the internal clock source. 6 References The following are a few useful references regarding this document. MC9S08PT60/32 Reference Manual MC9S08PT60 Data Sheet Freescale Semiconductor 9

Glossary 7 Glossary This is a compilation of commonly used abbreviations used in this document. BDC Background Debug Controller BDM Background Debug Mode ICS Internal Clock Source module XOSC External Oscillator 10 Freescale Semiconductor

How to Reach Us: Home Page: freescale.com Web Support: freescale.com/support Information in this document is provided solely to enable system and software implementers to use Freescale products. There are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits based on the information in this document. Freescale reserves the right to make changes without further notice to any products herein. Freescale makes no warranty, representation, or guarantee regarding the suitability of its products for any particular purpose, nor does Freescale 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. Typical parameters that may be provided in Freescale data sheets and/or specifications can and do vary in different applications, and actual performance may vary over time. All operating parameters, including typicals, must be validated for each customer application by customer s technical experts. Freescale does not convey any license under its patent rights nor the rights of others. Freescale sells products pursuant to standard terms and conditions of sale, which can be found at the following address: freescale.com/salestermsandconditions. Freescale, the Freescale logo and Freescale, the Freescale logo are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. All other product or service names are the property of their respective owners All other product or service names are the property of their respective owners. 2013 Freescale Semiconductor, Inc. Document Number: AN4763 Rev. 0 8/2013