Clock signal monitoring system

By introducing a crystal oscillator detection module and a minimum power consumption search module, the clock signal is automatically switched to solve the problems of high power consumption and insufficient accuracy of Pierce oscillators, thus realizing a low-power, high-precision clock signal monitoring system.

CN116865724BActive Publication Date: 2026-11-17CRM ICBG (WUXI) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210309950.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-28
Publication Date
2026-11-17
Estimated Expiration
2042-03-28

AI Technical Summary

Technical Problem

In the prior art, the current source design of Pierce oscillators results in high power consumption and circuit crashes, and the clock signal generated by the internal RC oscillator is not accurate enough, which limits the scope of application.

Method used

The system employs a crystal oscillator detection module, a minimum power consumption search module, and a clock switching module. By detecting the crystal oscillator's stop oscillation signal, it automatically switches to the internal oscillator clock signal to avoid system crashes. The minimum power consumption search module optimizes the crystal oscillator's current to achieve the lowest power clock signal switching.

Benefits of technology

This approach achieves reduced power consumption of the crystal oscillator while ensuring system clock reliability, thus expanding the application range and improving clock signal accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116865724B_ABST
    Figure CN116865724B_ABST
Patent Text Reader

Abstract

This invention relates to a clock signal monitoring system, comprising a crystal oscillator detection module, a minimum power consumption finding module, a crystal oscillator module, and a clock switching module. The crystal oscillator detection module detects the oscillation stop signal of the crystal oscillator module, and the minimum power consumption finding module finds the minimum current required for the crystal oscillator module to start oscillation. When the crystal oscillator module stops oscillating, the clock switching module switches the system clock signal System_CLK to the internal oscillator clock signal RC_CLK. When the crystal oscillator module starts oscillating, the clock switching module switches the system clock signal System_CLK to the crystal oscillator clock signal Crystal_CLK. The clock signal monitoring system of this invention adds an adjustable resistor to the bias current generation circuit of the crystal oscillator, supporting power consumption adjustment and automatically switching between the internal oscillator clock signal and the crystal oscillator clock signal, ensuring system clock reliability while balancing circuit reliability and power consumption control, minimizing the power consumption of the crystal oscillator circuit.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of digital circuit systems, and more particularly to the field of digital circuits that generate clock signals, specifically a clock signal monitoring system. Background Technology

[0002] Current technology widely uses Pierce oscillators containing quartz crystals to generate clock signals in digital circuits. Pierce oscillators require fewer components and use quartz crystals as highly selective filtering elements. A typical Pierce oscillator circuit usually includes a level shifting circuit. After amplifying the oscillation signal, it is shaped by I1 and I2 to output the clock Crystal_CLK. To enhance reliability, some MCUs contain a system clock monitoring module, namely the SCM (SafeClock Monitor) module. If the crystal clock stops oscillating, the built-in SCM module will automatically switch the system clock to the internal RC oscillator, ensuring that the system does not crash due to the sudden loss of the clock. If the external crystal oscillator resumes operation, the SCM module will switch the system clock to the external crystal oscillator.

[0003] To save power, the current of the fixed current source in the existing Pierce oscillator circuit is kept as small as possible, but the circuit is prone to stopping oscillation, causing the entire circuit to crash. To reduce the probability of crashing, the current of the fixed current source during oscillation needs to be increased appropriately, which inevitably increases power consumption. However, maintaining a large current even in good environmental conditions is wasteful, resulting in high power consumption.

[0004] like Figure 1 As shown, the current clock monitoring SCM module can prevent circuit crashes, but the clock signal generated by the internal RC oscillator after the crystal oscillator stops oscillating is used as the system clock signal. The accuracy does not meet the requirements of the system solution, which limits its application range. Summary of the Invention

[0005] The purpose of this invention is to overcome the shortcomings of the prior art and provide a clock signal monitoring system that meets the requirements of high accuracy, low power consumption and wide applicability.

[0006] To achieve the above objectives, the clock signal monitoring system of the present invention is as follows:

