Clock calibration method and device, storage medium, electronic equipment and chip

By obtaining the ambient temperature of the chip and the power supply voltage of the RC circuit, querying and applying preset RC parameters for clock calibration, the problem of large power consumption and low efficiency of the clock calibration method in the prior art is solved, and efficient and low power consumption clock calibration is achieved.

CN120066201APending Publication Date: 2025-05-30BEIJING X RING TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311629823.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-30
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

The existing chip clock calibration methods have problems of large power consumption and low efficiency, resulting in an increase in chip area or circuit area.

Method used

By obtaining the ambient temperature of the chip and the power supply voltage of the RC circuit, query the corresponding preset RC parameters, and control the RC circuit according to these parameters to achieve clock calibration.

Benefits of technology

Fast and efficient calibration of the chip clock is achieved, power consumption is reduced, and no need to increase the chip or circuit area is required.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120066201A_ABST
    Figure CN120066201A_ABST
Patent Text Reader

Abstract

The invention discloses a clock calibration method and device, a storage medium, electronic equipment and a chip, and relates to the technical field of chips, the method comprises the steps that first parameter information corresponding to the chip is acquired, and the first parameter information comprises the environment temperature of the chip in the current acquisition period; the power supply voltage of an RC circuit in the chip in the current acquisition period is acquired; querying a recommended first preset RC parameter corresponding to the first parameter information; and then controlling the RC circuit according to the first preset RC parameter so as to calibrate an RC clock of the chip. According to the invention, the first parameter information of the chip and the first preset RC parameter corresponding to the first parameter information can be acquired based on the acquisition period, and then the RC circuit is controlled according to the first preset RC parameter, so that the clock calibration of the chip is realized, the calibration efficiency of the RC clock is improved, the chip area or an additional circuit does not need to be increased, and the power consumption is effectively reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of chip technology, and particularly to a clock calibration method, device, storage medium, electronic device, and chip. Background Art

[0002] For long-term used electronic devices, a stable time chain is required to ensure the precise integrity of operation data, which helps to perform functions such as network synchronization, logging, and data backup.

[0003] Currently, the clock calibration method of chips can use a hardware calibration method, which is calibrated through an additional clock control circuit. However, this method will increase the chip area or circuit area, and there are technical problems such as high power consumption and low efficiency. Summary of the Invention

[0004] In view of this, this application provides a clock calibration method, device, storage medium, electronic device, and chip, mainly aiming to improve the technical problems that the current clock calibration method will increase the chip area or circuit area, and has high power consumption and low efficiency.

[0005] In a first aspect, this application provides a clock calibration method, including:

[0006] Obtain first parameter information corresponding to the chip, where the first parameter information includes the ambient temperature of the chip in the current acquisition period, and the supply voltage of the RC circuit in the chip in the current acquisition period;

[0007] Query a first preset RC parameter recommended corresponding to the first parameter information;

[0008] Control the RC circuit according to the first preset RC parameter to calibrate the RC clock of the chip.

[0009] Optionally, before controlling the RC circuit according to the first preset RC parameter, the method further includes:

[0010] Judge whether the current RC parameter corresponding to the RC circuit is the same as the preset RC parameter;

[0011] The controlling the RC circuit according to the first preset RC parameter to calibrate the RC clock of the chip includes:

[0012] If the current RC parameter is different from the first preset RC parameter, then control the RC circuit according to the first preset RC parameter to calibrate the RC clock of the chip.

[0013] Optionally, a timer is set for collecting the first parameter information; before controlling the RC circuit according to the first preset RC parameter to calibrate the RC clock of the chip, the method further includes:

[0014] Determine whether the timer has timed out;

[0015] Controlling the RC circuit according to the first preset RC parameter to calibrate the RC clock of the chip includes:

[0016] If the timer has not timed out, control the RC circuit according to the first preset RC parameter to calibrate the RC clock of the chip.

[0017] Optionally, after determining whether the timer has timed out, the method further includes:

[0018] If the timer has timed out, obtain the second parameter information corresponding to the chip, where the second parameter information includes the latest ambient temperature of the chip and the latest supply voltage of the RC circuit in the chip;

[0019] Query the recommended second preset RC parameter corresponding to the second parameter information;

[0020] Control the RC circuit according to the second preset RC parameter to calibrate the RC clock of the chip.

[0021] Optionally, controlling the RC circuit according to the first preset RC parameter to calibrate the RC clock of the chip includes:

[0022] Control the RC circuit according to the R value in the first preset RC parameter to obtain the first output frequency of the RC circuit;

[0023] Compare the first output frequency with the target frequency to which the RC clock needs to be calibrated;

[0024] If the first output frequency is the same as the target frequency, it is determined that the calibration of the RC clock is completed.

[0025] Optionally, the method further includes: if the first output frequency is less than the target frequency, adjust the R value downward according to the current calibration polarity and step value, and control the RC circuit with the reduced R value so that the frequency output by the RC circuit tends to the target frequency.

[0026] Optionally, the method further includes: if the first output frequency is greater than the target frequency, adjusting the R value upward according to the current calibration polarity and the step value, and controlling the RC circuit with the increased R value so that the frequency output by the RC circuit tends to the target frequency.

[0027] Optionally, the method further includes: if the adjusted R value reaches a preset boundary value, controlling the RC circuit according to the C value in the first preset RC parameter to obtain a second output frequency of the RC circuit;

[0028] Comparing the second output frequency with the target frequency for RC clock calibration;

[0029] If the second output frequency is the same as the target frequency, it is determined that the calibration of the RC clock is completed.

[0030] Optionally, the method further includes: if the second output frequency is less than the target frequency, adjusting the C value downward according to the current calibration polarity and the step value, and controlling the RC circuit with the decreased C value so that the frequency output by the RC circuit tends to the target frequency.

