Oscillator control method and electronic equipment

By detecting the frequency offset of the output signal when the oscillator is running stably and restarting the oscillator when the offset exceeds the preset value, the problem of the oscillator frequency offset causing the electronic device to not work properly is solved, and the frequency recovery of the oscillator output signal and the stability of the equipment operation are achieved.

CN120074512AActive Publication Date: 2025-05-30HONOR DEVICE CO LTD
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202311553429.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-17
Publication Date
2025-05-30
Estimated Expiration
2043-11-17

AI Technical Summary

Technical Problem

The frequency offset of the oscillator output signal may cause the electronic device to fail to function properly, such as device downtime, uplink signal failure, or failure to access the network.

Method used

When the oscillator is running stably, the frequency offset between the output signal and the preset reference frequency is obtained. If the frequency deviation is greater than or equal to the preset frequency deviation, the control oscillator restarts to restore its normal operation.

Benefits of technology

By restarting the oscillator in time, the frequency deviation of its output signal can be effectively restored to prevent frequency abnormalities from affecting the normal operation of the electronic equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120074512A_ABST
    Figure CN120074512A_ABST
Patent Text Reader

Abstract

The embodiment of the invention is applied to the field of control, and provides an oscillator control method and electronic equipment, and the method comprises the steps: obtaining a first frequency offset under the condition that an oscillator operates stably, the first frequency offset representing the difference between the output frequency of an output signal of the oscillator and a preset reference frequency; and under the condition that the first frequency offset is greater than or equal to a preset frequency offset, controlling the oscillator to restart. Based on the technical method provided by the invention, the abnormity of the output signal of the oscillator can be found in time, and the abnormity is recovered by restarting the oscillator.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of touch control, and more specifically, to an oscillator control method and an electronic device. Background Art

[0002] An oscillator is an energy conversion device used to convert direct current electrical energy into alternating current electrical energy with a certain frequency. That is to say, an oscillator is an electronic component used to generate repetitive electronic signals (usually sine waves or square waves). A crystal oscillator (XO) has the characteristic of highly stable frequency, so it is widely used in various wireless communication terminals.

[0003] Based on the output signal of the oscillator, the electronic device where the oscillator is located can determine a clock signal or a carrier signal when the electronic device communicates wirelessly with other electronic devices. A frequency offset of the oscillator output signal may cause the electronic device to malfunction, such as the electronic device crashing, the uplink signal transmission failing, or being unable to access the network, etc. Summary of the Invention

[0004] This application provides an oscillator control method and an electronic device, which can restart the oscillator in time when the difference between the output frequency of the oscillator output signal and the preset reference frequency is greater than or equal to the preset frequency offset, so as to recover from the abnormality of the oscillator and reduce the impact of the frequency abnormality of the oscillator output signal on the normal operation of the electronic device where the oscillator is located.

[0005] In a first aspect, an oscillator control method is provided, including: when the oscillator is operating stably, obtaining a first frequency offset, where the first frequency offset represents the difference between the output frequency of the oscillator output signal and the preset reference frequency; when the first frequency offset is greater than or equal to the preset frequency offset, controlling the oscillator to restart.

[0006] When the oscillator is operating stably, if the frequency offset between the output frequency of the oscillator output signal and the preset reference frequency is greater than or equal to the preset frequency offset, controlling the oscillator to restart can timely determine that the oscillator output signal is abnormal and recover from the abnormality by restarting the oscillator, thereby avoiding the normal operation of other components in the electronic device that rely on the oscillator output signal from being affected by the oscillator abnormality.

[0007] In a possible implementation, the method further includes: obtaining a status parameter output by the oscillator, where the status parameter is used to indicate whether the oscillator is operating stably; and obtaining a first frequency offset in the case where the oscillator is operating stably, including: obtaining a frequency parameter output by the oscillator in the case where the status parameter indicates that the oscillator is operating stably, and the frequency parameter represents the output frequency in the case where the status parameter indicates that the oscillator is operating stably.

[0008] In the case where the status parameter output by the oscillator indicates that the oscillator is operating stably, the frequency parameter output by the oscillator represents the output frequency of the output signal of the oscillator. In the case where the status parameter output by the oscillator indicates that the oscillator is operating stably, obtaining the frequency parameter output by the oscillator, so that the first frequency offset determined according to the frequency parameter is more accurate.

[0009] In a possible implementation, the method further includes: in the case where the status parameter indicates that the oscillator is not operating stably, after obtaining the status parameter and after a first preset duration, obtaining the status parameter again.

[0010] In the case where the status parameter indicates that the oscillator is not operating stably, after a first preset duration, obtaining the status parameter again, so that after the oscillator starts to operate stably, the frequency parameter output by the oscillator can be obtained in time, the first frequency offset can be calculated, and whether the output signal of the oscillator is abnormal can be determined in time.

[0011] In a possible implementation, the oscillator is located in an electronic device; obtaining the first frequency offset includes: obtaining the first frequency offset after the electronic device is started and after a second preset duration.

[0012] The probability that the output signal of the oscillator is abnormal, that is, the difference between the output frequency of the output signal and the preset reference frequency is greater than or equal to the preset frequency offset, is relatively low. After the electronic device is started and after a second preset duration, obtaining the first frequency offset reduces the impact of the detection of the abnormal output signal of the oscillator on the operation process after the electronic device is started, and improves the user experience.

[0013] In a possible implementation, the first frequency offset is obtained at a first moment, and the first frequency offset represents the difference between the first output frequency of the output signal of the oscillator at the first moment and the preset reference frequency; the method further includes: after the oscillator is restarted and at a second moment when the oscillator is operating stably, obtaining a second frequency offset, where the second frequency offset represents the difference between the second output frequency of the output signal of the oscillator at the second moment and the preset reference frequency; and in the case where the second frequency offset is greater than or equal to the preset frequency offset, controlling the oscillator to restart again.

[0014] If, after restarting, the output signal of the oscillator still stores the situation where the frequency offset exceeds the tolerance, the oscillator can be restarted again to attempt to recover the abnormal situation of the oscillator and increase the possibility of the oscillator returning to normal. When the oscillator returns to normal and operates stably, the difference between the frequency of the output signal and the preset reference frequency is less than the preset deviation.

[0015] In a possible implementation manner, after the restart of the oscillator and at a second moment when the oscillator operates stably, obtaining a second frequency offset includes: after the oscillator is restarted and after a third preset duration, detecting whether the oscillator operates stably; when the oscillator operates stably, obtaining the second frequency offset.

[0016] It takes a period of time for the oscillator to restart until it operates stably. Detecting whether the oscillator operates stably after the oscillator is restarted and after a third preset duration and obtaining the second frequency offset when the oscillator operates stably can reduce the number of detections of whether the oscillator operates stably and reduce power consumption.