[0007] The main features of this clock signal monitoring system are as follows: the system includes a crystal oscillator detection module, a minimum power consumption search module, a crystal oscillator module, and a clock switching module. The input terminal of the crystal oscillator detection module receives the internal oscillator clock signal RC_CLK and the crystal oscillator clock signal Crystal_CLK output by the crystal oscillator module. The input terminal of the minimum power consumption search module is connected to the output terminals of the crystal oscillator detection module and the crystal oscillator module. The input terminal of the crystal oscillator module is connected to the output terminal of the minimum power consumption search module. The input terminal of the clock switching module is connected to the output terminal of the crystal oscillator detection module. The input terminal of the clock switching module also receives the internal oscillator clock signal RC_CLK and the crystal oscillator clock signal Crystal_CLK output by the crystal oscillator module. The clock switching module outputs the system clock signal System_CLK.

[0008] The crystal oscillator detection module is used to detect the stop signal of the crystal oscillator module. The minimum power consumption search module is used to find the minimum current for the crystal oscillator module to start oscillating. When the crystal oscillator module stops oscillating, the clock switching module switches the system clock signal System_CLK to the internal oscillator clock signal RC_CLK. When the crystal oscillator module starts oscillating, the clock switching module switches the system clock signal System_CLK to the crystal oscillator clock signal Crystal_CLK.

[0009] Preferably, the crystal oscillator detection module includes a first counter, a second counter, and a fourth OR gate. The input terminal of the second counter is connected to the output terminal of the first counter, and the input terminal of the fourth OR gate is connected to the output terminal of the second counter. It also receives a system reset signal SysRst and outputs a signal Effect. Both the first counter and the second counter receive the internal oscillator clock signal RC_CLK as their clock signal, and both use the high level of the crystal oscillator clock signal Crystal_CLK output by the crystal oscillator module as their reset signal.

[0010] More preferably, in the absence of a reset signal, the crystal oscillator detection module increments the count value of the first counter by one in each internal oscillator clock signal cycle and outputs the most significant bit signal OV0 of the first counter's count result; the second counter increments the count value by one each time the most significant bit signal OV0 of the first counter's count result changes from high to low, and outputs the most significant bit signal OV1 of the second counter's count result.

[0011] More preferably, the lowest power consumption search module includes an RS latch, a third OR gate, a third counter, an adder, and a register. The input of the RS latch is connected to the output of the first counter and the output of the fourth OR gate. The input of the third OR gate is connected to the output of the RS latch and the output of the crystal oscillator module. The input of the third counter is connected to the output of the third OR gate. The input of the adder is connected to the output of the third counter, the output of the first counter, and the output of the register. The input of the register is connected to the output of the adder and the output of the fourth OR gate.

[0012] More preferably, the adder receives the output signal OV0 of the first counter, the output signal OV2 of the third counter, and the bus output trim of the register. <n:0>When the output signal OV0 of the first counter changes from low to high, the output value of the adder is trim. <n:0>-1, when the output signal OV2 of the third counter changes from low to high, the output value of the adder is trim. <n:0>+1; When the output signal Effect of the fourth OR gate is 1, the output signal of the register maximizes the bias current of the crystal oscillator module.

[0013] More preferably, the RS latch includes a first NOR gate and a second NOR gate. The input of the first NOR gate is connected to the output of a first counter and receives the output signal OV0 of the first counter. The input of the second NOR gate is connected to the output of a fourth OR gate and receives the output signal Effect of the fourth OR gate. The output of the first NOR gate is connected to the input of the second NOR gate, and the output of the second NOR gate is connected to the input of the first NOR gate. The output of the second NOR gate is also connected to the input of a third OR gate.

[0014] Preferably, the crystal oscillator module includes a bias current unit, which includes n resistors and n adjustable MOSFETs. Each resistor is connected in series, and the drain and source of each adjustable MOSFET are connected to the two ends of the corresponding resistor. The gate of each adjustable MOSFET is connected to the control signal output by the lowest power search module. The bias current unit adjusts the resistance value and controls the magnitude of the bias current by controlling the short circuit of different adjustable MOSFETs through the control signal.

[0015] More preferably, the bias current unit further includes a first current source MOSFET, a second current source MOSFET, a third current source MOSFET, and a fourth current source MOSFET. The source of the third current source MOSFET and the source of the fourth current source MOSFET are both connected to the supply voltage. The gate of the third current source MOSFET and the gate of the fourth current source MOSFET are connected. The gate of the third current source MOSFET is connected to the drain of the third current source MOSFET. The drain of the fourth current source MOSFET is connected to one end of a series of n resistors. The other end of the series of n resistors is connected to the source of the second current source MOSFET. The gate of the second current source MOSFET is connected to the gate of the first current source MOSFET. The source of the first current source MOSFET is connected to the drain of the third current source MOSFET. The drains of the first current source MOSFET and the drains of the second current source MOSFET are both grounded. The drain of the fourth current source MOSFET is connected to the gate of the second current source MOSFET.