[0031] Optionally, the method further includes: if the second output frequency is greater than the target frequency, adjusting the C value upward according to the current calibration polarity and the step value, and controlling the RC circuit with the increased C value so that the frequency output by the RC circuit tends to the target frequency.

[0032] Optionally, controlling the RC circuit according to the first preset RC parameter to calibrate the RC clock of the chip includes:

[0033] Obtaining a third output frequency output by the RC circuit after calibration according to the third parameter information, where the third parameter information includes the ambient temperature of the chip in the previous acquisition period and the supply voltage of the RC circuit in the chip in the previous acquisition period;

[0034] Obtaining the current output frequency of the RC circuit if it is controlled according to the first preset RC parameter;

[0035] Comparing the current output frequency and the third output frequency with the theoretical upper and lower limits of the target frequency to which the RC clock needs to be calibrated;

[0036] Determining whether to calibrate and roll back according to the comparison result;

[0037] If it is determined to calibrate and roll back, control the RC circuit according to the third preset RC parameter recommended corresponding to the third parameter information;

[0038] If it is determined that the calibration does not roll back, control the RC circuit according to the first preset RC parameter.

[0039] Optionally, determining whether to roll back the calibration according to the comparison result includes:

[0040] In the case where the current output frequency is greater than the theoretical upper limit value of the target frequency and the third output frequency is less than the theoretical lower limit value of the target frequency, subtract the theoretical upper limit value from the current output frequency to obtain a current difference, and subtract the third output frequency from the theoretical lower limit value to obtain a previous difference;

[0041] If the current difference is less than or equal to the previous difference, determine to roll back the calibration;

[0042] If the current difference is greater than the previous difference, determine that the calibration does not roll back.

[0043] Optionally, determining whether to roll back the calibration according to the comparison result includes:

[0044] In the case where the current output frequency is less than the theoretical lower limit value of the target frequency and the third output frequency is greater than the theoretical upper limit value of the target frequency, subtract the theoretical upper limit value from the third output frequency to obtain a previous difference, and subtract the current output frequency from the theoretical lower limit value to obtain a current difference;

[0045] If the current difference is less than or equal to the previous difference, determine to roll back the calibration;

[0046] If the current difference is greater than the previous difference, determine that the calibration does not roll back.

[0047] In a second aspect, the present application provides a clock calibration device, including:

[0048] An acquisition module, configured to acquire first parameter information corresponding to a chip, where the first parameter information includes the ambient temperature of the chip in the current acquisition period and the power supply voltage of the RC circuit in the chip in the current acquisition period;

[0049] A query module, configured to query a first preset RC parameter recommended corresponding to the first parameter information;

[0050] A calibration module, configured to control the RC circuit according to the first preset RC parameter to calibrate the RC clock of the chip.

[0051] In a third aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the clock calibration method described in the first aspect.

[0052] Fourthly, the present application provides an electronic device, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor. When the processor executes the computer program, the clock calibration method described in the first aspect is implemented.

[0053] Fifthly, the present application provides a chip, including one or more interface circuits and one or more processors; the interface circuit is configured to receive a signal from the memory of the electronic device and send the signal to the processor, and the signal includes computer instructions stored in the memory; when the processor executes the computer instructions, the electronic device is caused to execute the clock calibration method described in the first aspect.

[0054] By means of the above technical solutions, the present application provides a clock calibration method, device, storage medium, electronic device and chip. Specifically, first, first parameter information corresponding to the chip is obtained, and the first parameter information includes the ambient temperature of the chip in the current acquisition period and the supply voltage of the RC circuit in the chip in the current acquisition period; then, a first preset RC parameter recommended corresponding to the first parameter information is queried; and then, the RC circuit is controlled according to the first preset RC parameter to calibrate the RC clock of the chip. The present application can obtain the first parameter information of the chip in the current acquisition period, query and obtain the corresponding recommended first preset RC parameter, adjust the RC circuit based on the first preset RC parameter until the target frequency to be calibrated is output, realize real-time monitoring of the chip parameters, and quickly update the RC parameters for calibration, improve the calibration efficiency of the RC clock, without increasing the chip area or additional circuits, and reduce power consumption.

[0055] The above description is only an overview of the technical solutions of the present application. In order to be able to understand the technical means of the present application more clearly, it can be implemented according to the content of the specification. And in order to make the above and other purposes, features and advantages of the present application more obvious and understandable, the specific embodiments of the present application are specifically given below. Description of the Drawings

[0056] The drawings here are incorporated into the specification and constitute a part of this specification, showing embodiments consistent with the present application and used together with the specification to explain the principles of the present application.

[0057] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0058] Figure 1 A flowchart showing a clock calibration method provided by an embodiment of the present application is shown;

[0059] Figure 2 shows a schematic flowchart of a clock calibration method provided by an embodiment of the present application;

[0060] Figure 3 shows a flowchart of an example provided by an embodiment of the present application;

[0061] Figure 4 shows a flowchart of an example provided by an embodiment of the present application;

[0062] Figure 5 shows a flowchart of an example provided by an embodiment of the present application;

[0063] Figure 6 shows a flowchart of an example provided by an embodiment of the present application;

[0064] Figure 7 shows a flowchart of an example provided by an embodiment of the present application;

[0065] Figure 8 shows a flowchart of an example provided by an embodiment of the present application;

[0066] Figure 9 shows a schematic structural diagram of a clock calibration device provided by an embodiment of the present application. Detailed implementation manners

[0067] The embodiments of the present application will be described in more detail below with reference to the accompanying drawings. It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments may be combined with each other.

