Patent Description:
A clock is taken as an important element in a microcontroller, and its high precision and wide power supply working range are of great significance to improve the performance of a whole chip. Generally, a Remote Control (RC) clock has a simple structure and is widely applied in an integrated circuit. However, the precision of the RC clock is often limited by the precision of an internal resistor and a capacitor, a power supply and a temperature, and cannot be very high under a full temperature and a full voltage. In an actual application, a deviation to the precision of the chip caused by frequency fluctuation of the clock in a full-temperature range and a full-voltage range is even up to ±<NUM>%. Hence, in the related art, large-range fluctuation in an environmental temperature and a power voltage of a place where the clock is located causes the fluctuation of a frequency clock, and thus the precision of the microcontroller has a large deviation.

The document <CIT> discloses a temperature compensated crystal oscillator circuit that utilizes switched capacitor technology wherein all circuitry is contained in a single electronic package, does not need to be calibrated after it leaves manufacturing, and that provides an oscillation frequency with little variation over a wide temperature range,.

A main objective of the present disclosure is to provide a clock compensation circuit, a clock circuit and a microcontroller to solve the problem of large fluctuation of a clock frequency output by a clock circuit in the related art.

To this end, according to one aspect of the present invention, there is provided a clock compensation circuit according to independent claim <NUM>. The clock compensation circuit includes a detection circuit and a control circuit.

The detection circuit is configured to detect a capacitance control parameter capable of affecting a clock frequency output by a clock circuit.

The control unit is connected with the detection circuit, and is configured to adjust a capacitance value of a target capacitor in the clock circuit according to the capacitance control parameter detected by the detection circuit, so as to change the clock frequency output by the clock circuit.

Further, the detection circuit may include: a power detection circuit, configured to detect a power voltage of the clock circuit and take the power voltage as the capacitance control parameter.

Further, the control unit may include: a first conversion module, configured to convert an analog signal corresponding to the power voltage detected by the power detection circuit into a first digital signal; a first transmission module, configured to input the first digital signal to a control end of the target capacitor; and a first control module, configured to adjust the capacitance value of the target capacitor according to the first digital signal, so as to change the clock frequency output by the clock circuit.

Further, the detection circuit includes: a temperature detection circuit, configured to detect an environmental temperature of an environment where the clock circuit is located and take the environmental temperature as the capacitance control parameter.

Further, the control unit includes: a second conversion module, configured to convert an analog signal corresponding to the environmental temperature detected by the temperature detection circuit into a second digital signal; a second transmission module, configured to input the second digital signal to the control end of the target capacitor; and a second control module, configured to adjust the capacitance value of the target capacitor according to the second digital signal, so as to change the clock frequency output by the clock circuit.

Further, the second control module includes: a first comparison sub-module, configured to compare a value of the detected environmental temperature with a value of a preset temperature; a first adjustment sub-module, configured to decrease, under a condition in which the value of the environmental temperature is smaller than the value of the preset temperature by the comparison, the capacitance value of the target capacitor to a first target capacitance value according to the second digital signal; and a second adjustment sub-module, configured to increase, under a condition in which the value of the environmental temperature is greater than the value of the preset temperature by the comparison, the capacitance value of the target capacitor to a second target capacitance value according to the second digital signal.

Further, the first control module may include: a second comparison sub-module, configured to compare a value of the power voltage with a value of a preset voltage; a third adjustment sub-module, configured to decrease, under a condition in which the value of the power voltage is smaller than the value of the preset voltage by the comparison, the capacitance value of the target capacitor to a third target capacitance value according to the first digital signal; and a fourth adjustment sub-module, configured to increase, under a condition in which the value of the power voltage is greater than the value of the preset voltage, the capacitance value of the target capacitor to a fourth target capacitance value according to the first digital signal.

Further, the detection circuit may further include: a comparator circuit, disposed in the detection circuit, and configured to perform analog-to-digital conversion processing on the capacitance control parameter detected by the detection circuit so as to convert the capacitance control parameter into a corresponding digital signal, where the control unit is configured to adjust the capacitance value of the target capacitor according to the corresponding digital signal to change the clock frequency output by the clock circuit.