[0017] In a possible implementation manner, the oscillator is located in an electronic device. The first frequency offset is obtained at a first moment after the electronic device is started and before any restart. The first frequency offset represents the difference between the first output frequency of the output signal of the oscillator at the first moment and the preset reference frequency; controlling the oscillator to restart includes: when the number of times of successful correction within a fourth preset duration is less than a first preset number threshold, controlling the oscillator to restart. The number of times of successful correction represents the number of times that the second frequency offset is less than the preset frequency offset among multiple restarts of the oscillator within the fourth preset duration. The second frequency offset is obtained after the restart of the oscillator and at a second moment when the oscillator operates stably. The second frequency offset represents the difference between the second output frequency of the output signal of the oscillator at the second moment and the preset reference frequency.

[0018] Before controlling the oscillator to restart, determine whether the number of times of successful correction within a fourth preset duration is less than a first preset number threshold. If so, control the oscillator to restart. Thus, it is possible to avoid damage to the oscillator caused by excessive restarting of the oscillator within a certain period of time. The number of times of successful correction represents the number of restarts in which the difference between the output frequency of the output signal of the restarted oscillator and the preset reference frequency is less than the preset frequency offset.

[0019] In a possible implementation, controlling the oscillator to restart includes: controlling the oscillator to restart when the number of times the oscillator restarts within a fifth preset duration is less than a second preset number threshold.

[0020] Before controlling the oscillator to restart, determine whether the number of times the oscillator restarts within a fifth preset duration is less than a second preset number threshold. If so, control the oscillator to restart. Thus, it is possible to avoid damage to the oscillator caused by excessive restarting of the oscillator within a certain period of time.

[0021] In a possible implementation, the oscillator is a crystal oscillator.

[0022] In a second aspect, an oscillator control device is provided, including units for performing the method of the first aspect. The device may be a terminal device or a chip within the terminal device. The oscillator control device includes units for performing the method of the first aspect described above.

[0023] In a third aspect, an electronic device is provided, including a memory and a processor. The memory is used to store a computer program, and the processor is used to call and run the computer program from the memory, so that the electronic device performs the method of the first aspect.

[0024] In a fourth aspect, a chip is provided, including a processor and a data interface. The processor reads instructions stored on a memory through the data interface to perform the method of the first aspect.

[0025] In a fifth aspect, a computer-readable storage medium is provided. The computer-readable storage medium stores computer program code, and the computer program code is used to implement the method of the first aspect.

[0026] In a sixth aspect, a computer program product is provided. The computer program product includes: computer program code, and the computer program code is used to implement the method of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 is a schematic diagram of a hardware system of a device applicable to the present application;

[0028] Figure 2 is a schematic diagram of a software system of a device applicable to the present application;

[0029] Figure 3 is a schematic flowchart of an oscillator control method provided by an embodiment of the present application;

[0030] Figure 4 is a schematic flowchart of another oscillator control method provided by an embodiment of the present application;

[0031] Figure 5 is a schematic flowchart of another oscillator control method provided by an embodiment of the present application;

[0032] Figure 6 is a schematic structural diagram of an oscillator control device provided by the present application. Detailed implementation manners

[0033] Next, the technical solutions in the embodiments of the present application will be described with reference to the accompanying drawings.

[0034] Figure 1 shows a hardware system of an electronic device applicable to the present application.

[0035] The method provided by the embodiment of the present application can be applied to various network-connected communication electronic devices such as mobile phones, tablet computers, wearable devices, laptop computers, netbooks, personal digital assistants (PDAs), etc. The embodiment of the present application does not impose any restrictions on the specific type of the electronic device.

[0036] Figure 1 shows a schematic structural diagram of the electronic device 100. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0037] It can be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than those illustrated, or combine certain components, or split certain components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0038] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.

[0039] Among them, the controller may be the nerve center and command center of the electronic device 100. The controller may generate operation control signals according to the instruction operation code and timing signals to complete the control of fetching and executing instructions.

[0040] A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory may store the instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can be directly called from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0041] It can be understood that the interface connection relationships between the modules illustrated in the embodiments of the present application are only illustrative and do not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods or a combination of multiple interface connection methods in the above embodiments.

[0042] The wireless communication function of the electronic device 100 may be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor, and baseband processor, etc.

[0043] Antenna 1 and Antenna 2 are used for transmitting and receiving electromagnetic wave signals. Each antenna in the electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization rate of the antennas. For example, Antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0044] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc. applied to the electronic device 100. The mobile communication module 150 can include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves through Antenna 1, and perform processing such as filtering and amplifying on the received electromagnetic waves, and then transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves through Antenna 1 and radiate it out. In some embodiments, at least some functional modules of the mobile communication module 150 can be disposed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 can be disposed in the same device.

[0045] The modulation and demodulation processor can include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. Subsequently, the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After being processed by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, receiver 170B, etc.), or displays an image or video through the display screen 194. In some embodiments, the modulation and demodulation processor can be an independent device. In some other embodiments, the modulation and demodulation processor can be independent of the processor 110 and be disposed in the same device as the mobile communication module 150 or other functional modules.

[0046] The wireless communication module 160 may provide solutions for wireless communications applied to the electronic device 100, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite systems (GNSSs), frequency modulation (FM), near field communication (NFC), infrared (IR), etc. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, performs frequency modulation and filtering processing on the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 may also receive signals to be sent from the processor 110, perform frequency modulation and amplification on them, and convert them into electromagnetic waves through the antenna 2 for radiation.

[0047] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, such that electronic device 100 can communicate with a network and other devices via wireless communication technologies. The wireless communication technologies may include Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time-Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. The GNSS may include Global Positioning System (GPS), Global Navigation Satellite System (GLONASS), BeiDou Navigation Satellite System (BDS), Quasi-Zenith Satellite System (QZSS), and / or Satellite Based Augmentation Systems (SBAS).

[0048] External memory interface 120 may be used to connect to an external memory card, such as a Micro SD card, to implement the storage capacity expansion of electronic device 100. The external memory card communicates with processor 110 via external memory interface 120 to implement the data storage function. For example, files such as music and videos are saved in the external memory card.

[0049] The internal memory 121 can be used to store computer-executable program codes, and the executable program codes include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system, application programs required for at least one function (such as a sound playback function, an image playback function, etc.). The data storage area can store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.). In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0050] The electronic device 100 may further include an oscillator.

[0051] An oscillator is an energy conversion device used to convert DC electrical energy into AC electrical energy with a certain frequency. That is to say, an oscillator is an electronic component used to generate repetitive electronic signals (usually sine waves or square waves). The circuit that makes up the oscillator is called an oscillation circuit.

[0052] A crystal oscillator (XO), also known as a quartz crystal resonator, quartz crystal or crystal, crystal oscillator, etc., has characteristics such as highly stable frequency, small size, and low cost, and is widely used in various electronic devices such as wireless communication devices, electronic clocks, digital meters, and intelligent meters. The oscillator in the electronic device 100 can be a crystal oscillator.