[0068] In order to improve the technical problems that the current clock calibration method will increase the chip area or the circuit area, and has large power consumption and low efficiency. This embodiment provides a clock calibration method, as Figure 1 shown, the method includes:

[0069] Step 11, obtain first parameter information corresponding to the chip, where the first parameter information includes the ambient temperature of the chip in the current acquisition period and the supply voltage of the RC circuit in the chip in the current acquisition period.

[0070] The execution entity for this embodiment can be a device or equipment for clock calibration, which can be configured on the terminal side, such as an electronic device or a chip, etc. First, a timer can be used to set the parameter information acquisition period to facilitate real-time monitoring of chip parameters, and then the first parameter information of the chip within the current acquisition period can be obtained. The first parameter information may include, but is not limited to, the ambient temperature of the chip within the current period, and the supply voltage of the resistance capacitance circuits (RC circuits) in the chip within the current acquisition period.

[0071] Step 12: Query the first preset RC parameter recommended corresponding to the first parameter information.

[0072] In this embodiment, the mapping relationship between the temperature and voltage of the chip and the RC parameters in the RC circuit can be obtained in advance, and then by querying the mapping relationship, the first preset RC parameter recommended corresponding to the first parameter information within the current acquisition period can be obtained, providing the recommended RC parameter that can output the target frequency, which helps to improve the calibration efficiency, reduce the calibration time, and lower the chip power consumption. Correspondingly, the first preset RC parameter can be the RC parameter corresponding to the first parameter information obtained by querying based on the mapping relationship; the mapping relationship is used to obtain the RC parameters that can output the target frequency under different temperature and voltage combinations of the chip.

[0073] Step 13: Control the RC circuit according to the first preset RC parameter to calibrate the RC clock of the chip.

[0074] In this embodiment, the RC circuit is controlled according to the first preset RC parameter, the current RC parameter is updated to the first preset RC parameter, the RC clock of the chip is calibrated, the first output frequency is obtained, and it is judged whether the first output frequency is the same as the target frequency to which the RC clock needs to be calibrated. If they are the same, the RC clock calibration is completed. In this way, fast calibration can be achieved without increasing the chip area or calibration circuit, effectively reducing the power consumption.

[0075] This embodiment first obtains the first parameter information corresponding to the chip. The first parameter information includes the ambient temperature of the chip within the current acquisition period, and the supply voltage of the RC circuit in the chip within the current acquisition period; then queries the first preset RC parameter recommended corresponding to the first parameter information; and then controls the RC circuit according to the first preset RC parameter to calibrate the RC clock of the chip. This embodiment can obtain the first parameter information of the chip and its corresponding first preset RC parameter based on the acquisition period, and then control the RC circuit according to the first preset RC parameter to achieve the clock calibration of the chip, improve the calibration efficiency of the RC clock, and without increasing the chip area or additional circuit, effectively reducing the power consumption.

[0076] Based on the technical implementation content shown in the above embodiments, to further illustrate the specific implementation process of the method in this embodiment, this embodiment provides a specific method as shown in Figure 2 below. The method includes:

[0077] Step 21: Obtain the first parameter information corresponding to the chip. The first parameter information includes the ambient temperature of the chip during the current acquisition period and the supply voltage of the RC circuit in the chip during the current acquisition period.

[0078] Exemplarily, Figure 3 shows an application scenario. When the user normally uses the terminal device to move between scenarios, when the terminal device moves from an outdoor low-temperature scenario of -20°C to an indoor scenario of 26°C, clock calibration needs to be performed in a timely manner, which can be divided into two cases: (1) When the device is powered off outdoors and then moved indoors and powered on indoors; (2) The device remains powered on and is moved indoors.

[0079] In a specific application scenario, as shown in Figure 4 below, the clock calibration system can include three parts: a temperature sensor, calibration software, and an RC circuit. The calibration software and the RC circuit are located inside the chip, and the temperature sensor is located outside the chip. Among them, the temperature sensor is responsible for collecting the current ambient temperature of the terminal device, can receive the read temperature control instruction sent by the calibration software, and feedback the temperature data to the calibration software. In addition, the temperature sensor can be reused with other application software; the calibration software inside the chip is responsible for processing the temperature data, selecting the preset RC parameters, and through the write data operation, configuring the parameters into the chip. At the same time, through the read data operation, it can access the status of the RC circuit inside the chip in real time; the RC circuit inside the chip is responsible for providing the clock calibration function, supporting three modes: hardware cycle calibration, hardware trigger calibration, and software calibration, and supporting the calibration software to switch the calibration mode at any time, as well as starting and stopping the calibration function. At the same time, the calibration software can configure the calibration forward and reverse polarities and configure the R / C step length.

[0080] Step 22: Query the first preset RC parameter recommended corresponding to the first parameter information.

[0081] For this embodiment, first, it is necessary to obtain the RC parameters that can output the target frequency under different temperature and voltage conditions of the chip as recommended values, which is convenient for subsequent clock calibration and improves the calibration efficiency. Exemplarily, the calibration process based on the mapping relationship is as shown in Figure 5 below. The specific steps are as follows:

[0082] Step 000: The process starts. After placing the chip in an adjustable high and low temperature chamber and connecting an adjustable voltage device, enter step 001;

[0083] Step 001: Use the calibration software to switch the RC circuit to the software calibration mode. After adjusting the temperature and voltage to change respectively in fixed step values, traverse all the frequency points (frequencies) corresponding to the RC parameters and save them, then enter Step 002;

[0084] Step 002: Screen all the saved frequency points, find out the combinations of RC parameters and temperature / voltage corresponding to all the target frequency points, and enter Step 003;

[0085] Step 003: Import the combinations of RC parameters, temperature and voltage into the calibration software, and enter Step 004;