[0016] More preferably, the crystal oscillator module further includes a current mirror unit, a Pierce oscillator unit, a level conversion unit, and a signal shaping unit. The current mirror unit is connected to the bias current unit, the Pierce oscillator unit is connected to the current mirror unit, the level conversion unit is connected to the current mirror unit, and the signal shaping unit is connected to the level conversion unit. The signal shaping unit outputs a crystal clock signal Crystal_CLK.

[0017] The clock signal monitoring system of this invention incorporates an adjustable resistor in the bias current generation circuit of the crystal oscillator, supporting power consumption adjustment and automatically switching between the internal oscillator clock signal and the crystal oscillator clock signal to ensure system clock reliability. The circuit of this invention can automatically find the lowest power consumption required for the crystal oscillator circuit to start oscillating. This invention balances circuit reliability and power consumption control, minimizing the power consumption of the crystal oscillator circuit while ensuring the validity of the system clock System_CLK. Attached Figure Description

[0018] Figure 1 This is a schematic diagram of a clock monitoring circuit in the prior art.

[0019] Figure 2 This is a circuit diagram of the clock signal monitoring system of the present invention.

[0020] Figure 3 This is a schematic diagram of the circuit structure of the crystal oscillator module of the clock signal monitoring system of the present invention.

[0021] Figure 4 This is a schematic diagram of the circuit structure of another embodiment of the crystal oscillator module of the clock signal monitoring system of the present invention. Detailed Implementation

[0022] To more clearly describe the technical content of the present invention, the following description is provided in conjunction with specific embodiments.

[0023] like Figure 2 As shown, the improved clock signal monitoring circuit SCM (Safe Clock Monitor) of the present invention includes a crystal oscillator detection module, a minimum power consumption search module, a crystal oscillator module, and a clock switching module. The input terminal of the crystal oscillator detection module receives the internal oscillator clock signal RC_CLK and the crystal oscillator clock signal Crystal_CLK output by the crystal oscillator module. The input terminal of the minimum power consumption search module is connected to the output terminal of the crystal oscillator detection module and the output terminal of the crystal oscillator module. The input terminal of the crystal oscillator module is connected to the output terminal of the minimum power consumption search module. The input terminal of the clock switching module is connected to the output terminal of the crystal oscillator detection module. The input terminal of the clock switching module also receives the internal oscillator clock signal RC_CLK and the crystal oscillator clock signal Crystal_CLK output by the crystal oscillator module. The clock switching module outputs the system clock signal System_CLK.

[0024] The crystal oscillator detection module is used to detect the stop signal of the crystal oscillator module. The minimum power consumption search module is used to find the minimum current for the crystal oscillator module to start oscillating. When the crystal oscillator module stops oscillating, the clock switching module switches the system clock signal System_CLK to the internal oscillator clock signal RC_CLK. When the crystal oscillator module starts oscillating, the clock switching module switches the system clock signal System_CLK to the crystal oscillator clock signal Crystal_CLK.

[0025] In a preferred embodiment of the present invention, the crystal oscillator detection module includes a first counter Counter0, a second counter Counter1, and a fourth OR gate I4. The input terminal of the second counter Counter1 is connected to the output terminal of the first counter Counter0, and the input terminal of the fourth OR gate I4 is connected to the output terminal of the second counter Counter1. It also receives a system reset signal SysRst and outputs a signal Effect. Both the first counter Counter0 and the second counter Counter1 receive the internal oscillator clock signal RC_CLK as the clock signal, and both use the high level of the crystal oscillator clock signal Crystal_CLK output by the crystal oscillator module as the reset signal.

[0026] In the absence of a reset signal, the crystal oscillator detection module increments the count value of the first counter Counter0 by one in each internal oscillator clock signal cycle and outputs the most significant bit signal OV0 of the count result of the first counter Counter0; the second counter Counter1 increments the count value by one each time the most significant bit signal OV0 of the count result of the first counter Counter0 changes from high level to low level, and outputs the most significant bit signal OV1 of the count result of the second counter Counter1.