[0053] A crystal oscillator is a resonant device made using the piezoelectric effect of a quartz crystal. If an electric field is applied to the two electrodes of the quartz crystal, the wafer will undergo mechanical deformation; conversely, if mechanical pressure is applied to both sides of the wafer, an electric field will be generated in the corresponding direction of the wafer, and this physical phenomenon is called the piezoelectric effect. The crystal oscillator utilizes the mechanical resonance of the quartz crystal to generate an electrical signal with a very precise frequency.

[0054] The crystal oscillator can be used to generate a clock signal. The modulator is used to modulate the output signal of the crystal oscillator with the low-frequency baseband signal to be transmitted to obtain a medium-high frequency signal. This medium-high frequency signal is the modulated signal. The antenna can convert the amplified modulated signal into electromagnetic waves and radiate them out.

[0055] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservices architecture, or a cloud architecture. In the embodiments of this application, taking the Android system with a layered architecture as an example, the software structure of the electronic device 100 will be exemplarily described.

[0056] Figure 2 It is the software structure block diagram of the electronic device 100 in the embodiments of this application. The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom, namely the application layer, the application framework layer, the system libraries of the Android runtime, and the kernel layer. The application layer may include a series of application packages.

[0057] Such as Figure 2 shown, the application packages may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.

[0058] The application framework layer provides application programming interfaces (APIs) and programming frameworks for the applications in the application layer. The application framework layer includes some predefined functions.

[0059] Such as Figure 2 shown, the application framework layer may include a window manager, a content provider, a view system, a telephone manager, a resource manager, a notification manager, etc.

[0060] The Android runtime includes a core library and a virtual machine. The Android runtime is responsible for the scheduling and management of the Android system. The core library contains two parts: one part is the functional functions that need to be called by the Java language, and the other part is the core library of Android. The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.

[0061] The system library may include multiple functional modules. For example: a surface manager, media libraries, a 3D graphics processing library (e.g., OpenGL ES), a 2D graphics engine (e.g., SGL), etc. The surface manager is used to manage the display subsystem and provides the fusion of 2D and 3D layers for multiple applications. The media library supports the playback and recording of various common audio and video formats, as well as static image files, etc. The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing, etc. The 2D graphics engine is the drawing engine for 2D drawing.

[0062] The kernel layer is the layer between hardware and software. The kernel layer may include driver modules such as a display driver, a camera driver, an audio driver, and a sensor driver, etc.

[0063] In some cases, the frequency of the output signal of the oscillator may deviate, resulting in the abnormal operation of the electronic device, such as the electronic device crashing, the uplink signal transmission failing, or being unable to access the network, etc.

[0064] To solve the above problems, an oscillator control method and an electronic device are provided in an embodiment of the present application.

[0065] The following Figures 3 to 4 will describe in detail the oscillator control method provided in the embodiment of the present application.

[0066] Figure 3 is a schematic flowchart of the oscillator control method provided in the embodiment of the present application. The method may include steps S310 to S320, and the following will describe these steps in detail respectively.

[0067] Step S310, when the oscillator is operating stably, obtain a first frequency deviation, where the first frequency deviation represents the difference between the output frequency of the output signal of the oscillator and a preset reference frequency.

[0068] In some embodiments, the stable operation of the oscillator can be understood as the state of stable oscillation after the oscillator starts up. When the oscillator is oscillating stably, the output frequency of the output signal of the oscillator is stable, that is, this output frequency hardly changes with the passage of time.

[0069] In other embodiments, the oscillator may output a state parameter and a frequency parameter. The state parameter indicates whether the oscillator is operating stably. When the state parameter indicates that the oscillator is operating stably, the frequency parameter represents the output frequency of the output signal of the oscillator. That is to say, the state parameter indicates whether the frequency parameter output by the oscillator can represent the output frequency of the output signal of the oscillator. Therefore, before performing step S310, the state parameter output by the oscillator can be obtained.

[0070] When the state parameter indicates that the oscillator is operating stably, step S310 can be performed. That is, when the acquired state parameter indicates that the oscillator is operating stably, the frequency parameter output by the oscillator can be obtained. Thus, by calculating the difference between the preset reference frequency and the output frequency of the output signal of the oscillator represented by the frequency parameter, the first frequency offset can be obtained.

[0071] When the state parameter indicates that the oscillator is not operating stably, the acquisition of the state parameter can be performed periodically or aperiodically. For example, after acquiring the state parameter and passing the first preset duration, the state parameter can be acquired again.

[0072] If the state parameter acquired again indicates that the oscillator is operating stably, step S310 can be performed; conversely, if the state parameter acquired again indicates that the oscillator is not operating stably, the state parameter can be acquired again until the acquired state parameter indicates that the oscillator is operating stably, or when the duration elapsed since the first acquisition of the state parameter exceeds the sixth preset duration, the acquisition of the state parameter is no longer performed.

[0073] When the state parameter is acquired for the first time and the state parameter acquired for the first time indicates that the oscillator is not operating stably, a timer can be started to record the duration elapsed since the first acquisition of the state parameter. When the duration recorded by the timer exceeds the sixth preset duration, an abnormal indication message can be output and the acquisition of the state parameter is no longer performed.

[0074] When the state parameter of the oscillator is acquired periodically, when the duration elapsed since the first acquisition of the state parameter exceeds the sixth preset duration, the acquisition of the state parameter is no longer performed. It can also be understood that when the total number of acquisitions of the state parameter exceeds the third preset number threshold, the acquisition of the state parameter is no longer performed. The third preset number threshold can be obtained by rounding down the ratio of the sixth preset duration to the period of acquiring the state parameter of the oscillator.

[0075] The oscillator can be a crystal oscillator or other types of oscillators. When the oscillator is a crystal oscillator, the state parameter can also be referred to as the crystal quality index state.

[0076] The first frequency offset can be expressed as the absolute value of the difference between the output frequency of the output signal of the oscillator and the preset reference frequency, or as the ratio of the absolute value to the preset reference frequency.

[0077] Step S320, when the first frequency offset is greater than or equal to the preset frequency offset, control the oscillator to restart.

[0078] The first frequency offset is greater than or equal to a preset frequency offset, which can also be understood as the frequency offset of the oscillator exceeding the tolerance.

[0079] The oscillator may be located in an electronic device. Through steps S310 to S320, when the difference between the signal frequency of the output signal of the oscillator during stable operation and a preset reference frequency is greater than or equal to the preset frequency offset, the oscillator is controlled to restart, so as to avoid the normal operation of other components in the electronic device that rely on the output signal of the oscillator being affected due to the abnormal signal frequency of the oscillator output signal.

[0080] The output signal of the oscillator can be used for the electronic device where the oscillator is located to communicate with other communication devices. Communication has extremely high requirements for the signal frequency. If the difference between the frequency of the output signal of the oscillator and the preset reference frequency is large, it may cause the communication between this electronic device and other communication devices to be interrupted.