[0086] Step 004: The calibration software controls the RC circuit to perform calibration, and finally ends the process.

[0087] Step 23: Control the RC circuit according to the R value in the first preset RC parameter to obtain the first output frequency of the RC circuit.

[0088] Optionally, before Step 23, it further includes: judging whether the current RC parameter corresponding to the RC circuit is the same as the preset RC parameter; if the current RC parameter is different from the first preset RC parameter, then control the RC circuit according to the first preset RC parameter to calibrate the RC clock of the chip.

[0089] For this embodiment, before adjusting the RC circuit parameters, it can first be judged whether the current RC parameter is equal to the recommended preset RC parameter. If the two are the same, there is no need to adjust the parameters. If the two are different, then control the RC circuit according to the first preset RC parameter to calibrate the RC clock of the chip, avoiding repeated calibration and effectively reducing power consumption.

[0090] Optionally, before Step 23, it further includes: judging whether the timer has timed out; if the timer has not timed out, then control the RC circuit according to the first preset RC parameter to calibrate the RC clock of the chip; if the timer has timed out, then obtain the second parameter information corresponding to the chip, where the second parameter information includes the latest ambient temperature of the chip and the latest supply voltage of the RC circuit in the chip; query the recommended second preset RC parameter corresponding to the second parameter information; control the RC circuit according to the second preset RC parameter to calibrate the RC clock of the chip.

[0091] For this embodiment, the acquisition period of the chip parameters can be set by using a timer. If the timer has timed out, that is, a collection period is reached, the chip data can be collected again to obtain the current RC parameters, the second parameter information, and its corresponding second preset RC parameter. Then, it is determined whether the current RC parameter is equal to the second preset RC parameter. If they are equal, there is no need to adjust the RC parameter. If they are not equal, the RC parameter can be updated to the second preset RC parameter, and then calibrated according to the output frequency. Among them, the second parameter information may include, but is not limited to, the latest ambient temperature of the chip and the latest supply voltage of the RC circuit in the chip; the second preset RC parameter may be the RC parameter corresponding to the second parameter information obtained by querying based on the mapping relationship.

[0092] In this way, the ambient temperature and supply voltage of the chip can be monitored in real time, the RC parameter can be updated quickly, and the real-time performance of calibration can be ensured.

[0093] Exemplarily, as Figure 6 shown, the control flow of the calibration software is shown, and the specific steps are as follows:

[0094] Step 100: The calibration process starts. After the chip is powered on and reset, the calibration software reads the current temperature value and looks up the RC parameter recommended for the corresponding temperature voltage, and enters step 101;

[0095] Step 101: The calibration software reads the current RC parameter in the chip and compares it with the recommended RC parameter. If the current RC parameter is not equal to the recommended value, it enters step 102; otherwise, it enters step 103;

[0096] Step 102: The calibration software switches the RC calibration mode to the software mode. After configuring the RC parameter in the chip to the recommended value, it enables a calibration. After waiting for the calibration to end, it enters step 103;

[0097] Step 103: The calibration software enables the RC for clock calibration according to the configured calibration mode, and enters step 104;

[0098] Step 104: The calibration software determines whether the timer for reading the temperature has timed out. If so, it enters step 105; otherwise, it enters step 108;

[0099] Step 105: After the calibration software reads the temperature, it looks up the recommended RC parameter according to the temperature value, and enters step 106;

[0100] Step 106: The calibration software determines whether the current RC parameter is equal to the recommended value. If so, it enters step 108; otherwise, it enters step 107;

[0101] Step 107: The calibration software pauses the RC calibration, updates the recommended value to the inside of the chip, and then restarts the RC calibration, and enters step 108;

[0102] Step 108: Perform RC calibration and output the frequency, then enter Step 109;

[0103] Step 109: The calibration software determines whether to end the calibration process. If not, enter Step 104 to start the next loop. Otherwise, the software controls the end of the calibration process.

[0104] For this embodiment, during the calibration process, the RC circuit can be controlled according to the R value in the first preset RC parameter first to obtain the first output frequency of the RC circuit, and then the circuit parameters can be further adjusted according to the output result. Among them, the first output frequency can be the clock frequency output by the circuit after adjusting the R value in the RC circuit.

[0105] Step 24: Compare the first output frequency with the target frequency to which the RC clock needs to be calibrated.

[0106] Step 25: If the first output frequency is the same as the target frequency, it is determined that the calibration of the RC clock is completed.

[0107] In a specific application scenario, the R value can be adjusted first, and the first output frequency is compared with the target frequency to which the RC clock needs to be calibrated. If the first output frequency is the same as the target frequency, it can be determined that the calibration of the RC clock is completed. If the first output frequency is not the same as the target frequency, the numerical relationship between the first output frequency and the target frequency can be further determined, and the R value is adjusted accordingly. When adjusting the R value cannot reach the target frequency, the C value is adjusted until the frequency output by the RC circuit approaches the target frequency, and the calibration of the RC clock is completed. As Figure 7 shown, the control flow of the RC parameter is shown, and the specific steps are as follows:

[0108] Step 200: The calibration process starts. The calibration software initializes the chip RC parameters and starts enabling the calibration, then enters Step 201;

[0109] Step 201: Determine whether the calibration is completed. If so, enter Step 202. Otherwise, enter Step 201;

[0110] Step 202: Determine whether the current calibration process is to adjust the R value. If so, enter Step 203. Otherwise, enter Step 212;

[0111] Step 203: Enter the process of calibrating the R value, and determine whether to roll back. If so, enter Step 205. Otherwise, enter Step 206;

[0112] Step 204: Compare the current output frequency with the target frequency, and enter Step 206;