[0027] The fourth OR gate I4 takes OV1 and the system reset signal SysRst (active high) as inputs, and its output signal is labeled Effect. The RS latch takes OV0 and Effect as inputs, and its output is labeled X1. When Effect is high, X1 is low; when Effect is low and OV0 is high, X1 is high; when Effect is low and OV0 is low, X1 remains unchanged.

[0028] In a preferred embodiment of the present invention, the minimum power consumption search module includes an RS latch, a third OR gate I3, a third counter Counter2, an adder Add0, and a register TrimReg. The input of the RS latch is connected to the output of the first counter Counter0 and the output of the fourth OR gate I4. The input of the third OR gate I3 is connected to the output of the RS latch and the output of the crystal oscillator module. The input of the third counter Counter2 is connected to the output of the third OR gate I3. The input of the adder Add0 is connected to the output of the third counter Counter2, the output of the first counter Counter0, and the output of the register. The input of the register TrimReg is connected to the output of the adder and the output of the fourth OR gate I4.

[0029] In a preferred embodiment of the present invention, the adder Add0 receives the output signal OV0 of the first counter Counter0, the output signal OV2 of the third counter Counter2, and the bus output trim of the register. <n:0>When the output signal OV0 of the first counter Counter0 changes from low to high, the output value of the adder is trim. <n:0>-1, when the output signal OV2 of the third counter Counter2 changes from low to high, the output value of the adder Add0 is trim. <n:0>+1; When the output signal Effect of the fourth OR gate I4 is 1, the output signal of the register maximizes the bias current of the crystal oscillator module.

[0030] In a preferred embodiment of the present invention, the RS latch includes a first NOR gate I1 and a second NOR gate I2. The input terminal of the first NOR gate I1 is connected to the output terminal of the first counter Counter0 and receives the output signal OV0 of the first counter Counter0. The input terminal of the second NOR gate I2 is connected to the output terminal of the fourth OR gate I4 and receives the output signal Effect of the fourth OR gate I4. The output terminal of the first NOR gate I1 is connected to the input terminal of the second NOR gate I2, and the output terminal of the second NOR gate I2 is connected to the input terminal of the first NOR gate I1. The output terminal of the second NOR gate I2 is also connected to the input terminal of the third OR gate I3.

[0031] The third counter, Counter2, uses the result X2, which is the result of ORing the improved crystal oscillator output Crystal_CLK and X1, as its clock. The counter increments by 1 for each clock cycle, and the highest bit of the count result is marked as OV2.

[0032] Adder Add0 has three inputs: OV0, OV2, and the bus output trim of register TrimReg. <n:0>The output of Add0 serves as the input to the TrimReg register. When OV0 transitions from a low level to a high level, the adder Add0 outputs the value "trim". <n:0>-1”; When OV2 goes from low to high once, the adder Add0 outputs "trim" value. <n:0>+1”.

[0033] The TrimReg register stores the output result of Add0, and when Effect is 1, the TrimReg register is set to maximize the bias current of the crystal oscillator, making it easiest to start oscillating.

[0034] The improvement of this invention compared to the existing clock monitoring SCM circuit is as follows:

[0035] 1. The single counter of the internal oscillator clock signal RC_CLK branch is split into a two-stage counter to achieve simultaneous detection of crystal oscillator stoppage and... Figure 2 The improved circuit structure in the upper right box provides the trigger signal.

[0036] 2. Add Figure 2 The lowest power consumption search module automatically finds the trim value to enable the "improved oscillator" to operate with minimal current, while ensuring that the crystal oscillator automatically attempts to restart after it stops oscillating.

[0037] In existing technologies, counters are typically split into two stages: a first counter (Counter0) and a second counter (Counter1), with overflow signals OV0 and OV1, respectively, valid when their values ​​are 1. Using an improved oscillator, power consumption can be adjusted using the trim0 to trimn signals. To automatically generate appropriate trim values ​​(trim0 to trimn), the circuit adds an RS latch (composed of two NOR gates I1 and I2), a third counter (Counter2), a register TrimReg, and an adder (Add0).

[0038] When the system reset SysRst is active high, Effect = 1. The TrimReg register is set to maximize the crystal oscillator bias current, making it easiest to start oscillating. The output signals OV0 of the first counter, OV1 of the second counter, and OV2 of the third counter are all 0, and node X1 is 0. The crystal oscillator clock signal Crystal_CLK outputs the oscillation waveform, which is selected by the system clock signal System_CLK. The first counter Counter0 and the second counter Counter1 are continuously reset, and the third counter Counter2 counts until it overflows. The output signal OV2 of the third counter Counter2 is 1, causing the adder Add0 to increment by "+1", increasing the trim value and reducing the bias current, thereby reducing the crystal oscillator power consumption. This cycle continues, gradually increasing the trim value until the crystal oscillator stops oscillating, at which point the trim value is set to trim_error.