[0081] After the electronic device is turned on, it can communicate with other communication devices. Therefore, after the electronic device is turned on, the first frequency offset can be obtained, it can be determined whether the first frequency offset is greater than or equal to the preset frequency offset, and the oscillator is restarted when the first frequency offset is greater than or equal to the preset frequency offset.

[0082] Exemplarily, after the electronic device is started and after a second preset duration, the first frequency offset can be obtained.

[0083] The second preset duration can be greater than or equal to the duration required for the initialization of the electronic device. Thereby avoiding the restart of the oscillator from interfering with the initialization of the electronic device.

[0084] Generally, the first frequency offset of the oscillator in the electronic device is less than the preset frequency offset. That is, the possibility of the oscillator having an abnormal situation where the frequency offset exceeds the tolerance is relatively low. In order to reduce the impact of the detection and control of the oscillator on the normal initialization and network registration-related processes after the electronic device is started, the second preset duration can also be greater than or equal to the sum of the duration required for the initialization of the electronic device and the duration generally required for network registration.

[0085] After the electronic device is initialized, the electronic device can register the network. After registering the network, the electronic device can communicate with other electronic devices or network devices through wireless communication technology with the network.

[0086] During the process of the electronic device registering the network, the amount of information transmitted during communication with other devices is relatively small, and the requirement for the output frequency of the oscillator output signal is relatively low. However, after the electronic device successfully registers the network, the electronic device may need to transmit a large amount of data through the registered network, and the requirement for the output frequency of the oscillator output signal is relatively high.

[0087] That is to say, even when the electronic device successfully registers the network, the difference between the output frequency of the output signal of the oscillator and the preset reference frequency, i.e., the first frequency offset, may still be greater than or equal to the preset frequency offset, affecting the transmission of other data and information by the electronic device through the network after registering the network.

[0088] Therefore, regardless of whether the electronic device successfully registers the network, after the electronic device is started and after a second preset duration, steps S310 to S320 can be performed.

[0089] It should be understood that when the electronic device is in the shutdown state, the oscillator may or may not run. The start of the electronic device can be understood as the power-on of the electronic device.

[0090] Due to the influence of various reasons, the oscillator may deviate greatly from the initial state after running for a period of time. If the oscillator is running whether the electronic device is in the shutdown state or after the electronic device is started, it is very important to detect whether there is an abnormality in the output frequency of the oscillator after the electronic device is started.

[0091] By restarting the oscillator, the oscillator can be restored to the initial state, so that the difference between the frequency of the output signal of the oscillator after restart and the preset reference frequency can be less than the preset frequency offset, realizing the correction of the oscillator, that is, the recovery of the abnormal phenomenon of the frequency offset of the oscillator exceeding the tolerance.

[0092] After the electronic device is started, it is detected whether the output signal of the oscillator has a frequency offset exceeding the tolerance, that is, it is judged whether the difference between the output frequency of the output signal of the oscillator in the case of stable operation and the preset reference frequency, i.e., the first frequency offset, is greater than or equal to the preset frequency offset. When the first frequency offset is greater than or equal to the preset frequency offset, by restarting the oscillator, an attempt is made to restore the frequency offset of the output signal of the oscillator to the preset frequency offset to achieve correction.

[0093] During the operation of the electronic device, it is no longer necessary to detect whether the output signal of the oscillator has a frequency offset exceeding the tolerance, and no longer perform correction.

[0094] After restarting the oscillator in step S320, it can also be detected whether the difference between the output frequency of the output signal of the oscillator and the preset reference frequency is greater than or equal to the preset frequency offset. For the convenience of description, the first frequency offset can be considered to be obtained at the first moment, and the first frequency offset represents the difference between the first output frequency of the output signal of the oscillator at the first moment and the preset reference frequency.

[0095] Before the first moment, the oscillator can be started after a restart or without a restart. That is to say, the first moment can be the moment when the difference between the output frequency of the oscillator and the preset reference frequency is first obtained when the oscillator is stably operating after the electronic device is started.

[0096] After the oscillator is restarted and at the second moment when the oscillator is stably operating, a second frequency offset can be obtained. The second frequency offset represents the difference between the second output frequency of the output signal of the oscillator at the second moment and the preset reference frequency.

[0097] When the second frequency offset is greater than or equal to the preset frequency offset, the oscillator can be controlled to restart again.

[0098] When the second frequency offset is less than the preset frequency offset, it can be determined that the frequency of the output signal of the oscillator meets the requirements, and the correction of the oscillator is achieved.

[0099] After the oscillator is restarted, it is possible to immediately detect whether the oscillator is stably operating. Alternatively, after the oscillator is restarted and after a third preset duration, it is possible to detect whether the oscillator is stably operating.

[0100] Thus, when the oscillator is stably operating, the second frequency offset is obtained. And when it is detected that the oscillator is not stably operating, it is possible to detect again whether the oscillator is stably operating. Exemplarily, the detection of whether the oscillator is stably operating can be performed periodically or aperiodically. That is to say, the interval duration between two adjacent detections of whether the oscillator is stably operating can be equal or unequal.

[0101] It takes a period of time for the crystal oscillator to restart to stable operation. After the oscillator is restarted and after a third preset duration, detecting whether the oscillator is stably operating makes the detection time more reasonable.

[0102] The third preset duration can be set according to the time length generally required for the oscillator to restart.

[0103] Exemplarily, according to the number of successful correction times within a period of time, it can be determined whether to restart the oscillator.

[0104] After each restart of the oscillator, when the oscillator is stably operating, the second output frequency of the output signal of the oscillator can be obtained, and the difference between the second output frequency and the preset reference frequency is calculated to obtain the second frequency offset.

[0105] Correction success means that by restarting the oscillator, the second frequency deviation is made less than the preset frequency deviation. The second frequency deviation represents the difference between the second output frequency and the preset reference frequency. The second output frequency is the frequency of the second output signal at the second moment when the oscillator runs stably after this restart.

[0106] The number of correction successes represents the number of times of successful correction. That is to say, the number of correction successes represents the number of times among multiple restarts of the oscillator within the fourth preset duration that make the second frequency deviation less than the preset frequency deviation. The second frequency deviation is obtained after the restart of the oscillator and at the second moment when the oscillator runs stably. The second frequency deviation represents the difference between the second output frequency of the output signal of the oscillator at the second moment and the preset reference frequency.

[0107] When the first frequency deviation is greater than or equal to the preset frequency deviation, it can be determined whether the number of correction successes within the fourth preset duration is less than the first preset number threshold. That is to say, it can be determined whether all the correction successes with the number of the first preset number threshold occur within the fourth preset duration.

[0108] When the number of correction successes within the fourth preset duration is less than the first preset number threshold, the oscillator can be restarted. When the number of correction successes within the fourth preset duration is greater than or equal to the first preset number threshold, the oscillator can no longer be restarted. Thus, it is avoided that the hardware of the oscillator is damaged due to frequent restarting of the oscillator.

[0109] When the number of correction successes within the fourth preset duration is greater than or equal to the first preset number threshold, an alarm message can also be output to remind the user that the frequency of the output signal of the oscillator is abnormal.