To this end, according to another aspect of the present invention, there is provided a clock circuit, which may include a target capacitor capable of changing a clock frequency output by the clock circuit, and the clock compensation circuit.

To this end, according to another aspect of the present invention, there is provided a microcontroller, which includes the clock circuit.

Based on the above any implementation solution of the present invention, by detecting the capacitance control parameter of the target capacitor for controlling the clock frequency output by the clock circuit and adjusting the capacitance value of the target capacitor, the adjustment on the clock frequency output by the clock circuit is implemented; and thus, the clock compensation circuit of the present disclosure can compensate the clock circuit according to a demand to reduce the fluctuation of the clock frequency output by the clock circuit.

The accompanying drawings are described here to provide further understanding of the present disclosure, and form a part of the present disclosure. The schematic embodiments and description of the present disclosure are adopted to explain the present disclosure, and do not form improper limits to the present disclosure. In the drawings:.

The present disclosure is described below in detail with reference to accompanying drawings and in combination with the embodiment.

In order to make those skilled in the art better understand the solutions of the present disclosure, the following clearly and completely describes the technical solutions in the embodiments of the present disclosure with reference to the accompanying drawings in the embodiments of the present disclosure. Apparently, the described embodiments are a part rather than all of the embodiments of the present disclosure. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present disclosure without creative efforts shall fall within the protection scope of the present invention that is defined by the appended claims.

It should be noted that, terminologies such as "first" and "second" in the specification, claims and accompanying drawings of the present disclosure are only used to distinguish similar objects, rather than to describe a special order or a precedence order. It should be understood that data used in such a way may be interchangeable in a certain cases, such that the embodiments of the present disclosure described here can be implemented in an order other than those illustrated or described here. As used herein, the terms "comprises," "comprising," "includes," "including," "has," "having" or any other variation thereof are intended to cover a non-exclusive inclusion. For example, a process, method, article, or apparatus that comprises a list of steps or units is not necessarily limited to only those steps or units but may include other steps or units not expressly listed or inherent to such process, method, article, or apparatus.

According to an embodiment of the present disclosure, there is provided a clock compensation circuit.

<FIG> is a schematic diagram of a clock compensation circuit provided according to an embodiment of the present disclosure. As shown in <FIG>, the clock compensation circuit may include the following structures.

A detection circuit <NUM> is configured to detect a capacitance control parameter capable of affecting a clock frequency output by a clock circuit.

In the present disclosure, the capacitance control parameter capable of affecting the clock frequency output by the clock circuit is detected by the detection circuit <NUM> in the clock compensation circuit. In the present disclosure, a target capacitor is disposed in the clock circuit, and its capacitance value is adjustable. The change to the clock frequency output by the clock circuit can be implemented according to a digital signal input to a control end of the target capacitor.

A control unit <NUM> is connected with the detection circuit <NUM>, and is configured to adjust the capacitance value of the target capacitor according to the capacitance control parameter detected by the detection circuit <NUM>, so as to change the clock frequency output by the clock circuit.

The control unit <NUM> connected with the detection circuit <NUM> in the clock compensation circuit can adjust the capacitance value of the target capacitor according to the capacitance control parameter detected by the detection circuit <NUM>, and thus changes the clock frequency output by the clock circuit.

Through the detection circuit <NUM> and the control unit <NUM> in the clock compensation circuit of the present disclosure, the clock circuit can be compensated according to a demand, and thus the clock frequency output by the clock circuit is changed, and the fluctuation of the clock frequency output by the clock circuit is reduced.

Optionally, in the clock compensation circuit provided by this embodiment of the present disclosure, the detection circuit <NUM> may include: a power detection circuit <NUM>, configured to detect a power voltage in the clock circuit and take the power voltage as the capacitance control parameter.

Specifically, when the power voltage is the capacitance control parameter, the detection circuit <NUM> in the clock compensation circuit provided by this embodiment of the present disclosure may include the power detection circuit configured to detect the power voltage of the clock circuit. The power detection circuit in the detection circuit <NUM> detects the power voltage of the clock circuit, and adjusts the capacitance value of the target capacitor according to the power voltage, so as to change the clock frequency output by the clock circuit.