[0039] At this point, since the crystal oscillator stops oscillating, the first counter, Counter0, can continue counting normally until it overflows. The output signal OV0 of the first counter, Counter0, is 1, which sets node X1 to 1 through the RS latch, stopping the third counter, Counter2. Simultaneously, OV0 = 1 causes the adder Add0 to increment by "-1", meaning the TrimReg register takes the value of the last trim data before oscillation stopped, "trim_error-1", causing the crystal oscillator circuit to restart. After the crystal oscillator circuit restarts, the first counter, Counter0, and the second counter, Counter1, are continuously reset. The output signals OV0 of the first counter, Counter0, and OV1 of the second counter, Counter1, are both 0, preventing the system clock signal System_CLK from switching. Furthermore, the RS latch inputs are all 0, maintaining X1 = 1. The third counter, Counter2, stops counting to reduce power consumption. In other words, the system clock signal System_CLK uses the crystal oscillator clock signal Crystal_CLK, and the crystal oscillator circuit uses a method that guarantees minimal power consumption during oscillation.

[0040] When environmental changes cause the crystal oscillator circuit to stop oscillating, the first counter Counter0 and the second counter Counter1 will not reset and will continue counting until the second counter Counter1 overflows, OV1 = 1, and the system clock signal System_CLK switches to the internal oscillator clock signal RC_CLK to ensure that the circuit does not crash. At the same time, OV1 = 1 causes the TrimReg register to be reloaded with all zeros, maximizing the crystal oscillator bias current and making it easiest to start oscillating; and the RS latch output X1 = 0, so that after the crystal oscillator circuit starts oscillating, the third counter Counter2 can start counting again to perform the process of searching for trim_error.

[0041] The current source of the existing oscillator is a fixed current source S1. The present invention improves the current source to... Figure 3 The bias current unit in the left frame generates current through a reference circuit, and the generated current is regulated by selectively short-circuiting the series resistor.

[0042] The original fixed current source S1 is replaced by a bias circuit module. This bias circuit includes an adjustable resistor consisting of n resistors Rtrim0 to Rtrimn and n MOS transistors MK0 to MKn. The specific resistance value is adjusted by controlling the short circuit of different MOS transistors through the trim0 to trimn signals, thereby controlling the magnitude of the bias current. In the above structure, when the trim value of trim0 to trimn is all 0, the output bias current is at its maximum.

[0043] In a preferred embodiment of the present invention, the crystal oscillator includes a bias current unit, which includes n resistors and n adjustable MOS transistors. Each resistor is connected in series, and the drain and source of each adjustable MOS transistor are connected to the two ends of the corresponding resistor. The gate of each adjustable MOS transistor is connected to a control signal. The bias current unit adjusts the resistance value and controls the magnitude of the bias current by controlling the short circuit of different adjustable MOS transistors through the control signal.

[0044] In a preferred embodiment of the present invention, the bias current unit further includes a first current source MOSFET, a second current source MOSFET, a third current source MOSFET, and a fourth current source MOSFET. The source of the third current source MOSFET and the source of the fourth current source MOSFET are both connected to the power supply voltage. The gate of the third current source MOSFET and the gate of the fourth current source MOSFET are connected. The gate of the third current source MOSFET is connected to the drain of the third current source MOSFET. The drain of the fourth current source MOSFET is connected to one end of a series of n resistors. The other end of the series of n resistors is connected to the source of the second current source MOSFET. The gate of the second current source MOSFET is connected to the gate of the first current source MOSFET. The source of the first current source MOSFET is connected to the drain of the third current source MOSFET. The drains of the first current source MOSFET and the drains of the second current source MOSFET are both grounded. The drain of the fourth current source MOSFET is connected to the gate of the second current source MOSFET.