[0110] Exemplarily, according to the number of restarts of the oscillator within a period of time, it can also be determined whether to restart the oscillator.

[0111] When the first frequency deviation is greater than or equal to the preset frequency deviation, it can be determined whether the number of restarts of the oscillator within the fifth preset duration is less than the second preset number threshold. When the number of restarts of the oscillator within the fifth preset duration is less than the second preset number threshold, the oscillator can be controlled to restart. When the number of restarts of the oscillator within the fifth preset duration is greater than or equal to the second preset number threshold, the oscillator can no longer be restarted. Thus, it is avoided that the hardware of the oscillator is damaged due to frequent restarting of the oscillator.

[0112] When the number of restarts of the oscillator within the fifth preset duration is greater than or equal to the second preset number threshold, an alarm message can also be output to remind the user that the frequency of the output signal of the oscillator is abnormal.

[0113] When the first frequency offset is greater than or equal to a preset frequency offset, it is possible to determine whether to restart the oscillator based on the number of times the oscillator restarts in the fifth preset duration and / or the number of times of successful correction in the fourth preset duration.

[0114] The first frequency offset can also represent the difference between the output frequency of the output signal of the oscillator at any moment when the oscillator is stably operating and the preset reference frequency. That is to say, after the electronic device is started, regardless of whether the oscillator has been restarted, when it is determined that the difference between the output frequency of the oscillator and the preset reference frequency is greater than or equal to the preset frequency offset, it is possible to determine whether to restart the oscillator based on the number of times the oscillator restarts and / or the number of times of successful correction within a period of time.

[0115] The oscillator can be set in the electronic device. The first frequency offset can represent the difference between the output frequency of the output signal of the oscillator when the oscillator is stably operating and the preset reference frequency in the case where the oscillator has not been restarted after the electronic device is started. After the electronic device is started and the oscillator has not been restarted, it is possible to determine whether to restart the oscillator based on the number of times the oscillator restarts and / or the number of times of successful correction within a period of time.

[0116] If the first frequency offset obtained after the electronic device is started and the oscillator has not been restarted is greater than or equal to the preset frequency offset, and it is determined to restart the oscillator based on the number of times of successful correction within a period of time, then after the oscillator is restarted, the number of times of successful correction within a period of time will not increase. Therefore, it is not necessary to compare the number of times of successful correction within a period of time with the first preset number threshold, thereby reducing the amount of calculated data and reducing power consumption.

[0117] That is to say, in the case where the number of times of successful correction in the fourth preset duration is less than the first preset number threshold and the oscillator is controlled to restart, the first frequency offset can be obtained at the first moment when the electronic device is started and has not been restarted. The first frequency offset represents the difference between the first output frequency of the output signal of the oscillator at the first moment and the preset reference frequency.

[0118] In the method provided by the embodiments of the present application, when the oscillator is stably operating, if the frequency offset between the output frequency of the output signal of the oscillator and the preset reference frequency is greater than or equal to the preset frequency offset, the oscillator is controlled to restart, so as to timely detect the abnormality of the output signal of the oscillator, and attempt to restart the oscillator to recover the oscillator, thereby avoiding the normal operation of other components in the electronic device that rely on the output signal of the oscillator from being affected due to the abnormality of the oscillator.

[0119] The following combines Figure 4 , taking the oscillator as a crystal oscillator as an example, for Figure 4A control method for the oscillator shown will be described.

[0120] Figure 4 It is a schematic flowchart of an oscillator control method provided by an embodiment of the present application. Figure 4 The oscillator control method shown may include steps S401 to S415 for realizing the correction of the oscillator. These steps will be described in detail below.

[0121] When the electronic device is started, steps S401 and S403 can be performed.

[0122] When the electronic device is in the shutdown state, the crystal oscillator can work to output an output signal, or the crystal oscillator can stop working and no longer output a signal. Below, an example will be given where the crystal oscillator does not work when the electronic device is in the shutdown state and the crystal oscillator is used when the electronic device is powered on and started.

[0123] Step S401: Start the second timer. The second duration T2 recorded by the second timer represents the time length elapsed after the moment when the electronic device is powered on.

[0124] When the second duration T2 is greater than or equal to the second preset duration Tp2, step S402 is performed.

[0125] Exemplarily, after step S401, it can be periodically or aperiodically determined whether the second duration T2 is greater than or equal to the second preset duration Tp2.

[0126] The second preset duration Tp2 can be determined according to the system initialization duration generally required after the electronic device is started. That is to say, the system initialization duration is a statistical value or an empirical value. The second preset duration Tp2 can also be equal to or approximately equal to the system initialization duration, or can be greater than the system initialization duration.

[0127] The second preset duration Tp2 can also be determined according to the network registration duration generally required for the electronic device to register the network. The second preset duration Tp2 can be greater than or equal to the sum of the system initialization duration and the network registration duration.

[0128] Step S402: Obtain the operating state of the crystal oscillator.

[0129] By calling the status interface of the crystal oscillator, the operating status of the crystal oscillator can be obtained. The status interface of the crystal oscillator can output status parameters. The status parameters can represent the operating status of the crystal oscillator. The status parameters of the crystal oscillator can also be referred to as the crystal quality index status. Exemplarily, when the crystal quality index status is 5, the operating status of the crystal oscillator is the first state; when the crystal quality index status is 6 or 8, the operating status of the crystal oscillator is the second state.

[0130] The operating status of the crystal oscillator can be the first state or the second state. Among them, the first state represents the state where the crystal oscillator is not operating stably, and the second state represents the state where the crystal oscillator is operating stably.

[0131] When the crystal oscillator is in the first state, the output frequency of the crystal oscillator may change over time. The first state includes the state where the crystal oscillator starts to oscillate.

[0132] When the crystal oscillator is in the second state, the output frequency of the crystal oscillator is stable, that is, the output frequency of the crystal oscillator remains unchanged or basically unchanged.

[0133] When the operating status of the crystal oscillator is the first state, S403 or S404 can be performed.

[0134] Step S403, determine whether the first acquisition count N3 of obtaining the operating status of the crystal oscillator after the electronic device is powered on is less than or equal to the third preset count threshold Np3.

[0135] When the first acquisition count N3 is less than or equal to the third preset count threshold Np3, S402 can be performed.

[0136] When the first acquisition count N3 is greater than the third preset count threshold Np3, an alarm message can be output, and the rectification process for the crystal oscillator ends this time.

[0137] Step S404, start the first timer. The first duration T1 recorded by the first timer represents the time length elapsed after the moment when the operating status of the crystal oscillator was last obtained.

[0138] When the first duration T1 is greater than or equal to the first preset duration Tp1, step S402 can be performed.

[0139] When the operating status of the crystal oscillator obtained in S402 is the second state, steps S405 and S406 can be performed. Step S405, calculate the frequency deviation ΔF1 of the output signal of the crystal oscillator relative to the preset operating frequency Fp.