[0113] Step 205: Return the R value to the previous R value, set the current process to the C value calibration process, and go to Step 201;

[0114] Step 206: Judge the comparison result. If it is equal to the target frequency, go to Step 220; otherwise, go to Step 207;

[0115] Step 207: Judge whether the current frequency is less than the target frequency. If so, go to Step 209; otherwise, go to Step 208;

[0116] Step 208: Increase the R value according to the current calibration polarity and the step length, and go to Step 210;

[0117] Step 209: Decrease the R value according to the current calibration polarity and the step length, and go to Step 210;

[0118] Step 210: Judge whether the R value reaches the boundary value. If so, go to Step 211; otherwise, go to Step 201;

[0119] Step 211: Adjust the calibration process to calibrate the C value, and go to Step 211;

[0120] Step 212: Enter the C value calibration process, and judge whether to roll back. If so, go to Step 213; otherwise, go to Step 214;

[0121] Step 213: Roll back the C value, output the current frequency, and go to Step 220;

[0122] Step 214: Compare the current output frequency with the target frequency, and go to Step 215;

[0123] Step 215: Judge the comparison result. If it is equal to the target frequency, go to Step 220; otherwise, go to Step 216;

[0124] Step 216: Judge whether the current frequency is less than the target frequency. If so, go to Step 218; otherwise, go to Step 217;

[0125] Step 217: Increase the R value according to the current calibration polarity and the step length, and go to Step 219;

[0126] Step 218: Decrease the R value according to the current calibration polarity and the step length, and go to Step 219;

[0127] Step 219: Judge whether the C value reaches the boundary. If so, go to Step 220; otherwise, go to Step 201;

[0128] Step 220: Save the current RC parameters, output the frequency, and the process ends.

[0129] Optionally, if the first output frequency is less than the target frequency, the value of R is adjusted downward according to the current calibration polarity and step value, and the RC circuit is controlled using the decreased value of R, so that the frequency output by the RC circuit tends to the target frequency; if the first output frequency is greater than the target frequency, the value of R is adjusted upward according to the current calibration polarity and step value, and the RC circuit is controlled using the increased value of R, so that the frequency output by the RC circuit tends to the target frequency.

[0130] Optionally, if the adjusted value of R reaches the preset boundary value, the RC circuit is controlled according to the value of C in the first preset RC parameter to obtain the second output frequency of the RC circuit; the second output frequency is compared with the target frequency for RC clock calibration; if the second output frequency is the same as the target frequency, it is determined that the calibration of the RC clock is completed.

[0131] Optionally, if the second output frequency is less than the target frequency, the value of C is adjusted downward according to the current calibration polarity and step value, and the RC circuit is controlled using the decreased value of C, so that the frequency output by the RC circuit tends to the target frequency; if the second output frequency is greater than the target frequency, the value of C is adjusted upward according to the current calibration polarity and step value, and the RC circuit is controlled using the increased value of C, so that the frequency output by the RC circuit tends to the target frequency.

[0132] Wherein, the second output frequency may be the clock frequency output by adjusting the value of C after the value of R in the RC circuit reaches the preset boundary value. In this way, the RC value can be adjusted accordingly according to the current calibration polarity and step value, improving the calibration accuracy.

[0133] Further optionally, the RC circuit is controlled according to the first preset RC parameter to calibrate the RC clock of the chip, which may specifically include: obtaining the third output frequency output by the RC circuit calibrated according to the third parameter information, where the third parameter information includes the ambient temperature of the chip in the previous acquisition cycle and the supply voltage of the RC circuit in the chip in the previous acquisition cycle; obtaining the current output frequency of the RC circuit if it is controlled according to the first preset RC parameter; comparing the current output frequency and the third output frequency with the theoretical upper and lower limits of the target frequency to which the RC clock needs to be calibrated; determining whether to calibrate and roll back according to the comparison result; if it is determined to calibrate and roll back, the RC circuit is controlled according to the third preset RC parameter recommended corresponding to the third parameter information; if it is determined not to calibrate and roll back, the RC circuit is controlled according to the first preset RC parameter.

[0134] For this embodiment, when controlling the RC circuit according to the first preset RC parameters and the first output frequency is not equal to the target frequency, the third parameter information and its corresponding third preset RC parameters in the previous acquisition period can be obtained, and the third output frequency can be obtained. The differences between the first output frequency, the third output frequency and the target frequency are calculated respectively and compared. If the first output frequency is closer to the target frequency, there is no need to perform a rollback, and the RC circuit is controlled according to the first preset RC parameters. If the third output frequency is closer to the target frequency, a rollback is required, and the RC circuit is controlled according to the third preset RC parameters. Among them, the third parameter information may include, but is not limited to, the ambient temperature of the chip in the previous acquisition period, and the supply voltage of the RC circuit in the chip in the previous acquisition period; the third preset RC parameters may be the RC parameters corresponding to the third parameter information obtained by querying based on the mapping relationship; the calculation method of the theoretical upper and lower limit values of the target frequency is as follows:

[0135]

[0136] down_limit = up_limit*(1 - offset)

[0137] In the formula, up_limit is the theoretical upper limit frequency of the target frequency, down_limit is the theoretical lower limit frequency of the target frequency, f is the target frequency, l is the calibration length, b is the basic clock, and offset is the frequency deviation value, and the value range is [0, 1].

[0138] Optionally, when the current output frequency is greater than the theoretical upper limit value of the target frequency and the third output frequency is less than the theoretical lower limit value of the target frequency, the current difference is obtained by subtracting the theoretical upper limit value from the current output frequency, and the previous difference is obtained by subtracting the third output frequency from the theoretical lower limit value; if the current difference is less than or equal to the previous difference, it is determined that a calibration rollback is required; if the current difference is greater than the previous difference, it is determined that no calibration rollback is required.