Optionally, in the clock compensation circuit provided by this embodiment of the present disclosure, the control unit <NUM> may include: a first conversion module, configured to convert an analog signal corresponding to the power voltage detected by the detection circuit <NUM> (specifically the power detection circuit) into a first digital signal; a first transmission module, configured to input the first digital signal to the control end of the target capacitor; and a first control module, configured to control the capacitance value of the target capacitor according to the first digital signal, so as to change the clock frequency output by the clock circuit.

For example, the detection circuit <NUM> detects that the power voltage of the clock circuit is <NUM>. The first conversion module converts the analog signal corresponding to the power voltage detected by the power detection circuit into the first digital signal, i.e., the first conversion module converts the <NUM>. 3V into the first digital signal. The first control module controls the capacitance value of the target capacitor according to the first digital signal in a circuit where the target capacitor is located so as to change the clock frequency output by the clock circuit. It is to be noted that each figure in the above example is merely for the convenience of description, and does not represent a figure adjusted normally in an actual circuit operation process.

Optionally, in the clock compensation circuit provided by this embodiment of the present disclosure, the first control module may include: a second comparison sub-module, configured to compare a value of the power voltage and a preset voltage; a third adjustment sub-module, configured to decrease, under a condition in which the power voltage is smaller than the preset voltage by the comparison, the capacitance value of the target capacitor to a third target capacitance value according to the first digital signal; and a fourth adjustment sub-module, configured to increase, under a condition in which the value of the power voltage is greater than the value of the preset voltage, the capacitance value of the target capacitor to a fourth target capacitance value according to the first digital signal.

For example, the power voltage at which the clock circuit operates ranges from <NUM>. 7V to <NUM>. 5V, and the preset voltage is 5V. The second comparison sub-module performs the value comparison on the detected power voltage and the preset voltage. In a case where the detected power voltage is <NUM>. 5V and is smaller than the preset voltage 5V, and the capacitance value of the target capacitor is 110F, and an adjustable range of the target capacitor is 50F-550F, under a condition in which the value of the power voltage is smaller than the value of the preset voltage by the comparison, the third adjustment sub-module decreases the capacitance value 110F of the target capacitor to 100F. In a case where the detected power voltage is <NUM>. 3V and is greater than the preset voltage 5V, under a condition in which the power voltage is greater than the preset voltage by the comparison, the fourth adjustment sub-module increases the capacitance value 110F of the target capacitor to 130F. It is to be noted that each figure in the above example is merely for the convenience of description, and does not represent a figure adjusted normally in an actual circuit operation process.

In the clock compensation circuit provided by this embodiment of the present disclosure, the detection circuit <NUM> further includes: a temperature detection circuit, configured to detect an environmental temperature of an environment where the clock circuit is located and take the environmental temperature as the capacitance control parameter.

Specifically, when the environmental temperature is the capacitance control parameter, the detection circuit <NUM> in the clock compensation circuit provided by this embodiment of the present disclosure includes the temperature detection circuit configured to detect the environmental temperature of the environment where the clock circuit is located. The control unit controls the target capacitor according to the environmental temperature, detected by the temperature detection circuit, of the environment where the clock circuit is located, so as to change the clock frequency output by the clock circuit.

In the clock compensation circuit provided by this embodiment of the present disclosure, the control unit <NUM> further includes: a second conversion module, configured to convert an analog signal corresponding to the environmental temperature detected by the detection circuit <NUM> into a second digital signal; a second transmission module, configured to input the second digital signal to the control end of the target capacitor; and a second control module, configured to adjust the capacitance value of the target capacitor according to the second digital signal, so as to change the clock frequency output by the clock circuit.

It is to be noted that, in this embodiment of the present disclosure, a mapping relationship between an environmental temperature and a voltage value is established in advance. For example, the detection circuit <NUM> detects that the environmental temperature of the environment where the clock circuit is located is <NUM> and the voltage value corresponding to the environmental temperature <NUM> is 5V, the detection circuit <NUM> detects that the environmental temperature of the environment where the clock circuit is located is <NUM> and the voltage value corresponding to the environmental temperature <NUM> is <NUM>. 1V, and the like. The analog signal corresponding to the environmental temperature detected by the temperature detection circuit specifically is an analog signal corresponding to the voltage value that corresponds to the environmental temperature detected by the temperature detection circuit, i.e., the second conversion module converts the analog signal corresponding to the voltage value that corresponds to the environmental temperature detected by the temperature detection circuit into the second digital signal; and the second control module adjusts the capacitance value of the target capacitor according to the second digital signal, so as to change the clock frequency output by the clock circuit. It is to be noted that each figure in the above example is merely for the convenience of description, and does not represent a figure adjusted normally in an actual circuit operation process and only illustrates a technology in the present disclosure.