[0140] Before step S405, the frequency F1 of the output signal of the crystal oscillator can be obtained. By calling the frequency interface of the crystal oscillator, the frequency of the output signal of the crystal oscillator can be obtained.

[0141] When the operating state of the crystal oscillator is the second state, the frequency interface of the crystal oscillator outputs the frequency of the output signal of the crystal oscillator.

[0142] The frequency deviation ΔF1 can be expressed as the absolute value of the difference between the frequency F1 of the output signal of the crystal oscillator and the preset operating frequency Fp.

[0143] Step S406, determine whether the frequency deviation ΔF1 is greater than or equal to the preset frequency deviation ΔFp.

[0144] When the frequency deviation ΔF1 is less than the preset frequency deviation ΔFp, it can be determined that the crystal oscillator is operating normally, and the current correction process for the crystal oscillator ends.

[0145] When the frequency deviation ΔF1 is greater than or equal to the preset frequency deviation, step S407 can be performed.

[0146] Step S407, determine whether the number of successful correction times N1 for correcting the crystal oscillator within the fourth preset duration Tp4 is greater than the first preset number threshold Np1.

[0147] The number of successful correction times N1 for correcting the crystal oscillator within the fourth preset duration Tp4 can be understood as the number of successful correction times for correcting the crystal oscillator within the fourth preset duration Tp4 before the moment when step S407 is performed.

[0148] When the number of successful correction times N1 is greater than the first preset number threshold Np1, an alarm message can be output, and the current correction process for the crystal oscillator ends.

[0149] When the number of successful correction times N1 for correcting the crystal oscillator is less than or equal to the first preset number threshold Np1, steps S408 to S410 can be performed.

[0150] Step S408, restart the crystal oscillator.

[0151] Step S409, start the third timer. The third duration T3 recorded by the third timer represents the time length elapsed after the moment when the crystal oscillator is restarted.

[0152] Step S410, when the third duration T3 is greater than or equal to the third preset duration Tp3, obtain the operating state of the crystal oscillator.

[0153] By calling the state interface of the crystal oscillator, the operating state of the crystal oscillator can be obtained.

[0154] The third preset duration Tp3 can be determined based on the restart duration generally required for the crystal oscillator to restart until it operates stably. That is to say, the restart duration is a statistical value or an empirical value. The third preset duration Tp3 can be equal to or approximately equal to the restart duration, or slightly greater than or slightly less than the restart duration.

[0155] Generally, the restart duration is less than the sum of the system initialization duration and the network registration duration. Therefore, the third preset duration Tp3 can be less than the first preset duration Tp1.

[0156] When the operating state of the crystal oscillator obtained in step S410 is the first state, S411 or S412 can be performed.

[0157] Step S411: Determine whether the second acquisition count N4 of the operating state of the crystal oscillator obtained after the crystal oscillator restarts is less than or equal to the third preset count threshold Np3.

[0158] When the second acquisition count N4 is less than or equal to the third preset count threshold Np3, S412 can be performed.

[0159] When the second acquisition count N4 is greater than the third preset count threshold Np3, an alarm message can be output, and the correction process for the crystal oscillator ends this time.

[0160] Step S412: Start the first timer. The first duration T1 recorded by the first timer represents the time length elapsed after the moment when the operating state of the crystal oscillator was last acquired.

[0161] When the first duration T1 is greater than or equal to the first preset duration Tp1, step S411 can be performed.

[0162] When the operating state of the crystal oscillator obtained in S410 is the second state, steps S413 and S414 can be performed.

[0163] Step S413: Calculate the frequency deviation ΔF2 of the output signal of the crystal oscillator relative to the preset operating frequency Fp.

[0164] Before step S413, the frequency F2 of the output signal of the crystal oscillator can be obtained. By calling the frequency interface of the crystal oscillator, the frequency F2 of the output signal of the crystal oscillator can be obtained.

[0165] The frequency F1 is obtained before the crystal oscillator restarts and represents the output signal frequency of the crystal oscillator when it operates stably before restarting. The frequency F2 is obtained after the crystal oscillator restarts and represents the output signal frequency of the crystal oscillator when it operates stably after this restart.

[0166] Step S414: Determine whether the frequency offset ΔF2 is greater than or equal to a preset frequency offset ΔFp.

[0167] In the case where the frequency offset ΔF2 is less than the preset frequency offset ΔFp, it can be determined that the crystal oscillator is operating normally. The correction of the crystal oscillator is successful, and step S415 is performed.

[0168] In the case where the frequency offset ΔF2 is greater than or equal to the preset frequency offset, step S408 can be performed.

[0169] Step S415: Record the moment when the correction is successful.

[0170] The moment when the correction is successful can be the moment when the crystal oscillator is restarted for the last time, or the moment when it is determined that the frequency offset ΔF2 is less than the preset frequency offset.

[0171] According to the moment when the correction is successful recorded in step S415, in step S407, the number of successful correction times N1 for correcting the crystal oscillator within the fourth preset duration Tp4 can be determined.

[0172] Through step S407, determine whether the number of successful correction times N1 for correcting the crystal oscillator within the fourth preset duration Tp4 is greater than the first preset number threshold Np1. And in the case where the number of successful correction times N1 is greater than the first preset number threshold Np1, end the current correction process of the crystal oscillator, avoiding frequent restart of the crystal oscillator in the case where the user of the electronic device frequently restarts the mobile phone, and reducing the possibility of damage caused by frequent restart of the crystal oscillator.

[0173] After S416, the current correction process of the crystal oscillator ends.

[0174] It should be understood that in the case where the frequency of the output signal of the crystal oscillator does not meet the frequency offset requirement, the output signal of the crystal oscillator may not be used as the basis for determining the clock, that is, it is not used as the clock signal for the first timer to the third timer, and it is not used as the basis for determining to perform step S415. The electronic device can determine the time length through other means. The specific method for the electronic device to determine the time length is not limited in the embodiments of the present application.

[0175] In the embodiments of the present application, by recording the moment when the correction is successful each time the crystal oscillator is restarted and the correction is successful, and in the case where the number of successful correction times within the fourth preset duration is greater than or equal to the first preset number threshold, the crystal oscillator is no longer restarted, avoiding damage to the crystal oscillator caused by excessive restart times of the crystal oscillator.

[0176] Compared with Figure 4 the oscillator control method shown, inFigure 5 In the oscillator control method shown, after S406, step S507 can be performed.

[0177] Step S507: Determine whether the restart count N2 of the crystal oscillator within the fifth preset duration Tp5 is greater than the second preset count threshold Np2.

[0178] When the restart count N2 within the fifth preset duration Tp5 is greater than the second preset count threshold Np2, an alarm message can be output, and the correction process for the crystal oscillator ends this time. Determine whether to perform step S408.

[0179] When the restart count N2 within the fifth preset duration Tp5 is less than or equal to the second preset count threshold Np2, steps S408 to S410 and step S515 can be performed.

