Microcontroller clocking apparatus based on precision compensation and electronic device
By combining a current mirror unit, a charge/discharge oscillation unit, a comparison unit, and a logic control unit, charging control signals and compensation control signals are generated, solving the problem of oscillator clock signal error and realizing the output of high-precision clock signals, which is suitable for microcontrollers.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN YSPRING TECH
- Filing Date
- 2023-01-10
- Publication Date
- 2026-06-19
AI Technical Summary
The existing oscillator clock signal has errors, resulting in insufficient clock signal accuracy for the microcontroller, which cannot meet the high-precision requirements of IoT nodes.
By employing a combination of a current mirror unit, a charge/discharge oscillation unit, a comparison unit, and a logic control unit, complementary clock signals are generated and logically processed to produce charging control signals and compensation control signals, thereby achieving accuracy compensation for the clock signals.
It improves the accuracy of clock signals, reduces the power consumption and area of the device, is suitable for microcontrollers, and meets the high-precision requirements of IoT nodes.
Smart Images

Figure CN116032251B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of oscillators, and more particularly to a microcontroller clock device and electronic device based on precision compensation. Background Technology
[0002] In recent years, with the continuous development of IoT technology, its market size has been growing, and a large number of IoT terminals are used in daily life. A crucial module in IoT nodes is the microcontroller (MCU). As the core module, the MCU controls the entire IoT node, integrating communication, sensors, signal acquisition, and data processing functions. It must ensure that user commands to the microcontroller are executed correctly and sequentially. In today's ever-evolving application scenarios, the functions of these microcontroller chips are becoming increasingly complex, requiring the processing of larger amounts of information and faster processing speeds. This also places higher demands on how to measure accuracy, area, and power consumption.
[0003] In existing technologies, clock signals are provided to microcontrollers via oscillator-based clock generators, enabling the microcontrollers to process various operations in a timely manner. However, variations in oscillator delay cause errors in the output clock signal. Therefore, providing microcontrollers with high-precision clock signals is a problem that urgently needs to be solved. Summary of the Invention
[0004] In view of this, in order to solve the problems of the prior art, this application provides a microcontroller clock device and electronic device based on precision compensation.
[0005] In a first aspect, this application provides a microcontroller clock device based on precision compensation, including a current mirror unit, a charge-discharge oscillation unit, a comparison unit, and a logic control unit;
[0006] The current mirror unit is used to generate and copy two sets of charging current, compensation current and bias current respectively; the charging current is used to charge the capacitor of the charge-discharge oscillation unit, and the bias current is used to power the comparison unit.
[0007] The comparison unit is used to generate a complementary clock signal, so that the logic control unit performs logical processing on the complementary clock signal to generate a charging control signal and a compensation control signal.
[0008] The charge-discharge oscillation unit is used to control the charging and discharging of the capacitor according to the charging control signal, thereby oscillating to generate a clock signal; and to perform accuracy compensation on the clock signal through the compensation current according to the compensation control signal.
[0009] In an optional embodiment, the charge-discharge oscillation unit includes an RC oscillator, which includes a first capacitor, a second capacitor, a resistor, and four current control switches.
[0010] One end of the first capacitor, the second capacitor, and the resistor are respectively connected to two current control switches, and the other end of the first capacitor, the second capacitor, and the resistor are grounded; the first capacitor, the second capacitor, the resistor, and the four current control switches form five parallel oscillating sub-circuits;
[0011] In each of the oscillating sub-circuits, an intermediate node is provided between two adjacent current control switches, and each intermediate node is used to connect the compensation current or the charging current.
[0012] In an optional implementation, the RC oscillator further includes two sets of compensation control switches;
[0013] The RC oscillator is used to connect the compensation current to the oscillator sub-circuit through two sets of compensation control switches, and to connect a set of charging currents through the intermediate node between the first capacitor, the second capacitor and the resistor connected in parallel.
[0014] In an optional implementation, the comparison unit includes a first comparator and a second comparator;
[0015] Both the first comparator and the second comparator are used to generate a pair of complementary clock signals;
[0016] The logic control unit is used to perform logic processing on the complementary clock signals from the first comparator and the second comparator to generate a compensation control signal; the compensation control signal is used to control the on / off state of the compensation control switch.
[0017] In an optional implementation, the comparison unit further includes a first inverter, a second inverter, and a third inverter;
[0018] The input terminals of the first comparator are respectively connected to the intermediate nodes for receiving the charging current, and the input terminals of the second comparator are respectively connected to the intermediate nodes for receiving the compensation current.
[0019] The output of the first comparator outputs a first complementary clock signal to the second inverter and the logic control unit respectively through the first inverter. The output of the first comparator is also used to output a second complementary clock signal to the logic control unit.
[0020] The output of the second comparator outputs a third complementary clock signal to the logic control unit through the third inverter. The output of the second comparator is also used to output a fourth complementary clock signal to the logic control unit.
[0021] In an optional implementation, the logic control unit is used to output a pair of compensation control signals according to the first to fourth complementary clock signals, and each of the compensation control signals is used to control the on / off state of one of the compensation control switches.
[0022] In an optional implementation, the intermediate nodes for accessing the charging current are the first node and the second node, and the intermediate nodes for accessing the compensation current are the third node and the fourth node.
[0023] By controlling the level and timing of the first complementary clock signal and the second complementary clock signal, and thus controlling the level and timing of the compensation control signal, the conduction or disconnection of each oscillator sub-circuit is controlled.
[0024] In an optional implementation, if the first complementary clock signal and the second complementary clock signal have opposite levels, and the compensation control signals have the same level, when the capacitor is charged by the charging current, if the voltage at the first node is greater than or less than the voltage at the second node, the level of the first comparator flips.
[0025] In an optional implementation, if the first complementary clock signal and the second complementary clock signal have opposite levels, and the compensation control signals have opposite levels, when the capacitor is charged by the charging current and the compensation current, if the voltage at the third node is less than the voltage at the fourth node, the level of the second comparator flips.
[0026] In a second aspect, this application provides an electronic device, including a microcontroller clock device and a microcontroller based on precision compensation as described in any of the foregoing embodiments;
[0027] The precision-compensated microcontroller clock device is used to provide a clock signal for the microcontroller.
[0028] The embodiments of this application have the following beneficial effects:
[0029] This application provides a microcontroller clock device based on accuracy compensation. The device includes a current mirror unit, a charge-discharge oscillation unit, a comparator unit, and a logic control unit. The current mirror unit generates and replicates two sets of output currents: a charging current, a compensation current, and a bias current. The charging current charges the capacitor of the charge-discharge oscillation unit, and the bias current powers the comparator unit. The comparator unit generates a complementary clock signal, which the logic control unit then processes to generate a charging control signal and a compensation control signal. The charge-discharge oscillation unit controls the charging and discharging of the capacitor according to the charging control signal, thereby oscillating to generate the clock signal. Based on the compensation control signal, the clock signal is compensated for accuracy using the compensation current. This application generates a complementary clock signal through the comparator unit, which then processes the complementary clock signal to generate the charging control signal and the compensation control signal, thus achieving clock signal compensation. The compensation method of this application is simple and easy to implement, and while improving clock signal accuracy, it does not add any additional components, resulting in a small device size and low power consumption. Attached Figure Description
[0030] To more clearly illustrate the technical solutions of this application, the accompanying drawings used in the embodiments will be briefly described below. It should be understood that the following drawings only show some embodiments of this application and should not be considered as a limitation on the scope of protection of this application. In the various drawings, similar components are numbered similarly.
[0031] Figure 1 This paper shows a first structural schematic diagram of a microcontroller clock device based on precision compensation in an embodiment of this application;
[0032] Figure 2 This shows a second structural schematic diagram of a microcontroller clock device based on precision compensation in an embodiment of this application;
[0033] Figure 3 This illustrates a third structural schematic diagram of a microcontroller clock device based on precision compensation in an embodiment of this application;
[0034] Figure 4 A schematic diagram of the microcontroller clock device based on precision compensation in an embodiment of this application is shown;
[0035] Figure 5 This is a schematic diagram illustrating the output waveforms of various signals and intermediate nodes in the microcontroller clock device based on precision compensation in the embodiments of this application;
[0036] Figure 6 This is a schematic diagram illustrating the charging and discharging process corresponding to the first oscillation process in the microcontroller clock device based on precision compensation in an embodiment of this application;
[0037] Figure 7 This is a schematic diagram illustrating the charging and discharging process corresponding to the second oscillation process in the microcontroller clock device based on precision compensation in an embodiment of this application;
[0038] Figure 8 This is a schematic diagram illustrating the charging and discharging process corresponding to the third oscillation process in the microcontroller clock device based on precision compensation in an embodiment of this application;
[0039] Figure 9 This is a schematic diagram illustrating the charging and discharging process corresponding to the fourth oscillation process in the microcontroller clock device based on precision compensation in an embodiment of this application. Detailed Implementation
[0040] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.
[0041] The components of the embodiments of this application described and illustrated in the accompanying drawings can be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of this application provided in the drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0042] In the following, the terms “comprising,” “having,” and their cognates, which may be used in various embodiments of this application, are intended only to indicate a particular feature, number, step, operation, element, component, or combination thereof, and should not be construed as excluding, firstly, the presence of one or more other features, numbers, steps, operations, elements, components, or combinations thereof, or adding the possibility of one or more features, numbers, steps, operations, elements, components, or combinations thereof.
[0043] Furthermore, the terms "first," "second," and "third" are used only to distinguish descriptions and should not be interpreted as indicating or implying relative importance.
[0044] Unless otherwise specified, all terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which the various embodiments of this application pertain. Terms (such as those defined in a generally used dictionary) shall be interpreted as having the same meaning as in their contextual meaning in the relevant technical field and shall not be interpreted as having an idealized or overly formal meaning, unless clearly defined in the various embodiments of this application.
[0045] With the development of microcontroller technology, the performance requirements for its clock system have become increasingly stringent. Current microcontrollers have complex digital architectures, necessitating that the integrated clock source can output a stable and reliable clock while further reducing power consumption, area, and improving accuracy. In traditional oscillator clock structures, accuracy is significantly affected by temperature variations in the bias current, and a precise reference current source occupies a large chip area. Therefore, improvements to traditional oscillator clock structures employ low-power designs, using voltage comparison to switch the clock charging and discharging process. This approach is simple and represents a significant improvement in both accuracy and power consumption performance compared to traditional oscillator clock structures.
[0046] However, in this improved oscillator clock structure, comparator delay variation becomes one of the main factors contributing to its error.
[0047] Furthermore, the clock generation module in traditional oscillator clock structures can be divided into crystal oscillators, ring oscillators, RC oscillators, and LC oscillators. For microcontrollers, oscillators are mostly integrated internally, but the aforementioned crystal oscillators and LC oscillators are not suitable for internal integration. Secondly, among ring oscillators and RC oscillators, ring oscillators are difficult to achieve high precision. Therefore, in today's IoT application scenarios, RC oscillators are the best clock generation solution that combines the requirements of area, power consumption, and accuracy.
[0048] Furthermore, this application embodiment constructs a microcontroller clock device based on the RC oscillator to generate and compensate the clock signal. The device has a simple structure, low power consumption, high precision, and no additional components. It compensates the output clock signal to improve the clock signal precision, thereby effectively improving the performance of the microcontroller and better meeting the current Internet of Things needs.
[0049] This application provides a microcontroller clock device based on precision compensation (hereinafter referred to as microcontroller clock device). When the delay increases, the duration of the compensation current injection is increased accordingly, so that the output frequency hardly changes, thereby achieving precision compensation of the clock signal.
[0050] Please refer to Figure 1 and Figure 2 The microcontroller clock device based on precision compensation in this application embodiment includes a current mirror unit 100, a charge-discharge oscillation unit 200, a comparison unit 300, and a logic control unit 400.
[0051] Exemplary, the current mirror unit 100 is used to generate and separately replicate two sets of charging currents (i.e., I0). charge ), compensation current (i.e., I) compensate ) and bias current (i.e. I biasThe charging current is used to charge the capacitor of the charge-discharge oscillation unit 200, and the bias current is used to power the comparator unit 300.
[0052] The comparison unit 300 is used to generate a complementary clock signal so that the logic control unit 400 performs logic processing on the complementary clock signal to generate a charging control signal and a compensation control signal.
[0053] The charge-discharge oscillation unit 200 is used to control the charging and discharging of the capacitor according to the charging control signal, thereby oscillating to generate a clock signal (i.e., CLK); and to perform accuracy compensation of the clock signal by means of compensation current according to the compensation control signal.
[0054] In one embodiment, the charge-discharge oscillation unit 200 includes an RC oscillator, which includes a first capacitor (C1), a second capacitor (C2), a resistor (R), and four current control switches. One end of the first capacitor, the second capacitor, and the resistor are respectively connected to two current control switches, and the other end of the first capacitor, the second capacitor, and the resistor are grounded. Five parallel oscillation sub-circuits are formed between the first capacitor, the second capacitor, the resistor, and the four current control switches. An intermediate node (Node0-Node3) is correspondingly provided between two adjacent current control switches in each oscillation sub-circuit, and each intermediate node is used to connect a compensation current or a charging current.
[0055] Optionally, the RC oscillator also includes two sets of compensation control switches; the RC oscillator is used to connect compensation current to the oscillator circuit through the two sets of compensation control switches respectively, and to connect a set of charging current through the intermediate node between the first capacitor, the second capacitor and the resistor connected in parallel.
[0056] Furthermore, the comparison unit 300 includes a first comparator (i.e., Comparator0) and a second comparator (i.e., Comparator1); both the first and second comparators are used to generate a pair of complementary clock signals; the logic control unit 400 is used to perform logic processing on the complementary clock signals from the first and second comparators to generate compensation control signals (i.e., CPS0, CPS1); the compensation control signals are used to control the on / off state of the compensation control switch.
[0057] As an optional implementation, the comparator unit 300 further includes a first inverter (i.e., Inv1), a second inverter (i.e., Inv2), and a third inverter (i.e., Inv3); the input terminals of the first comparator are respectively connected to intermediate nodes for receiving charging current, and the input terminals of the second comparator are respectively connected to intermediate nodes for receiving compensation current; the output terminal of the first comparator outputs a first complementary clock signal (i.e., φ1) to the second inverter and the logic control unit 400 through the first inverter, and the output terminal of the first comparator is also used to output a second complementary clock signal (i.e., φ2) to the logic control unit 400; the output terminal of the second comparator outputs a third complementary clock signal (i.e., COMPA) to the logic control unit 400 through the third inverter, and the output terminal of the second comparator is also used to output a fourth complementary clock signal (i.e., COMPB) to the logic control unit 400.
[0058] In this embodiment, the intermediate nodes used to access the charging current are respectively set as the first node (i.e., Node0) and the second node (i.e., Node1), and the intermediate nodes used to access the compensation current are respectively set as the third node (i.e., Node2) and the fourth node (i.e., Node3).
[0059] Exemplarily, the logic control unit 400 is used to output a pair of compensation control signals according to the first to fourth complementary clock signals, each compensation control signal being used to control the on / off state of a corresponding compensation control switch. Furthermore, the microcontroller clock device can control the level timing of the compensation control signals by controlling the level timing of the first and second complementary clock signals, thereby controlling the on / off state of the corresponding oscillator sub-circuit.
[0060] In this embodiment, the current mirror unit 100 is used to provide current to the microcontroller clock device, including a charging current (i.e., IC) for charging the capacitor. charge The compensation current (i.e., I) used for accuracy compensation compensate ), and the bias current (i.e., I) used to ensure the normal operation of each comparator in the comparison unit 300. bias Simultaneously, the charging current and compensation current are controlled to output in a specific proportional relationship, the expression for which is:
[0061] I compensate =α·I charge .
[0062] Where α represents the ratio between the charging current and the compensation current.
[0063] The charge-discharge oscillation unit 200 is used to charge and discharge the capacitor and generate a clock signal. At the same time, it performs switching control of charging and discharging the capacitor according to the complementary clock signal of the comparison unit 300, and performs compensation control on the output clock signal according to the compensation control signal output by the logic control unit 400.
[0064] The comparator unit 300 is specifically an improvement on the existing clock module, which focuses on reducing the comparator's offset and delay, while minimizing the power consumption and area of the microcontroller clock device.
[0065] The logic control unit 400 performs logic processing on the complementary clock signal output by the comparison unit 300 to generate a compensation control signal and a charging control signal. The compensation control signal is used to implement the compensation control of the clock signal by the charging and discharging oscillation unit 200, and the charging control signal is used to implement the charging control of the charging and discharging oscillation unit 200.
[0066] As an optional implementation method, such as Figure 3 As shown, assuming an ideal situation where the comparator has no delay, when φ1 = 1 (conducting) and φ2 = 0 (disconnecting), the voltage V0 generated at Node0 is:
[0067] V0 = I charge ·R;
[0068] Where R is the resistance value of resistor R in the microcontroller clock circuit, and the voltage V1 generated at Node1 is:
[0069]
[0070] Where T is the oscillation period of the charging and discharging oscillation unit 200, and C is the capacitance value connected to the circuit at Node1.
[0071] The voltages of both nodes are input to the first comparator, and the phase of the output clock signal flips when the voltages are equal. By combining the two voltage formulas corresponding to Node0 and Node1, the expression for the frequency (F) of the clock signal can be obtained:
[0072]
[0073] Furthermore, in an ideal situation, the accuracy of the frequency of the output clock signal depends only on the values of the capacitor and resistor. However, the comparator introduces a delay, which is the main source of frequency error in the clock signal output by existing clock devices. Based on this, this embodiment performs accuracy compensation for this error to obtain higher frequency accuracy of the clock signal.
[0074] Furthermore, such as Figure 4 As shown, in a typical RC oscillator that controls charging and discharging with a comparison voltage, the comparator introduces a delay, causing the voltage V0 originally generated at Node0 (or Node2) to exceed the reference voltage source (i.e., V). ref The voltage V1 generated at Node 1 (or Node 3) that immediately begins charging delays the start of charging. Let the delay time be Δt. Therefore, this embodiment proposes that V1 first use a voltage equal to the charging current (i.e., I0). charge A suitably large current (i.e., including charging current and compensation current) (I) charge +I compensate The current is used to charge the capacitor at the corresponding node, so that the V1 curve will catch up with V0. A comparator is used to determine whether it has caught up. If it has, the original charging current (i.e., I) is used again. charge The current charges the capacitor, but after catching up, the current will be delayed by Δt due to the comparator's delay before it is redirected. Therefore, when both comparators use the same type of comparator, this embodiment uses a suitable compensation current (i.e., Ic) to compensate for the current. compensate This is used to compensate for accuracy errors.
[0075] Assuming the capacitance (C) is the same at all nodes, the corresponding charge (Q) can be obtained as follows:
[0076] Q = C * U;
[0077] To ensure that accuracy compensation is achieved, the following relationship must be satisfied:
[0078] Q = I charge ·(t1+2·Δt)=(I charge +I compensate )·(t1+Δt);
[0079] Where t1 is the time period from when Node1 starts charging and generates V1 until V1 catches up with V0.
[0080] Furthermore, we can obtain I compensate with I charge Relationship:
[0081]
[0082] Secondly, when environmental conditions such as temperature or voltage change, the comparator's delay (i.e., Δt) will also change. In a traditional RC oscillator, an increase in delay will lead to a decrease in the output frequency. Therefore, in this embodiment, current compensation is used to achieve accuracy compensation.
[0083] In this embodiment, the process of generating a complete clock oscillation cycle to output a clock signal during the operation of the microcontroller clock device can be divided into four oscillation processes.
[0084] See also Figure 5 and Figure 6 , Figure 5 This represents the first oscillation process corresponding to a complete clock oscillation cycle. Where φ1 = 0 (off), φ2 = 1 (on), CPS0 = 1 (on), CPS1 = 0 (off), and current I... charge A reference voltage (i.e., I) is formed by flowing through the resistor. charge ·R), current (i.e., I) charge +I compensate The second capacitor at node Node 2 is charged, while the first capacitor at node Node 3 is discharged to ground. This stage is the catch-up stage described above. When the catch-up is successful, that is, when the voltage at node Node 2 is higher than the voltage at node Node 3, and after the second comparator compares and the logic control unit 400 returns the relevant control signals (i.e., the complementary clock signal and the compensation control signal), the second oscillation process begins.
[0085] See also Figure 5 and Figure 7 , Figure 7 In the second oscillation process, φ1 = 0 (off), φ2 = 1 (on), and CPS0 = CPS0 = 0 (off). During this oscillation process, there is no I. compensate When charging a capacitor, only I charge The second capacitor at node Node2 is charged with a current I. charge The current still flows through resistor R to form a reference voltage (I) charge ·R), the first capacitor at node 3 is discharged to ground to 0. When the second capacitor is charged, causing the voltage at node 0 to be higher than the voltage at node 1, the output level of the first comparator flips, and then the third oscillation process begins.
[0086] That is, if the first complementary clock signal and the second complementary clock signal have opposite levels, and the levels of each compensation control signal are the same, when the capacitor is charged by the charging current, if the voltage at the first node is greater than the voltage at the second node, the level of the first comparator will flip.
[0087] See also Figure 5 and Figure 8 , Figure 8 In the third oscillation process, φ1 = 1, indicating conduction. When CPS0 is off, it is off; when CPS1 is on, it is on. During this oscillation, the current (I)charge +I compensate The first capacitor at Node3 is charged with a current I. charge A reference voltage (I) is formed by flowing through resistor R. charge ·R), the second capacitor at node Node2 discharges to ground. Similarly, when the voltage at node Node3 is higher than the voltage at node Node2, the output level of the second comparator flips, and then the fourth oscillation process begins.
[0088] That is, if the first complementary clock signal and the second complementary clock signal have opposite levels, and the levels of each compensation control signal are opposite, when the capacitor is charged by the charging current and the compensation current, if the voltage at the third node is less than the voltage at the fourth node, the level of the second comparator will flip.
[0089] See also Figure 5 and Figure 9 , Figure 9 Corresponding to the fourth oscillation process, where φ1 = 1 (conduction), φ2 = 0 (deactivation), and CPS0 = CPS1 = 0 (deactivation). In process four, the current I... charge The first capacitor at Node3 is charged with a current I. charge A reference voltage (I) is formed by flowing through resistor R. charge ·R), the second capacitor at node Node2 discharges to 0 to ground. When the voltage at node Node1 is higher than the voltage at node Node0, the output level of the first comparator flips and re-enters the first oscillation process, repeating this cycle to periodically output the compensated clock signal.
[0090] That is, if the first complementary clock signal and the second complementary clock signal have opposite levels, and the levels of each compensation control signal are the same, when the capacitor is charged by the charging current, if the voltage at the first node is less than the voltage at the second node, the level of the first comparator will flip.
[0091] In summary, this embodiment can compensate for the delay error of the comparator, thereby significantly reducing the impact of delay error changes on the actual output frequency, and making the frequency of the output clock signal close to the ideal clock signal frequency.
[0092] This application embodiment generates a complementary clock signal through a comparison unit, enabling the logic control unit to perform logical processing on the complementary clock signal to generate a charging control signal and a compensation control signal, thereby achieving clock signal compensation. The compensation method of this application embodiment is simple and easy to implement, and while improving the accuracy of the clock signal, it does not add any additional components, resulting in a small device size and low power consumption; thus, the device is easily applied to microcontrollers to provide corresponding high-precision clock signals for microcontrollers.
[0093] This application also provides an electronic device, which includes the above-described precision-compensated microcontroller clock device and microcontroller; the precision-compensated microcontroller clock device is used to provide a clock signal to the microcontroller.
[0094] It is understood that the above-described precision-based microcontroller clock device corresponds to the electronic device of this embodiment, and any of the options in the above embodiments can be applied to this embodiment, so they will not be described again here.
[0095] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that, as an alternative implementation, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0096] In addition, the functional modules or units in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0097] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
Claims
1. A precision-compensated microcontroller clocking apparatus, comprising: It includes a current mirror unit, a charge / discharge oscillation unit, a comparison unit, and a logic control unit; The current mirror unit is used to generate and copy two sets of charging current, compensation current and bias current respectively; the charging current is used to charge the capacitor of the charge-discharge oscillation unit, and the bias current is used to power the comparison unit. The comparison unit is used to generate a complementary clock signal, so that the logic control unit performs logical processing on the complementary clock signal to generate a charging control signal and a compensation control signal. The charge-discharge oscillation unit is used to control the charging and discharging of the capacitor according to the charging control signal, thereby oscillating to generate a clock signal; and to perform accuracy compensation on the clock signal through the compensation current according to the compensation control signal. The charging and discharging oscillation unit includes an RC oscillator, which includes a first capacitor, a second capacitor, a resistor, and six current control switches. One end of the first capacitor, the second capacitor, and the resistor are respectively connected to two current control switches, and the other end of the first capacitor, the second capacitor, and the resistor is grounded; five parallel oscillating sub-circuits are formed between the first capacitor, the second capacitor, the resistor, and the six current control switches; an intermediate node is provided between two adjacent current control switches in each oscillating sub-circuit, and each intermediate node is used to connect the compensation current or the charging current.
2. The precision compensation based microcontroller clocking apparatus of claim 1, wherein, The RC oscillator also includes two sets of compensation control switches; The RC oscillator is used to connect the compensation current to the oscillator sub-circuit through two sets of compensation control switches, and to connect a set of charging currents through the intermediate node between the first capacitor, the second capacitor and the resistor connected in parallel.
3. The precision compensation based microcontroller clocking apparatus of claim 2, wherein, The comparison unit includes a first comparator and a second comparator; Both the first comparator and the second comparator are used to generate a pair of complementary clock signals; The logic control unit is used to perform logic processing on the complementary clock signals from the first comparator and the second comparator to generate a compensation control signal; the compensation control signal is used to control the on / off state of the compensation control switch.
4. The precision-compensated microcontroller clock apparatus of claim 3, wherein, The comparison unit further includes a first inverter, a second inverter, and a third inverter; The input terminals of the first comparator are respectively connected to the intermediate nodes for receiving the charging current, and the input terminals of the second comparator are respectively connected to the intermediate nodes for receiving the compensation current. The output of the first comparator outputs a first complementary clock signal to the second inverter and the logic control unit respectively through the first inverter. The output of the first comparator is also used to output a second complementary clock signal to the logic control unit. The output of the second comparator outputs a third complementary clock signal to the logic control unit through the third inverter. The output of the second comparator is also used to output a fourth complementary clock signal to the logic control unit.
5. The microcontroller clock device based on precision compensation according to claim 4, characterized in that, The logic control unit is used to output a pair of compensation control signals according to the first to fourth complementary clock signals, and each compensation control signal is used to control the on / off state of one of the compensation control switches.
6. The precision-compensated microcontroller clock apparatus of claim 5, wherein, The intermediate nodes used to access the charging current are the first node and the second node, and the intermediate nodes used to access the compensation current are the third node and the fourth node. By controlling the level and timing of the first complementary clock signal and the second complementary clock signal, and thus controlling the level and timing of the compensation control signal, the corresponding oscillator sub-circuit can be turned on or off.
7. The precision-compensated microcontroller clock apparatus of claim 6, wherein, If the first complementary clock signal and the second complementary clock signal have opposite levels, and the levels of each of the compensation control signals are the same, when the capacitor is charged by the charging current, if the voltage at the first node is greater than or less than the voltage at the second node, the level of the first comparator will flip.
8. The microcontroller clock device based on precision compensation according to claim 6, characterized in that, If the first complementary clock signal and the second complementary clock signal have opposite levels, and the compensation control signals have opposite levels, when the capacitor is charged by the charging current and the compensation current, if the voltage at the third node is less than the voltage at the fourth node, the level of the second comparator will flip.
9. An electronic device, comprising: Includes the microcontroller clock device and microcontroller based on precision compensation as described in any one of claims 1-8; The precision-compensated microcontroller clock device is used to provide a clock signal for the microcontroller.