[0139] Optionally, when the current output frequency is less than the theoretical lower limit value of the target frequency and the third output frequency is greater than the theoretical upper limit value of the target frequency, the previous difference is obtained by subtracting the theoretical upper limit value from the third output frequency, and the current difference is obtained by subtracting the current output frequency from the theoretical lower limit value; if the current difference is less than or equal to the previous difference, it is determined that a calibration rollback is required; if the current difference is greater than the previous difference, it is determined that no calibration rollback is required.

[0140] In this way, when multiple output frequencies are not equal to the target frequency, the RC parameters closer to the target frequency can be selected, and the rollback function is added to avoid over-calibration, effectively reducing costs. As Figure 8 shown, the rollback process during calibration is shown, and the specific steps are as follows:

[0141] Step 300: The rollback judgment process starts. Obtain the last calibration result and the RC parameters, and enter Step 301;

[0142] Step 301: Calculate the theoretical upper and lower limits of the calibration target frequency according to the formula, and enter Step 302;

[0143] Step 302: Determine whether the current calibration frequency is greater than the theoretical upper limit frequency and the last calibration frequency is less than the theoretical lower limit frequency. If so, enter Step 304; otherwise, enter Step 303;

[0144] Step 303: Determine whether the current calibration frequency is greater than the theoretical upper limit frequency and the last calibration frequency is less than the theoretical lower limit frequency. If so, enter Step 305; otherwise, enter Step 307;

[0145] Step 304: Calculate the current difference as the current calibration frequency minus the theoretical upper limit frequency, and the last difference as the theoretical lower limit frequency minus the last frequency, and enter Step 306;

[0146] Step 305: Calculate the current difference as the theoretical lower limit frequency minus the current frequency, and the last difference as the last calibration frequency minus the theoretical upper limit frequency, and enter Step 306;

[0147] Step 306: Determine whether the current frequency is less than the last difference. If so, enter Step 308; otherwise, enter Step 307;

[0148] Step 307: Return that the current RC parameters do not need to be rolled back, and enter Step 309;

[0149] Step 308: Return that the current RC parameters need to be rolled back, and enter Step 309;

[0150] Step 309: The rollback judgment process ends.

[0151] Compared with the current existing technologies, this embodiment can monitor the ambient temperature and supply voltage of the chip in real time, quickly update the RC parameters, ensure the real-time performance of calibration, improve the calibration efficiency, and add a rollback function to avoid over-calibration, effectively reducing the cost.

[0152] Further, as Figures 1 to 2 a specific implementation of the method shown, this embodiment provides a clock calibration device, as Figure 9 shown. The device includes: an acquisition module 31, a query module 32, and a calibration module 33.

[0153] The acquisition module 31 is configured to acquire the first parameter information corresponding to the chip. The first parameter information includes the ambient temperature of the chip in the current acquisition cycle and the supply voltage of the RC circuit in the chip in the current acquisition cycle;

[0154] A query module 32, configured to query a first preset RC parameter recommended corresponding to the first parameter information;

[0155] A calibration module 33, configured to control an RC circuit according to the first preset RC parameter to calibrate the RC clock of the chip.

[0156] In some examples of this embodiment, the calibration module 33 is specifically further configured to determine whether the current RC parameter corresponding to the RC circuit is the same as the preset RC parameter; if the current RC parameter is different from the first preset RC parameter, then control the RC circuit according to the first preset RC parameter to calibrate the RC clock of the chip.

[0157] In some examples of this embodiment, the calibration module 33 is provided with a timer for collecting the first parameter information; specifically configured to determine whether the timer times out; if the timer does not time out, then control the RC circuit according to the first preset RC parameter to calibrate the RC clock of the chip.

[0158] In some examples of this embodiment, the calibration module 33 is specifically further configured to: if the timer has timed out, then obtain second parameter information corresponding to the chip, where the second parameter information includes the latest ambient temperature of the chip and the latest supply voltage of the RC circuit in the chip; query a second preset RC parameter recommended corresponding to the second parameter information; control the RC circuit according to the second preset RC parameter to calibrate the RC clock of the chip.

[0159] In some examples of this embodiment, the calibration module 33 is specifically configured to control the RC circuit according to the R value in the first preset RC parameter to obtain a first output frequency of the RC circuit; compare the first output frequency with the target frequency to which the RC clock needs to be calibrated; if the first output frequency is the same as the target frequency, then determine that the calibration of the RC clock is completed.

[0160] In some examples of this embodiment, the calibration module 33 is specifically further configured to: if the first output frequency is less than the target frequency, then perform a reduction adjustment on the R value according to the current calibration polarity and step value, and control the RC circuit with the reduced R value to make the frequency output by the RC circuit tend to the target frequency.

[0161] In some examples of this embodiment, the calibration module 33 is specifically further configured to: if the first output frequency is greater than the target frequency, then perform an increase adjustment on the R value according to the current calibration polarity and step value, and control the RC circuit with the increased R value to make the frequency output by the RC circuit tend to the target frequency.

[0162] In some examples of this embodiment, the calibration module 33 is further specifically configured to: if the adjusted R value reaches a preset boundary value, control the RC circuit according to the C value in the first preset RC parameter to obtain the second output frequency of the RC circuit; compare the second output frequency with the target frequency for RC clock calibration; if the second output frequency is the same as the target frequency, determine that the calibration of the RC clock is completed.

[0163] In some examples of this embodiment, the calibration module 33 is further specifically configured to: if the second output frequency is less than the target frequency, perform a reduction adjustment on the C value according to the current calibration polarity and step value, and control the RC circuit with the reduced C value, so that the frequency output by the RC circuit tends to the target frequency.