[0180] Step S515: Record the moment when the crystal oscillator is restarted.

[0181] The moment when the crystal oscillator is restarted, that is, the moment when step S408 is performed.

[0182] According to the moment of successful correction recorded in step S515, in step S507, the restart count N2 of the crystal oscillator within the fifth preset duration Tp5 can be determined.

[0183] Step S515 can be performed before or after step S409, or can be performed simultaneously with step S409.

[0184] In Figure 5 In the oscillator control method shown, when it is determined in S414 that the frequency deviation ΔF2 is less than the preset frequency deviation ΔFp, the correction process for the crystal oscillator ends this time. And when it is determined in S414 that the frequency deviation ΔF2 is greater than or equal to the preset frequency deviation ΔFp, step S408 can be performed, or step S507 can also be performed.

[0185] In the embodiments of the present application, by recording the moment when the crystal oscillator is restarted each time the crystal oscillator is restarted, and when the restart count of the crystal oscillator within the fifth preset duration is greater than or equal to the second preset count threshold, the crystal oscillator is no longer restarted, avoiding damage to the crystal oscillator caused by excessive restart times of the crystal oscillator.

[0186] During Figure 5 the process of the oscillator control method shown, Figure 4The steps S415 and S407 shown above. That is, when it is determined in step S406 that the frequency offset ΔF1 is greater than or equal to the preset frequency offset ΔFp, step S408 can be performed to restart the crystal oscillator when the number of restarts N2 within the fifth preset duration Tp5 is less than or equal to the second preset number threshold Np2 and the number of successful correction times N1 for correcting the crystal oscillator within the fourth preset duration Tp4 is greater than the first preset number threshold Np1.

[0187] It should be understood that the above examples are for helping those skilled in the art to understand the embodiments of the present application, rather than limiting the embodiments of the present application to the specific numerical values or specific scenarios illustrated. Those skilled in the art can obviously make various equivalent modifications or changes according to the above examples, and such modifications or changes also fall within the scope of the embodiments of the present application.

[0188] As described above in conjunction with Figures 1 to 5 , the oscillator control method of the embodiments of the present application has been described in detail. Next, the device embodiments of the present application will be described in detail in conjunction with Figure 6 . It should be understood that the oscillator control device in the embodiments of the present application can execute various oscillator control methods of the foregoing embodiments of the present application, that is, the specific working processes of the following various products can refer to the corresponding processes in the foregoing method embodiments.

[0189] Figure 6 is a schematic diagram of the oscillator control device provided by the embodiments of the present application.

[0190] It should be understood that the oscillator control device 600 can execute Figures 3 to 5 the oscillator control method shown above; the oscillator control device 600 includes: an acquisition unit 610 and a control unit 620.

[0191] The acquisition unit 610 is configured to obtain a first frequency offset when the oscillator is operating stably, where the first frequency offset represents the difference between the output frequency of the output signal of the oscillator and the preset reference frequency.

[0192] The control unit 620 is configured to control the oscillator to restart when the first frequency offset is greater than or equal to the preset frequency offset.

[0193] Optionally, the acquisition unit 610 is further configured to obtain a status parameter output by the oscillator, where the status parameter is used to indicate whether the oscillator is operating stably.

[0194] The acquisition unit 610 is further configured to obtain a frequency parameter output by the oscillator when the status parameter indicates that the oscillator is operating stably, and the frequency parameter represents the output frequency when the status parameter indicates that the oscillator is operating stably.

[0195] Optionally, the obtaining unit 610 is further configured to, when the state parameter indicates that the oscillator is not operating stably, obtain the state parameter again after obtaining the state parameter and after a first preset duration.

[0196] Optionally, the oscillator is located in an electronic device.

[0197] The obtaining unit 610 is further configured to obtain the first frequency offset after the electronic device is started and after a second preset duration.

[0198] Optionally, the first frequency offset is obtained at a first moment, and the first frequency offset represents the difference between the first output frequency of the output signal of the oscillator at the first moment and a preset reference frequency.

[0199] The obtaining unit 610 is further configured to obtain a second frequency offset at a second moment after the oscillator is restarted and the oscillator is operating stably, where the second frequency offset represents the difference between the second output frequency of the output signal of the oscillator at the second moment and the preset reference frequency.

[0200] The control unit 620 is further configured to, when the second frequency offset is greater than or equal to the preset frequency offset, control the oscillator to restart again.

[0201] Optionally, the obtaining unit 610 is specifically configured to detect whether the oscillator is operating stably after the oscillator is restarted and after a third preset duration.

[0202] The obtaining unit 610 is specifically configured to obtain the second frequency offset when the oscillator is operating stably.

[0203] Optionally, the oscillator is located in an electronic device, the first frequency offset is obtained at a first moment when the electronic device is started and has not been restarted, and the first frequency offset represents the difference between the first output frequency of the output signal of the oscillator at the first moment and a preset reference frequency.

[0204] The control unit 620 is specifically configured to, when the number of times of successful correction within a fourth preset duration is less than a first preset number threshold, control the oscillator to restart, where the number of times of successful correction represents the number of times that the second frequency offset is less than the preset frequency offset during multiple restarts of the oscillator within the fourth preset duration, the second frequency offset is obtained at a second moment after the oscillator is restarted and the oscillator is operating stably, and the second frequency offset represents the difference between the second output frequency of the output signal of the oscillator at the second moment and the preset reference frequency.

[0205] Optionally, the control unit 620 is specifically configured to control the oscillator to restart, including: controlling the oscillator to restart when the number of times the oscillator restarts within a fifth preset duration is less than a second preset number threshold.

[0206] Optionally, the oscillator is a crystal oscillator.

[0207] It should be noted that the above oscillator control device 600 is embodied in the form of a functional unit. The term "unit" here can be implemented in the form of software and / or hardware, and no specific limitation is made thereto.

[0208] For example, the "unit" can be a software program, a hardware circuit, or a combination of the two that implements the above functions. The hardware circuit may include an application specific integrated circuit (ASIC), an electronic circuit, a processor (such as a shared processor, a dedicated processor, or a group of processors, etc.) for executing one or more software or firmware programs, and a memory, a merged logic circuit, and / or other suitable components that support the described functions.

[0209] Therefore, the units in the examples described in the embodiments of the present application can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. A person skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.

[0210] A chip provided in the present application includes one or more processors, and the one or more processors can support the chip to implement the oscillator control method in the method embodiments. The processor can be a general-purpose processor or a dedicated processor. For example, the processor can be a central processing unit (CPU), a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, such as discrete gates, transistor logic devices, or discrete hardware components.

[0211] The processor can be used to control the chip, execute software programs, and process the data of the software programs.

[0212] The chip may include a communication interface. The chip may also include input and / or output circuitry. The chip may be disposed in an electronic device as a component of the electronic device. The processor can read the program or instructions stored in the memory through the data interface to execute the oscillator control method described in the above method embodiments.