In the clock compensation circuit provided by this embodiment of the present disclosure, the second control module includes: a first comparison sub-module, configured to compare a value of the detected environmental temperature and a preset temperature; a first adjustment sub-module, configured to decrease, under a condition in which the value of the environmental temperature is smaller than the value of the preset temperature, the capacitance value of the target capacitor to a first target capacitance value according to the second digital signal; and a second adjustment sub-module, configured to increase, under a condition in which the value of the environmental temperature is greater than the value of the preset temperature, the capacitance value of the target capacitor to a second target capacitance value according to the second digital signal.

For example, the environmental temperature of the environment where the clock circuit is located ranges from -<NUM> to <NUM>, and the preset temperature is <NUM>. The first comparison sub-module compares a value of the detected environmental temperature with a value of a preset temperature. In a case where the detected environmental temperature is <NUM> and is smaller than the preset temperature <NUM>, and an adjustable range of the target capacitor is <NUM>-550F and the capacitance value of the target capacitor is 110F, under a condition in which the temperature is smaller than the preset temperature by the comparison, the first adjustment sub-module decreases the capacitance value 110F of the target capacitor to 100F. In a case where the detected environmental temperature is <NUM> and is greater than the preset temperature <NUM>, under a condition in which the temperature is greater than the preset temperature by the comparison, the second adjustment sub-module increases the capacitance value 110F of the target capacitor to 130F. It is to be noted that each figure in the above example is merely for the convenience of description, and does not represent a figure adjusted normally in an actual circuit operation process.

Optionally, in the clock compensation circuit provided by this embodiment of the present disclosure, the detection circuit <NUM> may further include: a comparator circuit, disposed in the detection circuit <NUM>, and configured to perform analog-to-digital conversion processing on the capacitance control parameter detected by the detection circuit <NUM> so as to convert the capacitance control parameter into a corresponding digital signal, where the control unit <NUM> is specifically configured to control the target capacitor according to the corresponding digital signal to change the clock frequency output by the clock circuit.

In the present disclosure, a comparator in the comparator circuit converts, according to own characteristics that a high level is output when a potential at a forward input end is higher than a reverse input end, and a low level is output when a potential at the reverse input end is higher than the forward input end, the analog signal detected by the detection circuit <NUM> and corresponding to the capacitor control parameter into a corresponding digital signal. For example, the corresponding digital signal is <NUM>; and the control end of the target capacitor is controlled according to this binary code so as to change the clock frequency output by the clock circuit.

It is to be noted that, in the structure of the clock compensation circuit of the present disclosure, within a low-voltage range, according to an actual precision demand, a plurality of comparator circuits are increased. Moreover, it is necessary to provide a hysteresis voltage inside each of the comparator circuits, so as to ensure that digital signals are not generated by comparators in a mess. Since the output clock frequency of the clock circuit is in a linear relationship with the environmental temperature, digits controlled digitally are designed on the premise of guaranteeing the precision according to an actual temperature range. With the hysteresis voltages inside the comparator circuits, it is ensured that the digital signals are not generated by the comparators in a mess.

With the clock compensation circuit provided by this embodiment of the present disclosure, the detection circuit <NUM> detects the capacitance control parameter capable of affecting the clock frequency output by the clock circuit, and the control unit <NUM> adjusts the capacitance value of the target capacitor in the clock circuit according to the capacitance control parameter detected by the detection circuit, so as to change the clock frequency output by the clock circuit, so the problem of large fluctuation of a clock frequency output by a clock circuit in the related art is solved. The capacitance value of the target capacitor in the clock circuit is adjusted according to the capacitance control parameter detected by the detection circuit <NUM>, so that the clock frequency output by the clock circuit is changed, and thus the effect of reducing the fluctuation of the clock frequency output by the clock circuit is achieved.