[0164] In some examples of this embodiment, the calibration module 33 is further specifically configured to: if the second output frequency is greater than the target frequency, perform an increase adjustment on the C value according to the current calibration polarity and step value, and control the RC circuit with the increased C value, so that the frequency output by the RC circuit tends to the target frequency.

[0165] In some examples of this embodiment, the calibration module 33 is specifically configured to: obtain the third output frequency output by the RC circuit after being calibrated according to the third parameter information, where the third parameter information includes the ambient temperature of the chip in the previous acquisition period and the supply voltage of the RC circuit in the chip in the previous acquisition period; obtain the current output frequency of the RC circuit if it is controlled according to the first preset RC parameter; compare the current output frequency and the third output frequency with the theoretical upper and lower limit values of the target frequency to which the RC clock needs to be calibrated; determine whether to perform calibration rollback according to the comparison result; if it is determined to perform calibration rollback, control the RC circuit according to the third preset RC parameter recommended corresponding to the third parameter information; if it is determined not to perform calibration rollback, control the RC circuit according to the first preset RC parameter.

[0166] In some examples of this embodiment, the calibration module 33 is specifically configured to: in the case where the current output frequency is greater than the theoretical upper limit value of the target frequency and the third output frequency is less than the theoretical lower limit value of the target frequency, subtract the theoretical upper limit value from the current output frequency to obtain the current difference, and subtract the third output frequency from the theoretical lower limit value to obtain the previous difference; if the current difference is less than or equal to the previous difference, determine to perform calibration rollback; if the current difference is greater than the previous difference, determine not to perform calibration rollback.

[0167] In some examples of this embodiment, the calibration module 33 is specifically configured to: when the current output frequency is less than the theoretical lower limit value of the target frequency and the third output frequency is greater than the theoretical upper limit value of the target frequency, subtract the theoretical upper limit value from the third output frequency to obtain the previous difference, and subtract the current output frequency from the theoretical lower limit value to obtain the current difference; if the current difference is less than or equal to the previous difference, determine calibration rollback; if the current difference is greater than the previous difference, determine that calibration does not roll back.

[0168] It should be noted that for other corresponding descriptions of each functional unit involved in a clock calibration device provided in this embodiment, reference can be made to Figures 1 to 2 the corresponding description in, which will not be elaborated here.

[0169] Based on the method as described above in Figures 1 to 2 Accordingly, this embodiment further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the method as described above in Figures 1 to 2 is implemented.

[0170] Based on such an understanding, the technical solution of this application can be embodied in the form of a software product, and the software product can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), including several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of various implementation scenarios of this application.

[0171] Based on the method as described above in Figures 1 to 2 and the virtual device embodiment as described above in Figure 9 For the purpose of achieving the above object, this embodiment of the application further provides an electronic device, such as intelligent terminals such as smart phones, smart watches, smart bracelets, tablet computers, drones, and smart robots. The device includes a storage medium and a processor; the storage medium is used to store a computer program; the processor is used to execute the computer program to implement the method as described above in Figures 1 to 2 is implemented.

[0172] Optionally, the above-mentioned physical device may further include a user interface, a network interface, a camera, a radio frequency (RF) circuit, sensors, an audio circuit, a WI-FI module, and so on. The user interface may include a display screen (Display), an input unit such as a keyboard (Keyboard), etc. Optionally, the user interface may further include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), etc.

[0173] Those skilled in the art can understand that the above-mentioned physical device structure provided in this embodiment does not constitute a limitation on the physical device, and it may include more or fewer components, or combine certain components, or have different component arrangements.

[0174] The storage medium may further include an operating system and a network communication module. The operating system is a program for managing the hardware and software resources of the above-mentioned physical device, and supports the operation of information processing programs and other software and / or programs. The network communication module is used to implement communication between components inside the storage medium, as well as communication with other hardware and software in the information processing physical device.

[0175] Based on the method as Figures 1 to 2 shown above, and Figure 9 the virtual device embodiment as Figures 1 to 2 shown above, this embodiment further provides a chip, including one or more interface circuits and one or more processors; the interface circuit is used to receive a signal from the memory of the electronic device and send the signal to the processor, and the signal includes computer instructions stored in the memory; when the processor executes the computer instructions, the electronic device is caused to execute the method as

[0176] Through the description of the above embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus a necessary general hardware platform, or can also be implemented by hardware. By applying the solution of this embodiment, compared with the current existing technologies, this embodiment can obtain the first parameter information of the chip and its corresponding first preset RC parameter based on the acquisition period, and then control the RC circuit according to the first preset RC parameter to achieve clock calibration of the chip, improve the calibration efficiency of the RC clock, and do not require an increase in chip area or additional circuits, effectively reducing power consumption.

[0177] It should be noted that in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article or device including the element.

[0178] The above are only specific embodiments of the present application, enabling those skilled in the art to understand or implement the present application. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to these embodiments described herein, but rather will be accorded the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A clock calibration method, characterized in that, it includes: obtaining first parameter information corresponding to a chip, where the first parameter information includes the ambient temperature of the chip in the current acquisition period and the supply voltage of the RC circuit in the chip in the current acquisition period; querying a first preset RC parameter recommended corresponding to the first parameter information; controlling the RC circuit according to the first preset RC parameter to calibrate the RC clock of the chip.

2. The method according to claim 1, characterized in that, before controlling the RC circuit according to the first preset RC parameter, the method further includes: judging whether the current RC parameter corresponding to the RC circuit is the same as the preset RC parameter; controlling the RC circuit according to the first preset RC parameter to calibrate the RC clock of the chip, including: if the current RC parameter is different from the first preset RC parameter, controlling the RC circuit according to the first preset RC parameter to calibrate the RC clock of the chip.