[0213] The chip may also include one or more memories on which a program is stored. The program can be run by the processor to generate instructions, enabling the processor to execute the oscillator control method described in the above method embodiments according to the instructions.

[0214] Optionally, data may also be stored in the memory. Optionally, the processor may also read the data stored in the memory. The data may be stored at the same storage address as the program, or it may be stored at a different storage address from the program.

[0215] The processor and the memory may be provided separately or integrated together; for example, integrated on a system on chip (SOC) of a terminal device.

[0216] Exemplarily, the memory can be used to store the relevant program of the oscillator control method provided in the embodiments of the present application, and the processor can be used to call the relevant program of the oscillator control method stored in the memory to execute the oscillator control method of the embodiments of the present application; for example, when the oscillator is operating stably, obtaining a first frequency offset, where the first frequency offset represents the difference between the output frequency of the output signal of the oscillator and a preset reference frequency; when the first frequency offset is greater than or equal to a preset frequency offset, controlling the oscillator to restart.

[0217] It should be understood that the processor in the chip can be a central processing unit in an electronic device or other processors.

[0218] The present application also provides a computer program product, which implements the oscillator control method described in any method embodiment of the present application when executed by a processor.

[0219] The computer program product can be stored in the memory. For example, it is a program that is finally converted into an executable target file that can be executed by the processor after processes such as preprocessing, compilation, assembly, and linking.

[0220] The present application also provides a computer-readable storage medium on which a computer program is stored. The computer program implements the oscillator control method described in any method embodiment of the present application when executed by a computer. The computer program can be a high-level language program or an executable target program.

[0221] The computer-readable storage medium is, for example, a memory. The memory may be a volatile memory or a non-volatile memory, or the memory may include both a volatile memory and a non-volatile memory. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable ROM (PROM), an erasable programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchlink DRAM (SLDRAM), and direct rambus RAM (DR RAM).

[0222] In the embodiments of the present application, the use of user data may be involved. In practical applications, user-specific personal data may be used in the solutions described herein within the scope permitted by applicable laws and regulations, provided that the requirements of the applicable laws and regulations of the country where the user is located are met (for example, the user gives explicit consent, and the user is effectively notified, etc.).

[0223] In the description of the present application, the terms "first", "second", etc. are used only for descriptive purposes and cannot be construed as indicating or implying relative importance, as well as a specific order or sequence. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood according to specific circumstances.

[0224] In the present application, "at least one" means one or more, and "a plurality" means two or more. "At least one of the following items" or a similar expression means any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c may represent: a, b, c, a - b, a - c, b - c, or a - b - c, where a, b, c may be single or multiple.

[0225] It should be understood that in various embodiments of the present application, the magnitudes of the serial numbers of the above processes do not imply the order of execution, and the order of execution of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.

[0226] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.

[0227] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments, and will not be elaborated herein.

[0228] In several embodiments provided by the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative; for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation; for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be in an electrical, mechanical or other form.

[0229] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they can be located in one place, or can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0230] In addition, the functional units in various embodiments of the present application can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit.

[0231] As described above, only the specific implementation manners of the present application are provided, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present application, and all should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. An oscillator control method, characterized in that, it includes: When the oscillator is operating stably, obtaining a first frequency offset, where the first frequency offset represents the difference between the output frequency of the output signal of the oscillator and a preset reference frequency; When the first frequency offset is greater than or equal to a preset frequency offset, controlling the oscillator to restart.

2. The method according to claim 1, characterized in that, the method further includes: Obtaining a status parameter output by the oscillator, where the status parameter is used to indicate whether the oscillator is operating stably; The step of obtaining the first frequency offset when the oscillator is operating stably includes: when the status parameter indicates that the oscillator is operating stably, obtaining a frequency parameter output by the oscillator, and when the status parameter indicates that the oscillator is operating stably, the frequency parameter represents the output frequency.

3. The method according to claim 2, characterized in that, the method further includes: When the status parameter indicates that the oscillator is not operating stably, after obtaining the status parameter and after a first preset time period, obtaining the status parameter again.

4. The method according to any one of claims 1-3, characterized in that, the oscillator is located in an electronic device; The step of obtaining the first frequency offset includes: after the electronic device is started and after a second preset time period, obtaining the first frequency offset.

5. The method according to any one of claims 1-4, characterized in that, the first frequency offset is obtained at a first moment, and the first frequency offset represents the difference between the first output frequency of the output signal of the oscillator at the first moment and a preset reference frequency; The method further includes: after the oscillator restarts and at a second moment when the oscillator is operating stably, obtaining a second frequency offset, where the second frequency offset represents the difference between the second output frequency of the output signal of the oscillator at the second moment and the preset reference frequency; When the second frequency offset is greater than or equal to the preset frequency offset, controlling the oscillator to restart again.

6. The method according to claim 5, characterized in that, The step of obtaining the second frequency offset after the oscillator restarts and at a second moment when the oscillator is operating stably includes: After the oscillator restarts and after a third preset time period, detecting whether the oscillator is operating stably; When the oscillator is operating stably, obtaining the second frequency offset.

7. The method according to claim 5 or 6, characterized in that, the oscillator is located in an electronic device, the first frequency offset is obtained at a first moment after the electronic device is started and before any restart, and the first frequency offset represents the difference between the first output frequency of the output signal of the oscillator at the first moment and a preset reference frequency; Controlling the oscillator to restart includes: when the number of times of deviation correction success in a fourth preset duration is less than a first preset number threshold, controlling the oscillator to restart, where the number of times of deviation correction success represents the number of times that the second frequency deviation is less than the preset frequency deviation among multiple restarts of the oscillator in the fourth preset duration, the second frequency deviation is obtained at a second moment after the restart of the oscillator and when the oscillator is stably operating, and the second frequency deviation represents the difference between the second output frequency of the output signal of the oscillator at the second moment and the preset reference frequency.

8. The method according to any one of claims 1-7, wherein, controlling the oscillator to restart includes: when the number of times of restart of the oscillator in a fifth preset duration is less than a second preset number threshold, controlling the oscillator to restart.

9. The method according to any one of claims 1-7, wherein, the oscillator is a crystal oscillator.

10. An electronic device, wherein, comprising a processor and a memory, the memory is used to store a computer program, and the processor is used to call and run the computer program from the memory, so that the electronic device executes the method according to any one of claims 1 to 9.

11. A chip, wherein, comprising a processor and a data interface, the processor reads an instruction stored on a memory through the data interface to execute the method according to any one of claims 1 to 9.

12. A computer-readable storage medium, wherein, the computer-readable storage medium stores a computer program, and the computer program is used to implement the method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • A method for eliminating frequency deviation and mobile terminal

    CN101150330A

  • Time and frequency deviation compensation method and user terminal

    CN106028436A

  • A method for reducing frequency offset and a terminal device thereof

    CN109039574A

  • Frequency offset estimation value correction method and device and computer readable storage medium

    CN109729032A

  • Oscillator calibration method, module, chip and electronic equipment

    CN113691256A