The present disclosure is described below with comparative descriptions. <FIG> is a structural diagram of a clock circuit in the related art. As shown in <FIG>, a structural diagram of a clock circuit inside a chip having a universal structure is shown in <FIG>. A current bias in a direct proportion to a reference current source at <NUM>: M is applied to branches of an Rtrim and an R<NUM>. <FIG> is a working principle diagram of a clock circuit in the related art. As shown in <FIG>, a generated voltage bias (Vinp+ and Vinp-) jumped along with the clock is applied to one end of a high-speed comparator; the other end of the high-speed comparator charges and discharges a capacitor according to two switchable current sources to obtain a zigzag wave voltage Vim. The voltages at two ends pass through the high-speed comparator to obtain a square wave clock. Since a capacitance and a resistance in a process when a chip is manufactured actually may have a <NUM>% deviation at most compared with ideal nominal capacitance value and resistance value, it is very difficult that an internal clock circuit made actually reaches a very high precision if there is no calibration circuit. Moreover, even through the internal calibration circuit exists, an about <NUM>% deviation may also be generated due to different working voltages and temperatures of places where the chip is located.

<FIG> is a schematic diagram of a frequency change of a clock circuit in a full-voltage range in the related art. It may be seen from actual test results in <FIG> that an output frequency may not be in a linear relationship with a power voltage, but change violently within a range in which the power voltage is low. From <FIG>, because of the change of the power voltage in a full-voltage range, the output frequency changes about <NUM>%.

<FIG> is a schematic diagram of a frequency change of a clock circuit in a full-temperature range in the related art. As shown in <FIG>, an output frequency is in a linear relationship with an environmental temperature. Because of the change of the power voltage in a full-temperature range, the output frequency changes about ±<NUM>%.

<FIG> is a structural diagram of a clock circuit provided according to an embodiment of the present disclosure. The detection circuit in the present disclosure is increased to the circuit in <FIG>. Specifically, a power detection circuit is increased to detect the power voltage, convert an analog signal corresponding to the power voltage into a binary code (a digital signal corresponding to the analog signal), apply the binary code (the digital signal corresponding to the analog signal) to a C_trim circuit, and control a magnitude of a capacitor connected inside a system loop to adjust an output frequency of the circuit, thereby achieving the effect of automatically compensating the power voltage.

By detecting the clock circuit including the power detection circuit, a result is as shown in <FIG> is a schematic diagram of a frequency change of a clock circuit in a full-voltage range provided according to an embodiment of the present disclosure. It may be seen from actual test results in <FIG> that the change in a range in which the power voltage is low is stable; and in a full-voltage range, because of the change of the power voltage, the output frequency changes about ±<NUM>%. In other words, the power voltage of the clock circuit is compensated automatically, so that the clock frequency output by the clock circuit is adjusted, and the fluctuation of the clock frequency output by the clock circuit is reduced.

Optionally, another detection circuit in the present disclosure is further increased to the circuit in <FIG>. Specifically, the temperature detection circuit is increased to convert an analog signal corresponding to the environmental temperature of the environment where the clock circuit is located into a binary code (a digital signal corresponding to the analog signal), apply the binary code (the digital signal corresponding to the analog signal) to the C_trim circuit, and control a magnitude of a capacitor connected inside the system loop to adjust the output frequency of the circuit, thereby achieving the effect of automatically compensating the temperature.

By detecting the clock circuit including the temperature detection circuit, a result is as shown in <FIG> is a schematic diagram of a frequency change of a clock circuit in a full-temperature range provided according to an embodiment of the present disclosure. It may be seen from actual test results in <FIG> that the change in the full-temperature range is stable, and ±<NUM>% precision in the full-temperature range can be achieved. In other words, the temperature of the clock circuit is compensated automatically, so that the clock frequency output by the clock circuit is adjusted, and the fluctuation of the clock frequency output by the clock circuit is reduced.

An embodiment of the present disclosure further provides a clock circuit. The clock circuit may include a target capacitor capable of changing a clock frequency output by the clock circuit, and any clock compensation circuit provided by the embodiments of the present disclosure. In the clock circuit of the any clock compensation circuit provided by the present disclosure, by adjusting the clock frequency output by the clock circuit, the fluctuation of the clock frequency is reduced, and thus the effect of reducing a deviation of the precision of a microcontroller is achieved, and the effect of reducing the fluctuation of the clock frequency output by the clock circuit is achieved.