3. The method according to claim 1, characterized in that, a timer is set for collecting the first parameter information; before controlling the RC circuit according to the first preset RC parameter to calibrate the RC clock of the chip, the method further includes: judging whether the timer times out; controlling the RC circuit according to the first preset RC parameter to calibrate the RC clock of the chip, including: if the timer does not time out, controlling the RC circuit according to the first preset RC parameter to calibrate the RC clock of the chip.

4. The method according to claim 3, characterized in that, after judging whether the timer times out, the method further includes: if the timer has timed out, obtaining second parameter information corresponding to the chip, where the second parameter information includes the latest ambient temperature of the chip and the latest supply voltage of the RC circuit in the chip; querying a second preset RC parameter recommended corresponding to the second parameter information; controlling the RC circuit according to the second preset RC parameter to calibrate the RC clock of the chip.

5. The method according to claim 2 or 3, characterized in that, controlling the RC circuit according to the first preset RC parameter to calibrate the RC clock of the chip, including: controlling the RC circuit according to the R value in the first preset RC parameter to obtain a first output frequency of the RC circuit; comparing the first output frequency with a target frequency to which the RC clock needs to be calibrated; if the first output frequency is the same as the target frequency, determining that the calibration of the RC clock is completed.

6. The method according to claim 5, characterized in that, the method further includes: if the first output frequency is less than the target frequency, reducing and adjusting the R value according to the current calibration polarity and step value, and controlling the RC circuit with the reduced R value so that the frequency output by the RC circuit tends to the target frequency.

7. The method according to claim 5, wherein, the method further comprises: if the first output frequency is greater than the target frequency, adjusting the R value to increase according to the current calibration polarity and step value, and controlling the RC circuit with the increased R value, so that the frequency output by the RC circuit tends to the target frequency.

8. The method according to claim 6 or 7, wherein, the method further comprises: if the adjusted R value reaches the preset boundary value, controlling the RC circuit according to the C value in the first preset RC parameter to obtain the second output frequency of the RC circuit; comparing the second output frequency with the target frequency for RC clock calibration; if the second output frequency is the same as the target frequency, determining that the calibration of the RC clock is completed.

9. The method according to claim 8, wherein, the method further comprises: if the second output frequency is less than the target frequency, adjusting the C value to decrease according to the current calibration polarity and step value, and controlling the RC circuit with the decreased C value, so that the frequency output by the RC circuit tends to the target frequency.

10. The method according to claim 8, wherein, the method further comprises: if the second output frequency is greater than the target frequency, adjusting the C value to increase according to the current calibration polarity and step value, and controlling the RC circuit with the increased C value, so that the frequency output by the RC circuit tends to the target frequency.

11. The method according to claim 2 or 3, wherein, controlling the RC circuit according to the first preset RC parameter to calibrate the RC clock of the chip includes: obtaining a third output frequency output by the RC circuit calibrated according to third parameter information, where the third parameter information includes the ambient temperature of the chip in the previous acquisition period and the supply voltage of the RC circuit in the chip in the previous acquisition period; obtaining the current output frequency of the RC circuit if it is controlled according to the first preset RC parameter; comparing the current output frequency and the third output frequency with the theoretical upper and lower limit values of the target frequency to which the RC clock needs to be calibrated; determining whether to calibrate and roll back according to the comparison result; if it is determined to calibrate and roll back, controlling the RC circuit according to the third preset RC parameter recommended corresponding to the third parameter information; if it is determined not to calibrate and roll back, controlling the RC circuit according to the first preset RC parameter.

12. The method according to claim 11, wherein, determining whether to calibrate and roll back according to the comparison result includes: in the case where the current output frequency is greater than the theoretical upper limit value of the target frequency and the third output frequency is less than the theoretical lower limit value of the target frequency, subtracting the theoretical upper limit value from the current output frequency to obtain a current difference, and subtracting the third output frequency from the theoretical lower limit value to obtain a previous difference; if the current difference is less than or equal to the previous difference, determining to calibrate and roll back; If the current difference is greater than the previous difference, it is determined that the calibration does not roll back.

13. The method according to claim 11, wherein, determining whether to roll back the calibration according to the comparison result includes: when the current output frequency is less than the theoretical lower limit value of the target frequency and the third output frequency is greater than the theoretical upper limit value of the target frequency, subtracting the theoretical upper limit value from the third output frequency to obtain the previous difference, and subtracting the current output frequency from the theoretical lower limit value to obtain the current difference; if the current difference is less than or equal to the previous difference, it is determined to roll back the calibration; if the current difference is greater than the previous difference, it is determined that the calibration does not roll back.

14. A clock calibration device, wherein, comprising: an acquisition module configured to acquire first parameter information corresponding to a chip, the first parameter information including the ambient temperature of the chip in the current acquisition period and the supply voltage of the RC circuit in the chip in the current acquisition period; a query module configured to query a first preset RC parameter recommended corresponding to the first parameter information; a calibration module configured to control the RC circuit according to the first preset RC parameter to calibrate the RC clock of the chip.

15. A computer-readable storage medium, on which a computer program is stored, wherein, the computer program, when executed by a processor, implements the method according to any one of claims 1 to 13.

16. An electronic device, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein, when the processor executes the computer program, the method according to any one of claims 1 to 13 is implemented.

17. A chip, wherein, comprising one or more interface circuits and one or more processors; the interface circuit is used to receive a signal from the memory of the electronic device and send the signal to the processor, the signal includes computer instructions stored in the memory; when the processor executes the computer instructions, the electronic device is caused to execute the method according to any one of claims 1 to 13.