[0045] In a preferred embodiment of the present invention, the crystal oscillator module further includes a current mirror unit, a Pierce oscillator unit, a level conversion unit, and a signal shaping unit. The current mirror unit is connected to the bias current unit, the Pierce oscillator unit is connected to the current mirror unit, the level conversion unit is connected to the current mirror unit, and the signal shaping unit is connected to the level conversion unit. The signal shaping unit outputs the crystal clock signal Crystal_CLK. The current mirror unit consists of a first MOSFET, a second MOSFET, a third MOSFET, a fourth MOSFET, a fifth MOSFET, and a sixth MOSFET. The current mirror powers the Pierce oscillator unit and the level conversion unit. The level conversion unit consists of a ninth MOSFET, a tenth MOSFET, an eleventh MOSFET, and a twelfth MOSFET. The signal shaping unit includes a first inverter and a second inverter. The input terminal of the first inverter is connected to the level conversion circuit, and the input terminal of the second inverter is connected to the first inverter. The second inverter outputs the crystal clock signal Crystal_CLK.

[0046] In a preferred embodiment of the present invention, the Pierce oscillator comprises a seventh MOS transistor, an eighth MOS transistor, and an internal resistor R. B The circuit consists of an external crystal oscillator (CRYSTAL), a first capacitor (C1), and a second capacitor (C2). The seventh and eighth MOSFETs form an inverter. The source of the seventh MOSFET is connected to a current mirror, and the drain of the eighth MOSFET is grounded. The drain of the seventh MOSFET is connected to the source of the eighth MOSFET, and also connected to the internal resistor R. B One end of the MOSFET is connected to the gate of the seventh MOSFET, which is connected to the gate of the eighth MOSFET, and the other end of the MOSFET is connected to the internal resistor RB. The external crystal oscillator is connected to the internal resistor RB. B The first capacitor C1 and the second capacitor C2 are connected to the two ends of the external crystal oscillator CRYSTAL, respectively, and the other ends of the first capacitor C1 and the second capacitor C2 are grounded.

[0047] In specific embodiments of the present invention, such as Figure 4 As shown, the adjustable resistor in the bias current generation circuit of the crystal oscillator can also utilize an NMOS as a short-circuit switch, in which case the trim value is inverted relative to the current scheme. Alternatively, the bias current generation circuit of the crystal oscillator can forgo the adjustable resistor and instead replace PMOS transistor MS1 with a set of PMOS transistors with different aspect ratios. The current mirror principle can be used to select different PMOS transistors to power the crystal oscillator, thereby adjusting the power consumption. These various schemes can be combined to still achieve the function of bias current regulation.

[0048] The clock signal monitoring system of this invention incorporates an adjustable resistor in the bias current generation circuit of the crystal oscillator. Power consumption can be adjusted via the trim value, and the internal oscillator clock signal and crystal oscillator clock signal can be automatically switched to ensure system clock reliability. The circuit of this invention can automatically find the lowest power consumption required for the crystal oscillator circuit to start oscillating. This invention balances circuit reliability and power consumption control, minimizing the power consumption of the crystal oscillator circuit while ensuring the system clock System_CLK remains valid.

[0049] In this specification, the invention has been described with reference to specific embodiments thereof. However, it will be apparent that various modifications and variations can be made without departing from the spirit and scope of the invention. Therefore, the specification and drawings should be considered illustrative rather than restrictive.

Claims

1. A clock signal monitoring system, characterized in that, The system includes a crystal oscillator detection module, a minimum power consumption search module, a crystal oscillator module, and a clock switching module, wherein... The input terminal of the crystal oscillator detection module receives the internal oscillator clock signal RC_CLK and the crystal oscillator clock signal Crystal_CLK output by the crystal oscillator module. The input terminal of the lowest power consumption search module is connected to the output terminal of the crystal oscillator detection module and the output terminal of the crystal oscillator module. The input terminal of the crystal oscillator module is connected to the output terminal of the lowest power consumption search module. The input terminal of the clock switching module is connected to the output terminal of the crystal oscillator detection module. The clock switching module also receives the internal oscillator clock signal RC_CLK and the crystal oscillator clock signal Crystal_CLK output by the crystal oscillator module at its input terminal, and the clock switching module outputs the system clock signal System_CLK. The crystal oscillator detection module is used to detect the stop signal of the crystal oscillator module. The minimum power consumption search module is used to find the minimum current for the crystal oscillator module to start oscillating. When the crystal oscillator module stops oscillating, the clock switching module switches the system clock signal System_CLK to the internal oscillator clock signal RC_CLK. When the crystal oscillator module starts oscillating, the clock switching module switches the system clock signal System_CLK to the crystal oscillator clock signal Crystal_CLK. The crystal oscillator detection module includes a first counter, a second counter, and a fourth OR gate. The input of the second counter is connected to the output of the first counter. The input of the fourth OR gate is connected to the output of the second counter, and it also receives a system reset signal SysRst and outputs a signal Effect. Both the first counter and the second counter receive the internal oscillator clock signal RC_CLK as their clock signal, and both use the high level of the crystal oscillator clock signal Crystal_CLK output by the crystal oscillator module as their reset signal. The minimum power consumption search module includes an RS latch, a third OR gate, a third counter, an adder, and a register. The input of the RS latch is connected to the output of the first counter and the output of the fourth OR gate. The input of the third OR gate is connected to the output of the RS latch and the output of the crystal oscillator module. The input of the third counter is connected to the output of the third OR gate. The input of the adder is connected to the output of the third counter, the output of the first counter, and the output of the register. The input of the register is connected to the output of the adder and the output of the fourth OR gate.

