NEW DATABASE - 350 MILLION DATASHEETS FROM 8500 MANUFACTURERS
HA0075E 0000H RB2/30 - Datasheet Archive
MCU Reset and Oscillator Circuits Application Note D/N: HA0075E System Oscillator Crystal/Ceramic Oscillator ®
MCU Reset and Oscillator Circuits Application Note MCU Reset and Oscillator Circuits Application Note D/N: HA0075E HA0075E System Oscillator Crystal/Ceramic Oscillator ® Crystal/Ceramic Oscillator Equivalent Circuit The following circuit combination of resistors, capacitors and inductors depicts an equivalent circuit for a crystal or ceramic oscillator. L R S C Note S C P S 1. LS is a series inductor, RS is a series resistor, CS is a series capacitor and CP is a parallel connected capacitor. 2. The resonance frequency is given by a series connected LC pair where L=LS and C=CS´CP/(CS+CP) 3. The main difference between the crystal and the ceramic resonator equivalent circuits is, when oscillating at the same frequency, the equivalent inductor for the crystal will be greater than that of the ceramic resonator. 1 MCU Reset and Oscillator Circuits Application Note ® Crystal/Ceramic Oscillator Basic Circuits The following diagrams show two application circuits for the crystal/ceramic system oscillators. C C E X 1 X 't a l E X 2 V D D o r G N D X 't a l R O S C 1 O S C 2 E X B O S C 1 M C U O S C 2 M C U fS fS Y S E N R C Notes ® IN 1 R IN B C Y S E N C IN 2 IN 1 IN B C IN 2 1. The internal bias resistor RINB is one of the components required to produce oscillation. 2. The CIN1 and CIN2 internal capacitors together with the external crystal/ceramic oscillator form a Pierce oscillator. When oscillating, the crystal/ceramic oscillator can be seen as an inductive element. This circuit is effective in reducing EMI. 3. The REXB external bias resistor is used to ensure the oscillator stops should a low voltage condition occur. This resistor works in conjunction with CEX1 where the time constant REXB ´ CEX1 is greater than 2p fSYS. The main principle here is to increase the loading on the oscillator circuit to ensure that the MCU will not exhibit erroneous operation under low voltage conditions. However, for applications that will not undergo low voltage conditions, this component is not required. 4. The two external oscillator capacitors CEX1 and CEX2 are used to provide small adjustments to the oscillation frequency or for crystal/ceramic oscillator matching or for adjustments to oscillator start-up time. These components are not necessary for normal applications. 5. The Holtek MCU datasheets and handbooks provide application circuits where suggested capacitor and resistor values are shown for consultation. Cystal/Ceramic Oscillator Warm-up Time · The crystal/ceramic oscillators all require a short warm-up time before they start oscillating. · The length of this warm-up time is related to the characteristics of the warm-up time and power-down time. In most cases, if the MCU is powered down, a warm-up time of 3~5ms is required. ® System Start-up Timer · This is a period of time added to allow the oscillator to reach stability. · This time is fixed at 1024 clock cycles. 2 MCU Reset and Oscillator Circuits Application Note ® EMI/EMS (EMC) Considerations · The crystal/ceramic oscillator should be located as close to the MCU oscillator pins as possible. In addition, the interconnections to the crystal/ceramic oscillator should be kept as short as possible. · To reduce EMI, the crystal/ceramic oscillator should have a VDD or GND (VSS) guard ring for shielding. · The interconnections between CEX1 and CEX2 and VDD or GND (VSS) should be kept as short as possible. One-pin Pull-high RC Oscillator The following drawing shows the circuit for RC oscillators which require an external pull-high resistor. V R D D M C U O S C O S C 1 C S V R fS Note ® Y S D D R C s y s te m C O S C O S C P U /4 O S C 2 1. The ROSC oscillating resistor works in combination with the internal capacitor COSC to form an RC oscillator. The value of this resistor is dependent upon the oscillation frequency required. The value of this resistor is inversely proportional to the oscillation frequency, hence, the larger the resistor, the lower the frequency. 2. The COSC oscillating capacitor is internal to the MCU which together with the external ROSC oscillator forms the RC system oscillator. 3. The capacitor CS is provided for reasons of frequency stability and its recommended value is 470pF. 4. The resistor RPU should be added if the OSC2 (system clock/4) test output is used. Its recommended value is 2kW. System Start-up Timer · This is a period of time added to allow the oscillator to reach stability. · This time is fixed at 1024 clock cycles. 3 MCU Reset and Oscillator Circuits Application Note ® Manufacturing and Temperature Variations · Because the frequency of the RC oscillator is dependent upon the value of an internal capacitor, the value of which is dependent upon manufacturing parameters. Different MCUs will exhibit different characteristics. Under conditions of similar voltage and temperature, this will account for an oscillator frequency variation of approximately ± 25%. · Within the same MCU, there is no manufacturing variations, the oscillator frequency will be affected by variations in the operating voltage and operating temperature. The effect of temperature and voltage on the frequency can be found by visiting our Holtek web site. ® EMI/EMS (EMC) Considerations · The resistor ROSC should be located as close to the OSC1 pin as possible with the interconnecting line as short as possible. · The capacitor CS will improve the noise performance of the oscillator. The two lines connecting this capacitor to the MCU OSC1 and GND pins should be kept as short as possible. · After the resistor RPU has been added to verify the system frequency, for high volume production it is recommended that this resistor is not added. This is because this pin may have an adverse effect on the system frequency produced on pin OSC1. One-pin Pull-down RC Oscillator The following drawing shows the circuit for RC oscillators which require an external pull-down resistor. V C D D M C U S O S C 1 R O S C V R fS Note Y S /4 D D R C s y s te m C O S C O S C P U O S C 2 1. The ROSC oscillating resistor works in combination with the internal capacitor COSC to form an RC oscillator. The value of this resistor is dependent upon the oscillation frequency required. The value of this resistor is inversely proportional to the oscillation frequency, hence, the larger the resistor, the lower the frequency. 2. The COSC oscillating capacitor is internal to the MCU which together with the external ROSC oscillator forms the RC system oscillator. 3. The capacitor CS is provided for reasons of frequency stability and its recommended value is 470pF. 4. The resistor RPU should be added if the OSC2 (system clock/4) test output is used. Its recommended value is 2kW. 4 MCU Reset and Oscillator Circuits Application Note ® System Start-up Timer · This is a period of time added to allow the oscillator to reach stability. · This time is fixed at 1024 clock cycles. ® Manufacturing and Temperature Variations · Because the frequency of the RC oscillator is dependent upon the value of an internal capacitor, the value of which is dependent upon manufacturing parameters, different MCUs will exhibit different characteristics. Under conditions of similar voltage and temperature, this will account for an oscillator frequency variation of approximately ± 25%. · Within the same MCU, there is no manufacturing variations, the oscillator frequency will be affected by variations in the operating voltage and operating temperature. The effect of temperature and voltage on the frequency can be found by visiting our Holtek web site. ® EMI/EMS (EMC) Considerations · The resistor ROSC should be located as close to the OSC1 pin as possible with the interconnecting line as short as possible. · The capacitor CS will improve the noise performance of the oscillator. The two lines connecting this capacitor to the MCU OSC1 and VDD pins should be kept as short as possible. · After the resistor RPU has been added to verify the system frequency, for high volume production it is recommended that this resistor is not added. This is because this pin may have an adverse effect on the system frequency produced on pin OSC1. RTC (32768Hz Crystal) Oscillator ® RTC (32768Hz) Oscillator Equivalent Circuit The following circuit combination of resistors, capacitors and inductors depicts an equivalent circuit for an RTC (32768Hz crystal) oscillator. L R S C Note S C P S 1. LS is a series inductor, RS is a series resistor, CS is a series capacitor and CP is a parallel connected capacitor. 2. The resonance frequency is given by a series connected LC pair where L = LS and C = CS ´ CP / (CS + CP) 3. The main reason for the RTC (32768Hz crystal) is generally to reduce power. In applications, this oscillator can ensure that normal MCU operation is maintained. The crystal should be located as close to the MCU as possible and its interconnections kept as short as possible. 5 MCU Reset and Oscillator Circuits Application Note ® RTC (32768Hz Crystal) Oscillator Basic Circuits The following diagrams show two application circuits for the RTC (32768Hz crystal) system oscillators. C 3 2 7 6 8 H z X 't a l C E X 3 R O S C 3 E X 4 3 2 7 6 8 H z X 't a l O S C 4 E X B O S C 3 O S C 4 M C U M C U fR fR T C E N R C Note ® IN 3 V D D o r G N D R IN B C T C E N C IN 4 IN 3 IN B C IN 4 1. The internal bias resistor RINB is one of the components required to produce oscillation. Because of its function as a low power oscillator, it has an approximate value of 10MW. 2. The CIN3 and CIN4 internal capacitors together with the external crystal/ceramic oscillator form a Pierce oscillator. When oscillating, the crystal/ceramic oscillator can be seen as an inductive element. This circuit is effective in reducing EMI. 3. The REXB external bias resistor is used to ensure the oscillator stops should a low voltage condition occur. It is recommended that this resistor is not added here. 4. The two external oscillator capacitors CEX3 and CEX4 are used to provide small adjustments to the oscillation frequency or for crystal/ceramic oscillator matching or for adjustments to oscillator start-up time. A recommended value for these capacitors is 12pF. Quick Start-up · The 32768Hz oscillator is designed for low power applications, however, since the supply current to such oscillators is necessarily low, the start up time for such oscillators will generally be around 2~3sec. For many applications this is an obviously long delay. To minimize possible problems created by this delay, a quick start up function is provided where the oscillator current is increased to reduce the start-up time. · When this quick start-up function is invoked, the start-up time can be reduced to around 0.2~0.3sec. When the oscillator has started and after a period of time has elapsed, the quick start-up function can be switched off to reduce power. A software delay can be used to determine the exact time or the internal RTC time base counter can be used, which uses the RTC clock. If the RTC clock has started, it can be determined if an interrupt from the RTC has occurred. 6 MCU Reset and Oscillator Circuits Application Note · When the RTC clock has started, the quick start function can be switched off at which point the oscillator will enter its low power mode with the resulting reduction in power. ® EMI/EMS (EMC) Considerations · In order to reduce the effect of noise on the RTC, which may lead to inaccurate timings, the RTC crystal should be located as close to the MCU oscillator pins as possible. In addition, the interconnections to the crystal oscillator should be kept as short as possible. · In order to reduce the adverse effects of EMI, in addition to keeping the RTC crystal lines short, the VDD or GND guard rings should be used for shielding. ® RTC (32768Hz crystal) Oscillator Frequency Adjustment · In applications that utilize a 32768 crystal, timing accuracy is important. However, since the characteristics of crystals may vary and due to variations in MCU characteristics, this may lead to small differences in oscillating frequency. Although these variations may only have a value in the order of several tens of ppm, when accumulated over a long period, these errors could create an increasing problem, making the issue of frequency adjustment an important one. · If accuracy is not an important issue CEX3 and CEX4 can be chosen to have a value of 12pF. These capacitors should have minimum temperature variations. · If accuracy is an important issue, then CEX3 can be chosen to have a value of 12pF and CEX4 can be chosen to be a variable capacitor. During the adjustment process, the MCU can be programmed to output a 1 sec period signal. A stable high frequency reference source can then be used for comparison, and the variable capacitor CEX4 adjusted until the correct RTC frequency has been attained. · If the system contains an EEPROM, CEX3 and CEX4 can be chosen to have a value of 12pF. These capacitors should have minimum temperature variations. A stable high frequency reference source can then be used for comparison and the difference in frequency stored in the EEPROM. During actual operation, this value can be used by the software to make corrections to any measurements made reducing the need for a variable capacitor and manual adjustment process. Reset Circuit External RES Line Description · Used to start up the MCU from a known condition, the effect of which will be to reset the internal special registers (with the exception of the TO and PDF flags) and reset the I/O ports to a known condition. The program counter will also be reset to 0000H 0000H where the program will begin execution. · If the WDT is enabled the WDT will be cleared and begin counting anew · The RAM contents will be unchanged · The stack pointer will be reset 7 MCU Reset and Oscillator Circuits Application Note Simple RC Reset Circuit V D D M C U R R E S R E S C R e s e t L V R a n d P O R R E S · For applications with only low levels of noise, this simple RC reset circuit is applicable. · The reset time is governed by the values of RRES and CRES. · Regarding the length of the reset, the main consideration is stability and the length of time required for the power supply to reach the operating voltage of the MCU. The reset time should always be greater than this time. When the power is turned off, the charge in the capacitor must be discharged as quickly as possible. · The recommended values for RRES and CRES would be 100kW and 0.1mF. · The layout of the external reset components is important, the lines connecting the CRES capacitor to the MCU RES pin and VSS should be kept as short as possible. RC Circuit for Applications Operating in Noisy Environments V D D M C U V D D R R E S C N R E S R C R e s e t L V R N a n d P O R R E S · For circuits with higher levels of noise this circuit is applicable. · The reset time is governed by the values of RRES and CRES. · Regarding the length of the reset, the main consideration is stability and the length of time required for the power supply to reach the operating voltage of the MCU. The reset time should always be greater than this time. When the power is turned off the pull-high resistor connected to the capacitor must be capable of discharging the capacitor in as quick a time as possible. · Recommended values for RRES and CRES would be 100kW and 0.1mF. · The RN matching resistor and CN matching capacitor are matched to the internal design of the MCU. Recommended values for these two components would be 10kW and 0.01mF, about 1/10 of the values of RRES and CRES. · As this circuit is used in noisy environments, the lines connecting the CN capacitor to the MCU RES pin and VDD should be kept as short as possible. 8 MCU Reset and Oscillator Circuits Application Note Low Voltage Reset Transistor Circuit V V D D D D M C U R M C U B 1 Q 1 R R B 2 R E S R B 1 R R e s e t L V R C a n d P O R D Q 1 B 3 Z R R E S R e s e t L V R C a n d P O R · When the internal low voltage reset circuit¢s voltage is not the same as the application¢s specification, an external transistor circuit can be used to supply the low voltage function. · This circuit can provide a low voltage reset function for use in noisy environments. · The function of the low voltage reset is determined by the resistor voltage divider RB1 and RB2 or by the Zener diode voltage. · When using the resistor voltage divider, the low voltage reset activation point is given by the ratio (RB1+RB2)/(2´RB1). The value of the RC should be greater than RB2/30 RB2/30. · When using the Zener diode, the low voltage reset activation point is given by VZ+0.5V, the RB1 resistor is provided to set the working point VZ. It is recommended that the RC resistor should have a value greater than 100kW and RB3 has a value of about 10kW. · The placement of transistor Q1 is important, the connections between the emitter and collector and the VDD and MCU RES pins should be as short as possible. External Voltage Detector IC Reset Circuit V V D D D D M C U V D D M C U R R R E S R E S H T 7 0 X X A -1 C R E S R e s e t L V R C R E S a n d P O R N R E S H T 7 0 X X A -1 R R e s e t L V R N C a n d P O R R E S · When the internal low voltage reset circuit¢s voltage is not the same as the application¢s specification, an external voltage detector IC circuit can be used to provide the low voltage reset function. · This circuit can provide a low voltage reset function. It requires the connection of a simple RC network or the RC network that is used for noisy environments to provide the reset function. · The recommended values for RRES, CRES, RN and CN are the same as those for the simple RC network or the RC network that operates in noisy environments. 9 MCU Reset and Oscillator Circuits Application Note · The component CRES which is used in the simple RC circuit, or CN which is used in noisy environments circuit have the same requirements as the reset circuits for the simple RC network or the RC network that operates in noisy environments. Internal POR Circuit and Internal Low Voltage Reset Circuit · In order to increase protection for the MCU and to simplify the need for external circuitry and to reduce costs, the MCU includes both internal power on reset (POR) and low voltage reset (LVR) circuits. · The internal POR is an internal RC circuit that will provide a short reset time during the power on time, which will enable the MCU to power up in a known initial condition. Apart from the TO and PDF flags, which are reset to ²0², the function of this reset is the same as that of the RES line. If this reset is to be used to reset the MCU, because its reset time is short, the power supply voltage must rise to its operating value in as short a time as possible. · The LVR internal reset main function is to provide a reset to the MCU should the VDD voltage fall below a specified value for a time greater than 1ms. Its effect is the same as that of the RES line. 10 MCU Reset and Oscillator Circuits Application Note Internal Watchdog RC Oscillator Functional Description · The main function of the Watchdog timer (WDT) is to monitor the normal internal operation of the MCU hardware and software. By correct use of the clear ²WDT² instructions (²CLR WDT², ²CLR WDT1² and ²CLR WDT2²) within the application program, if the MCU is running correctly, the Watchdog timer will be prevented from overflowing. However, should the MCU malfunction the WDT will overflow and a WDT reset will be activated. · The internal watchdog oscillator is formed by a free running fully integrated RC oscillator. Irrespective of how the program is running, even if the MCU is in the halt power down mode, the internal watchdog oscillator will always run. This oscillator will provide the timing for the WDT, and enable the WDT to continually check on the correct operation of the MCU. · The watchdog internal timer is a free running internal RC oscillator, which if selected by the configuration options, will continually run. When the MCU enters the halt mode, as the WDT oscillator will still continue to run, it will consume some power, in the region of several mA. If in the halt mode, when the WDT overflows, a WDT reset during halt will be generated. When this happens the TO and PDF flags will be set to a known condition. By reading these two flags, the application program can determine if a WDT reset has indeed occurred and appropriate action then taken. Process, Working Voltage and Temperature Variations · Because the internal WDT oscillator is a fully integrated RC oscillator, the values of the Resistor and Capacitor, which are fabricated within the device, will have a high interdependency on process and temperature, which will create variations in the oscillator frequency. · Because the oscillator is an RC oscillator, it will be affected by the operating voltage, which will in turn create variations in the oscillator frequency. · Because of these three combined factors, process, operating voltage and temperature variations, during the design phase, the designer must take special care to ensure that an erroneous WDT reset does not occur. With regard to the characteristics of the internal RC WDT oscillator and the effects of voltage and temperature with frequency, user can consult the relevant up to date MCU datasheet or handbook on the Holtek website. 11