It is to be noted that the clock compensation circuit included in the clock circuit is the same or similar to the clock compensation circuit in the above embodiment, and relevant specific contents or functions are described in detail in the above embodiment and will not be repeated herein.

An embodiment of the present disclosure further provides a microcontroller. The microcontroller includes a clock circuit provided by the embodiments of the present disclosure. With the microcontroller provided by the present disclosure, by adjusting the clock frequency output by the clock circuit, the fluctuation of the clock frequency output by the clock circuit is reduced, and thus the effect of reducing a deviation of the precision of a microcontroller is achieved, and the effect of reducing the fluctuation of the clock frequency output by the clock circuit is achieved.

It is to be noted that the above embodiments are expressed as a combination of a series of actions for the simplicity of description. A person skilled in the art should know that the present disclosure is not limited the described action sequence because some steps may be performed by using other sequences or performed simultaneously according to the present disclosure. On the other hand, the person skilled in the art should know that the embodiments described in the specification are preferred embodiments, and relevant actions and modules are unnecessarily required by the present disclosure.

In the above embodiments of the present disclosure, each embodiment is described with its emphasis. A portion not detailed in some embodiment may be referred to related description of other embodiments.

The modules described as separate parts may or may not be physically separated, and parts displayed as modules may or may not be physical modules, and namely may be located in the same place, or may also be distributed to multiple network modules. Part or all of the modules may be selected to achieve the purpose of the solutions of the embodiments according to a practical requirement.

In addition, each function module in each embodiment of the present disclosure may be integrated into a processing module, each module may also exist independently, and two or more than two module may also be integrated into a module. The integrated module may be implemented in a hardware form, and may also be implemented in form of hardware and software function module.

It is apparent that the person skilled in the art should know that each module of the present disclosure may be implemented by a universal computing device, and the modules may be concentrated on a single computing device or distributed on a network formed by a plurality of computing devices, and may optionally be implemented by program codes executable for the computing devices, so that the modules may be stored in a storage device for execution with the computing devices, the shown or described steps may be executed in sequences different from those described here in some circumstances, or may form each integrated circuit module respectively, or multiple modules therein may form a single integrated circuit module for implementation. Therefore, the present disclosure is not limited to any specific hardware and software combination.

Claim 1:
A clock compensation circuit, comprising:
a detection circuit, (<NUM>), configured to detect a capacitance control parameter capable of affecting a clock frequency output (CLK_OUT) by a clock circuit; and
a control unit (<NUM>), connected with the detection circuit, and configured to adjust a capacitance value of a target capacitor (C_trim) in the clock circuit according to the capacitance control parameter detected by the detection circuit, so as to change the clock frequency output by the clock circuit;
wherein the detection circuit further comprises:
a temperature detection circuit (Temperature sense) configured to detect an environmental temperature of an environment where the clock circuit is located and take the environmental temperature as the capacitance control parameter;
the control unit (<NUM>) further comprises:
a second conversion module, configured to convert an analog signal corresponding to the environmental temperature detected by the temperature detection circuit into a second digital signal;
a second transmission module, configured to input the second digital signal to the control end of the target capacitor; and
a second control module, configured to adjust the capacitance value of the target capacitor according to the second digital signal, so as to change the clock frequency output by the clock circuit.
wherein a mapping relationship between an environmental temperature and a voltage value is established, the second conversion module, configured to convert the analog signal corresponding to the voltage value that corresponds to the environmental temperature detected by the temperature detection circuit into the second digital signal;
characterized in that:
the second control module comprises:
a first comparison sub-module, configured to compare a value of the detected environmental temperature with a value of a preset temperature;
a first adjustment sub-module, configured to decrease, under a condition in which the value of the environmental temperature is smaller than the value of the preset temperature, the capacitance value of the target capacitor to a first target capacitance value according to the second digital signal; and
a second adjustment sub-module, configured to increase, under a condition in which the value of the environmental temperature is greater than the value of the preset temperature, the capacitance value of the target capacitor to a second target capacitance value according to the second digital signal