2. The clock signal monitoring system according to claim 1, characterized in that, In the absence of a reset signal, the crystal oscillator detection module increments the count value of the first counter by one in each internal oscillator clock signal cycle and outputs the highest bit signal OV0 of the first counter's count result; the second counter increments the count value by one each time the highest bit signal OV0 of the first counter's count result changes from high to low and outputs the highest bit signal OV1 of the second counter's count result.

3. The clock signal monitoring system according to claim 1, characterized in that, The adder receives the output signal OV0 of the first counter, the output signal OV2 of the third counter, and the bus output trim of the register. <n:0>When the output signal OV0 of the first counter changes from low to high, the output value of the adder is (trim <n:0>-1, when the output signal OV2 of the third counter changes from low to high, the output value of the adder is (trim) <n:0> +1; when the output signal Effect of the fourth OR gate is 1, the output signal of the register maximizes the bias current of the crystal oscillator module.

4. The clock signal monitoring system according to claim 1, characterized in that, The RS latch includes a first NOR gate and a second NOR gate. The input of the first NOR gate is connected to the output of the first counter and receives the output signal OV0 of the first counter. The input of the second NOR gate is connected to the output of the fourth OR gate and receives the output signal Effect of the fourth OR gate. The output of the first NOR gate is connected to the input of the second NOR gate, and the output of the second NOR gate is connected to the input of the first NOR gate. The output of the second NOR gate is also connected to the input of the third OR gate.

5. The clock signal monitoring system according to claim 1, characterized in that, The crystal oscillator module includes a bias current unit, which comprises n resistors and n adjustable MOSFETs. The n resistors are connected in series, and the drain and source of each adjustable MOSFET are respectively connected to the two ends of the corresponding resistor. The gate of each adjustable MOSFET is connected to the control signal output by the lowest power consumption search module. The bias current unit controls the short circuit of different adjustable MOSFETs through the control signal to adjust the resistance value of the corresponding resistor, thereby controlling the magnitude of the bias current.

6. The clock signal monitoring system according to claim 5, characterized in that, The bias current unit further includes a first current source MOSFET, a second current source MOSFET, a third current source MOSFET, and a fourth current source MOSFET. The sources of the third and fourth current source MOSFETs are both connected to the power supply voltage. The gates of the third and fourth current source MOSFETs are connected. The gate of the third current source MOSFET is connected to the drain of the third current source MOSFET. The drain of the fourth current source MOSFET is connected to one end of the n resistors connected in series. The other end of the n resistors connected in series is connected to the source of the second current source MOSFET. The gate of the second current source MOSFET is connected to the gate of the first current source MOSFET. The source of the first current source MOSFET is connected to the drain of the third current source MOSFET. The drains of the first and second current source MOSFETs are both grounded. The drain of the fourth current source MOSFET is connected to the gate of the second current source MOSFET.

7. The clock signal monitoring system according to claim 5, characterized in that, The crystal oscillator module further includes a current mirror unit, a Pierce oscillator unit, a level conversion unit, and a signal shaping unit. The current mirror unit is connected to the bias current unit, the Pierce oscillator unit is connected to the current mirror unit, the level conversion unit is connected to the current mirror unit, and the signal shaping unit is connected to the level conversion unit. The signal shaping unit outputs the crystal clock signal Crystal_CLK.

Citation Information

Patent Citations

  • CMOS current automatic control crystal oscillator

    CN101552592A

  • Clock controller with clock source fail-safe logic

    US7296170B1