Oscillator control method and electronic device
By detecting frequency deviations during stable oscillator operation and restarting the oscillator when they exceed preset values, the problem of electronic device malfunctions caused by oscillator frequency offsets is solved, ensuring normal device operation and reducing hardware damage.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HONOR DEVICE CO LTD
- Filing Date
- 2023-11-17
- Publication Date
- 2026-06-12
AI Technical Summary
Frequency deviation of the oscillator's output signal can cause electronic devices to malfunction, such as crashing, failure to send uplink signals, or inability to access the network.
The frequency deviation is acquired when the oscillator is running stably, and the oscillator is restarted when the deviation exceeds a preset value to restore the normal frequency.
Timely detection and recovery of oscillator malfunctions can prevent disruption to the normal operation of electronic devices and reduce the risk of hardware damage caused by frequent restarts.
Smart Images

Figure CN120074512B_ABST
Abstract
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 Technology
[0002] An oscillator is an energy conversion device used to convert direct current (DC) energy into alternating current (AC) energy with a specific frequency. In other words, an oscillator is an electronic component used to generate repetitive electronic signals (usually sine or square waves). Crystal oscillators (XOs) are characterized by their highly stable frequency, and are therefore widely used in various wireless communication terminals.
[0003] Based on the oscillator's output signal, the electronic device containing the oscillator can determine the clock signal or the carrier signal for wireless communication between the electronic device and other electronic devices. Frequency deviation of the oscillator's output signal may cause the electronic device to malfunction, such as crashing, failing to transmit uplink signals, or being unable to access the network. Summary of the Invention
[0004] This application provides an oscillator control method and electronic device, which can promptly restart the oscillator when the difference between the output frequency of the oscillator's output signal and the preset reference frequency is greater than or equal to the preset frequency deviation, so as to restore the oscillator from abnormality and reduce the impact of the frequency abnormality of the oscillator's output signal on the normal operation of the electronic device in which the oscillator is located.
[0005] In a first aspect, an oscillator control method is provided, comprising: when the oscillator is operating stably, acquiring a first frequency deviation, the first frequency deviation representing the difference between the output frequency of the output signal of the oscillator and a preset reference frequency; and controlling the oscillator to restart when the first frequency deviation is greater than or equal to the preset frequency deviation.
[0006] If the frequency deviation between the output frequency of the oscillator and the preset reference frequency is greater than or equal to the preset frequency deviation when the oscillator is operating stably, the oscillator will be restarted. This allows for timely detection of abnormal output signals and recovery of the abnormality by restarting the oscillator, thereby preventing the oscillator malfunction from affecting the normal operation of other components in the electronic device that rely on the oscillator's output signal.
[0007] In one possible implementation, the method further includes: obtaining a state parameter output by the oscillator, the state parameter indicating whether the oscillator is operating stably; obtaining a first frequency offset when the oscillator is operating stably includes: obtaining a frequency parameter output by the oscillator when the state parameter indicates that the oscillator is operating stably, the frequency parameter representing the output frequency when the state parameter indicates that the oscillator is operating stably.
[0008] When the oscillator's output state parameters indicate stable operation, the oscillator's output frequency parameters represent the output frequency of the oscillator's output signal. Obtaining the oscillator's output frequency parameters, while assuming stable operation, allows for a more accurate determination of the first frequency deviation.
[0009] In one possible implementation, the method further includes: when the state parameter indicates that the oscillator is not operating stably, acquiring the state parameter again after acquiring the state parameter and waiting for a first preset time period.
[0010] When the status parameters indicate that the oscillator is not running stably, the status parameters are acquired again after a first preset time. This allows the frequency parameters of the oscillator output to be acquired in a timely manner after the oscillator starts running stably, the first frequency deviation to be calculated, and the abnormality of the oscillator output signal to be determined in a timely manner.
[0011] In one possible implementation, the oscillator is located in an electronic device; the acquisition of the first frequency offset includes: acquiring the first frequency offset after the electronic device is started and a second preset time has elapsed.
[0012] The probability of an oscillator output signal anomaly—that is, a difference between the output frequency and the preset reference frequency that is greater than or equal to a preset frequency offset—is relatively low. Acquiring the first frequency offset only after the electronic device has started and after a second preset time has elapsed reduces the impact of oscillator output signal anomaly detection on the electronic device's operation after startup, thus improving the user experience.
[0013] In one possible implementation, the first frequency offset is acquired at a first moment, and the first frequency offset represents the difference between the first output frequency of the oscillator's output signal 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 running stably, acquiring a second frequency offset, the second frequency offset representing the difference between the second output frequency of the oscillator's output signal at the second moment and the preset reference frequency; if the second frequency offset is greater than or equal to the preset frequency offset, controlling the oscillator to restart again.
[0014] If the oscillator's output signal still shows excessive frequency deviation after a restart, the oscillator can be restarted again to attempt to recover from the abnormal condition and increase the likelihood of it returning to normal. Once the oscillator is back to normal, under stable operation, the difference between the output signal frequency and the preset reference frequency will be less than the preset deviation.
[0015] In one possible implementation, obtaining the second frequency offset at a second moment after the oscillator restarts and the oscillator is running stably includes: detecting whether the oscillator is running stably after the oscillator restarts and a third preset time has elapsed; and obtaining the second frequency offset if the oscillator is running stably.
[0016] It takes a certain amount of time for the oscillator to restart and reach stable operation. Detecting whether the oscillator is stable after restarting and after a third preset time, and obtaining the second frequency offset when the oscillator is stable, can reduce the number of times the oscillator is checked for stability and lower power consumption.
[0017] In one possible implementation, the oscillator is located in an electronic device, and the first frequency offset is obtained at a first moment after the electronic device has been started without a restart. The first frequency offset represents the difference between the first output frequency of the oscillator's output signal at the first moment and a preset reference frequency. Controlling the restart of the oscillator includes: controlling the oscillator to restart if the number of successful corrections within a fourth preset time period is less than a first preset threshold number. The number of successful corrections represents the number of times the second frequency offset is less than the preset frequency offset during multiple restarts of the oscillator within the fourth preset time period. The second frequency offset is obtained at a second moment after the oscillator restarts and when the oscillator is operating stably. The second frequency offset represents the difference between the second output frequency of the oscillator's output signal at the second moment and the preset reference frequency.
[0018] Before restarting the oscillator, it is determined whether the number of successful corrections within the fourth preset time period is less than the first preset threshold. If so, the oscillator is restarted. This avoids excessive restarts within a certain period, which could damage the oscillator. The number of successful corrections represents the number of restarts required to ensure that the difference between the output frequency of the restarted oscillator's output signal and the preset reference frequency is less than the preset frequency deviation.
[0019] In one possible implementation, controlling the oscillator to restart includes: controlling the oscillator to restart if the number of restarts within a fifth preset duration is less than a second preset threshold.
[0020] Before restarting the oscillator, it is determined whether the number of oscillator restarts within the fifth preset time period is less than the second preset threshold. If so, the oscillator is restarted. This avoids damage to the oscillator caused by excessive restarts within a certain period.
[0021] In one possible implementation, the oscillator is a crystal oscillator.
[0022] In a second aspect, an oscillator control device is provided, including a unit for performing the method of the first aspect. This device may be a terminal device or a chip within the terminal device. The oscillator control device includes a unit for performing the method of the first aspect described above.
[0023] Thirdly, an electronic device is provided, including a memory and a processor, the memory for storing a computer program, and the processor for calling and running the computer program from the memory, causing the electronic device to perform the method of the first aspect.
[0024] The fourth aspect provides a chip including a processor and a data interface, wherein the processor reads instructions stored in a memory through the data interface to execute the method of the first aspect.
[0025] Fifthly, a computer-readable storage medium is provided, the computer-readable storage medium storing computer program code for implementing the method of the first aspect.
[0026] In a sixth aspect, a computer program product is provided, the computer program product comprising: computer program code, the computer program code being used to implement the method of the first aspect. Attached Figure Description
[0027] Figure 1 This is a schematic diagram of a hardware system applicable to the apparatus of this application;
[0028] Figure 2 This is a schematic diagram of a software system applicable to the apparatus of this application;
[0029] Figure 3 This is a schematic flowchart of an oscillator control method provided in an embodiment of this application;
[0030] Figure 4 This is a schematic flowchart of another oscillator control method provided in the embodiments of this application;
[0031] Figure 5 This is a schematic flowchart of another oscillator control method provided in the embodiments of this application;
[0032] Figure 6 This is a schematic structural diagram of an oscillator control device provided in this application. Detailed Implementation
[0033] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0034] Figure 1 A hardware system for an electronic device applicable to this application is shown.
[0035] The method provided in this application can be applied to various network-connected electronic devices such as mobile phones, tablets, wearable devices, laptops, netbooks, and personal digital assistants (PDAs). This application does not impose any restrictions on the specific type of electronic device.
[0036] Figure 1 A schematic diagram of the structure of electronic device 100 is shown. 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, antenna 1, 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 jack 170D, a sensor module 180, buttons 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 accelerometer sensor 180E, a distance sensor 180F, a proximity 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 is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0038] Processor 110 may include one or more processing units, such as: application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0039] The controller can be the nerve center and command center of the electronic device 100. The controller can generate operation control signals according to the instruction opcode and timing signals to complete the control of fetching and executing instructions.
[0040] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly 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 is understood that the interface connection relationships between the modules illustrated in the embodiments of this application are merely illustrative and do not constitute a structural limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.
[0042] The wireless communication function of electronic device 100 can be realized 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 to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with tuning switches.
[0044] The mobile communication module 150 can provide solutions for wireless communication, including 2G / 3G / 4G / 5G, applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed 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 may be housed in the same device.
[0045] The modem processor may include a modulator and a demodulator. The modulator modulates the low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator demodulates the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After processing by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs sound signals through an audio device (not limited to speaker 170A, receiver 170B, etc.) or displays images or videos through the display screen 194. In some embodiments, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor 110 and may be housed in the same device as the mobile communication module 150 or other functional modules.
[0046] The wireless communication module 160 can provide solutions for wireless communication applications on the electronic device 100, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.
[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, enabling electronic device 100 to communicate with networks and other devices via wireless communication technology. The wireless communication technology 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 technologies, etc. The GNSS may include the Global Positioning System (GPS), the Global Navigation Satellite System (GLONASS), the BeiDou Navigation Satellite System (BDS), the Quasi-Zenith Satellite System (QZSS), and / or satellite-based augmentation systems (SBAS).
[0048] The external storage interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.
[0049] Internal memory 121 can be used to store computer executable program code, which includes instructions. Processor 110 executes various functional applications and data processing of electronic device 100 by running the instructions stored in internal memory 121. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created during the use of electronic device 100 (such as audio data, phonebook, etc.). Furthermore, internal memory 121 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.
[0050] The electronic device 100 may also include an oscillator.
[0051] An oscillator is an energy conversion device used to convert direct current (DC) electrical energy into alternating current (AC) electrical energy with a specific frequency. In other words, an oscillator is an electronic component used to generate repetitive electronic signals (usually sine waves or square waves). The circuit that constitutes an oscillator is called an oscillation circuit.
[0052] A crystal oscillator (XO), also known as a quartz crystal resonator, is a widely used electronic device in wireless communication equipment, electronic clocks, digital instruments, smart meters, and many other electronic devices, characterized by its high frequency stability, small size, and low cost. The oscillator in electronic device 100 can be a crystal oscillator.
[0053] A crystal oscillator is a resonant device made using the piezoelectric effect of quartz crystals. If an electric field is applied to the two electrodes of a quartz crystal, the crystal will undergo mechanical deformation; conversely, if mechanical pressure is applied to the sides of the crystal, an electric field will be generated in the corresponding direction. This physical phenomenon is called the piezoelectric effect. Crystal oscillators utilize the mechanical resonance of quartz crystals to generate electrical signals with very precise frequencies.
[0054] A crystal oscillator can be used to generate clock signals. A modulator is used to modulate the output signal of the crystal oscillator using the low-frequency baseband signal to be transmitted, obtaining a mid-to-high frequency signal. This mid-to-high frequency signal is the modulated signal. An antenna can convert the amplified and modulated signal into electromagnetic waves for radiation.
[0055] The software system of electronic device 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment uses the layered architecture Android system as an example to exemplify the software structure of electronic device 100.
[0056] Figure 2 This is a software structure block diagram of an electronic device 100 according to an embodiment of this application. The layered architecture divides the software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: 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] like Figure 2 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and SMS.
[0058] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.
[0059] like Figure 2 As shown, the application framework layer may include a window manager, content provider, view system, phone manager, resource manager, notification manager, etc.
[0060] The Android runtime consists of the core libraries and the virtual machine. The Android runtime is responsible for scheduling and managing the Android system. The core libraries consist of two parts: one part contains the functionalities that Java calls, and the other part comprises the Android core libraries. The application layer and application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and 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 can include multiple functional modules. For example: a surface manager, media libraries, 3D graphics processing libraries (e.g., OpenGL ES), and a 2D graphics engine (e.g., SGL). The surface manager manages the display subsystem and provides fusion of 2D and 3D layers for multiple applications. The media libraries support playback and recording of various common audio and video formats, as well as still image files. The 3D graphics processing libraries are used to implement 3D graphics drawing, image rendering, compositing, and layer processing. The 2D graphics engine is the drawing engine for 2D graphics.
[0062] The kernel layer is the layer between hardware and software. It can include driver modules such as display drivers, camera drivers, audio drivers, and sensor drivers.
[0063] In some cases, the frequency of the oscillator's output signal may be off, causing electronic devices to malfunction, such as electronic devices crashing, uplink signal transmission failure, or inability to access the network.
[0064] To address the aforementioned problems, embodiments of this application provide an oscillator control method and an electronic device.
[0065] The following is combined with Figures 3 to 4 The oscillator control method provided in the embodiments of this application will be described in detail.
[0066] Figure 3 This is a schematic flowchart of an oscillator control method provided in an embodiment of this application. The method may include steps S310 to S320, which are described in detail below.
[0067] Step S310: When the oscillator is operating stably, a first frequency deviation is obtained, wherein the first frequency deviation represents the difference between the output frequency of the oscillator's output signal and a preset reference frequency.
[0068] In some embodiments, stable operation of the oscillator can be understood as the state of stable oscillation after the oscillator has started oscillating. When the oscillator is oscillating stably, the output frequency of the oscillator's output signal is stable, that is, the output frequency hardly changes with time.
[0069] In other embodiments, the oscillator can output state parameters and frequency parameters. The state parameters indicate whether the oscillator is operating stably. When the state parameters indicate stable operation, the frequency parameters indicate the output frequency of the oscillator's output signal. In other words, the state parameters indicate whether the frequency parameters output by the oscillator can represent the output frequency of the oscillator's output signal. Therefore, the state parameters output by the oscillator can be obtained before proceeding to step S310.
[0070] If the state parameters indicate that the oscillator is operating stably, step S310 can be performed. That is, if the acquired state parameters indicate that the oscillator is operating stably, the frequency parameters of the oscillator output can be obtained. Therefore, by calculating the difference between the preset reference frequency and the output frequency of the oscillator's output signal represented by the frequency parameters, the first frequency deviation can be obtained.
[0071] When the state parameters indicate that the oscillator is not operating stably, the state parameters can be acquired periodically or non-periodically. For example, after acquiring the state parameters and waiting for a first preset time period, the state parameters can be acquired again.
[0072] If the acquired status parameters indicate that the oscillator is operating stably, then step S310 can be performed; otherwise, if the acquired status parameters indicate that the oscillator is not operating stably, then the status parameters can be acquired again until the acquired status parameters indicate that the oscillator is operating stably, or until the time elapsed since the first acquisition of the status parameters exceeds the sixth preset time, then the acquisition of status parameters will no longer be performed.
[0073] If the status parameters are acquired for the first time and the acquired status parameters indicate that the oscillator is not running stably, a timer can be started to record the elapsed time since the first acquisition of the status parameters. If the elapsed time recorded by the timer exceeds the sixth preset time, an abnormal indication message can be output and the acquisition of status parameters will no longer be performed.
[0074] When periodically acquiring the oscillator's state parameters, if the elapsed time since the first acquisition exceeds a sixth preset time, the acquisition of state parameters will cease. This can also be understood as ceasing acquisition if the total number of acquisitions exceeds a third preset threshold. The third preset threshold can be obtained by rounding down the ratio of the sixth preset time to the period of acquiring the oscillator's state parameters.
[0075] The oscillator can be a crystal oscillator or other types of oscillators. When the oscillator is a crystal oscillator, the state parameters can also be called crystal quality index states.
[0076] The first frequency deviation can be expressed as the absolute value of the difference between the output frequency of the oscillator's output signal and the preset reference frequency, or it can be expressed as the ratio of this absolute value to the preset reference frequency.
[0077] Step S320: If the first frequency deviation is greater than or equal to the preset frequency deviation, control the oscillator to restart.
[0078] The first frequency deviation being greater than or equal to the preset frequency deviation can also be understood as the oscillator's frequency deviation being out of tolerance.
[0079] The oscillator can be located in an electronic device. Through steps S310 to S320, if the difference between the signal frequency of the output signal and the preset reference frequency is greater than or equal to the preset frequency deviation when the oscillator is operating stably, the oscillator is controlled to restart, so as to avoid the abnormal signal frequency of the oscillator output signal affecting the normal operation of other components in the electronic device that depend on the oscillator output signal.
[0080] The oscillator's output signal can be used by the electronic device containing the oscillator to communicate with other communication devices. Communication has extremely high requirements for signal frequency. If the frequency of the oscillator's output signal differs significantly from the preset reference frequency, it may cause communication interruption between the electronic device and other communication devices.
[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 deviation can be obtained, it can be determined whether the first frequency deviation is greater than or equal to the preset frequency deviation, and the oscillator can be restarted if the first frequency deviation is greater than or equal to the preset frequency deviation.
[0082] For example, a first frequency offset can be obtained after the electronic device is started and a second preset time has elapsed.
[0083] The second preset duration can be greater than or equal to the duration required for electronic device initialization. This avoids interference from oscillator restarts on the initialization of the electronic device.
[0084] Generally, the first frequency deviation of the oscillator in an electronic device is less than the preset frequency deviation. That is, the possibility of the oscillator exhibiting an abnormal situation of excessive frequency deviation is low. In order to reduce the impact of oscillator detection and control on the normal initialization and network registration processes after the electronic device starts up, the second preset duration can also be greater than or equal to the sum of the duration required for electronic device initialization and the duration generally required for network registration.
[0085] After initialization, the electronic device can register with a network. After registering with the network, the electronic device can communicate with the network and other electronic devices or network devices through wireless communication technology.
[0086] During the network registration process of an electronic device, the amount of information transmitted when communicating with other devices is relatively small, and the output frequency requirement of the oscillator signal is relatively low. However, after the electronic device successfully registers with the network, it may need to transmit a large amount of data through the registered network, which places a relatively high demand on the output frequency of the oscillator signal.
[0087] In other words, even if an electronic device successfully registers with the network, the difference between the output frequency of the oscillator's output signal and the preset reference frequency, i.e., the first frequency deviation, may still be greater than or equal to the preset frequency deviation, affecting the electronic device's ability to transmit other data and information through the network after registration.
[0088] Therefore, regardless of whether the electronic device successfully registers with the network, steps S310 to S320 can be performed after the electronic device is started and a second preset time has elapsed.
[0089] It should be understood that the oscillator may or may not operate when the electronic device is powered off. Starting the electronic device can be understood as turning it on.
[0090] Due to various factors, an oscillator may deviate significantly from its initial state after operating for a period of time. If the oscillator is running regardless of whether the electronic device is powered off or powered on, it is crucial to detect any abnormalities in the oscillator's output frequency after the electronic device is powered on.
[0091] By restarting the oscillator, it can be restored to its initial state. Thus, the difference between the frequency of the oscillator's output signal after restarting and the preset reference frequency can be less than the preset frequency deviation, thereby correcting the oscillator's deviation and restoring the abnormal phenomenon of excessive frequency deviation.
[0092] After the electronic device is started, the frequency deviation of the oscillator's output signal is detected. That is, the difference between the output frequency of the oscillator's output signal under stable operation and the preset reference frequency, i.e., whether the first frequency deviation is greater than or equal to the preset frequency deviation, is judged. If the first frequency deviation is greater than or equal to the preset frequency deviation, the oscillator is restarted to try to restore the frequency deviation of the oscillator's output signal to the preset frequency deviation, thereby achieving frequency deviation correction.
[0093] During the operation of electronic equipment, it is no longer necessary to detect whether the output signal of the oscillator deviates from the acceptable frequency range, and correction is no longer required.
[0094] After restarting the oscillator in step S320, it is also possible to detect whether 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. For ease of description, the first frequency offset can be considered to be acquired at the first moment, and the first frequency offset represents the difference between the first output frequency of the oscillator output signal at the first moment and the preset reference frequency.
[0095] Before the first moment, the oscillator may or may not have been restarted. In other words, the first moment can be the moment when the difference between the oscillator's output frequency and the preset reference frequency is first obtained after the electronic device has started up and the oscillator is running stably.
[0096] After the oscillator restarts and at a second moment when the oscillator is running stably, the second frequency deviation can be obtained. The second frequency deviation represents the difference between the second output frequency of the oscillator's output signal at the second moment and the preset reference frequency.
[0097] If the second frequency deviation is greater than or equal to the preset frequency deviation, the oscillator can be restarted again.
[0098] When the second frequency deviation is less than the preset frequency deviation, it can be determined that the frequency of the oscillator's output signal meets the requirements, thus achieving the correction of the oscillator's frequency deviation.
[0099] After the oscillator restarts, its stability can be checked immediately. Alternatively, it can be checked after the oscillator restarts and a third preset time has elapsed.
[0100] Therefore, the second frequency offset is obtained when the oscillator is operating stably. If unstable operation of the oscillator is detected, the stability of the oscillator can be checked again. For example, the detection of oscillator stability can be performed periodically or non-periodically. That is, the interval between two consecutive checks of oscillator stability can be equal or unequal.
[0101] It takes a period of time for the crystal oscillator to restart and reach stable operation. It is more reasonable to test whether the oscillator is operating stably after the oscillator has restarted and after the third preset time.
[0102] The third preset duration can be set according to the time required for the oscillator to restart under normal circumstances.
[0103] For example, the number of successful corrections within a certain period of time can be used to determine whether the oscillator should be restarted.
[0104] After each restart of the oscillator, under stable operation, the second output frequency of the oscillator's output signal can be obtained, and the difference between the second output frequency and the preset reference frequency can be calculated to obtain the second frequency deviation.
[0105] Successful correction indicates that the second frequency deviation has been reduced to less than the preset frequency deviation by restarting the oscillator. 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 after the oscillator has been running stably for the second time since the restart.
[0106] The number of successful corrections indicates the number of times a correction was successfully performed. In other words, the number of successful corrections represents the number of times the second frequency deviation was less than the preset frequency deviation during the multiple restarts of the oscillator over a fourth preset time interval. The second frequency deviation is obtained at the second moment after the oscillator restarts and while it is operating stably. The second frequency deviation represents the difference between the second output frequency of the oscillator's output signal at the second moment and the preset reference frequency.
[0107] If the first frequency deviation is greater than or equal to the preset frequency deviation, it can be determined whether the number of successful corrections within the fourth preset time period is less than the first preset number threshold. In other words, it can be determined whether all successful corrections with a number equal to the first preset number threshold occurred within the fourth preset time period.
[0108] If the number of successful corrections within the fourth preset time period is less than the first preset threshold, the oscillator can be restarted. If the number of successful corrections within the fourth preset time period is greater than or equal to the first preset threshold, the oscillator will not be restarted. This avoids hardware damage to the oscillator due to frequent restarts.
[0109] If the number of successful corrections within the fourth preset time period is greater than or equal to the first preset threshold, an alarm message can be output to remind the user that the frequency of the oscillator's output signal is abnormal.
[0110] For example, the decision to restart the oscillator can also be determined based on the number of times the oscillator restarts within a certain period of time.
[0111] If the first frequency deviation is greater than or equal to a preset frequency deviation, it can be determined whether the number of oscillator restarts within the fifth preset time period is less than a second preset threshold. If the number of oscillator restarts within the fifth preset time period is less than the second preset threshold, the oscillator can be controlled to restart. If the number of oscillator restarts within the fifth preset time period is greater than or equal to the second preset threshold, the oscillator can be stopped from restarting. This avoids hardware damage to the oscillator due to frequent restarts.
[0112] If the number of oscillator restarts within the fifth preset time period is greater than or equal to the second preset threshold number, an alarm message can be output to remind the user that the frequency of the oscillator's output signal is abnormal.
[0113] If the first frequency deviation is greater than or equal to the preset frequency deviation, it can be determined whether to restart the oscillator based on the number of oscillator restarts in the fifth preset time period and / or the number of successful corrections in the fourth preset time period.
[0114] The first frequency deviation can also represent the difference between the output frequency of the oscillator's output signal and the preset reference frequency at any moment during stable operation of the oscillator. In other words, after the electronic device is started, regardless of whether the oscillator has been restarted, if it is determined that the difference between the oscillator's output frequency and the preset reference frequency is greater than or equal to the preset frequency deviation, it can be determined whether to restart the oscillator based on the number of times the oscillator is restarted and / or the number of successful corrections within a certain period of time.
[0115] An oscillator can be installed in an electronic device. The first frequency deviation can represent the difference between the output frequency of the oscillator's stable operating signal and a preset reference frequency when the oscillator is running stably after the electronic device is started and has not been restarted. If the oscillator has not been restarted after the electronic device is started, it can be determined whether to restart the oscillator based on the number of restarts and / or the number of successful corrections within a certain period.
[0116] If the first frequency deviation obtained after the electronic device is started and the oscillator is not restarted is greater than or equal to the preset frequency deviation, and the oscillator is restarted based on the number of successful corrections within a certain period of time, then after the oscillator is restarted, the number of successful corrections within a certain period of time will not increase. Therefore, it is not necessary to compare the number of successful corrections within a certain period of time with the first preset threshold, thereby reducing the amount of data to be calculated and reducing power consumption.
[0117] In other words, if the number of successful corrections is less than the first preset threshold number within the fourth preset time period, and the oscillator is restarted, the first frequency offset can be obtained at the first moment after the electronic device is started without being restarted. The first frequency offset represents the difference between the first output frequency of the oscillator's output signal at the first moment and the preset reference frequency.
[0118] The method provided in this application embodiment, when the oscillator is running stably, if the frequency deviation between the output frequency of the oscillator's output signal and the preset reference frequency is greater than or equal to the preset frequency deviation, controls the oscillator to restart, thereby promptly detecting abnormalities in the oscillator's output signal and attempting to restore the oscillator by restarting it, thereby preventing the oscillator's abnormality from affecting the normal operation of other components in the electronic device that depend on the oscillator's output signal.
[0119] The following is combined with Figure 4 Taking a crystal oscillator as an example, for Figure 4The control method of the oscillator shown will be explained.
[0120] Figure 4 This is a schematic flowchart of an oscillator control method provided in an embodiment of this application. Figure 4 The oscillator control method shown may include steps S401 to S415 for correcting the oscillator bias. These steps are described in detail below.
[0121] When the electronic device is started, steps S401 and S403 can be performed.
[0122] When an electronic device is powered off, the crystal oscillator can operate and output signals, or it can remain inactive and stop outputting signals. The following explanation uses the example of the crystal oscillator not operating when the electronic device is powered off, and the crystal oscillator operating when the electronic device is powered on.
[0123] Step S401: Start the second timer. The second duration T2 recorded by the second timer represents the length of time elapsed since the electronic device was powered on.
[0124] If the second duration T2 is greater than or equal to the second preset duration Tp2, proceed to step S402.
[0125] For example, after step S401, it can be determined periodically or non-periodically 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 based on the system initialization time typically required after the electronic device starts up. In other words, the system initialization time is a statistical or empirical value. The second preset duration Tp2 can also be equal to or approximately equal to the system initialization time, or it can be greater than the system initialization time.
[0127] The second preset duration Tp2 can also be determined based on the network registration duration typically described for electronic devices registering on a 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 status of the crystal oscillator.
[0129] The operating status of a crystal oscillator can be obtained by calling its status interface. This interface can output status parameters, which represent the oscillator's operating state. These parameters can also be referred to as crystal quality index status. For example, when the crystal quality index status is 5, the oscillator is in its first state; when it is 6 or 8, it is in its second state.
[0130] The crystal oscillator can operate in either a first state or a second state. The first state indicates that the crystal oscillator is not operating stably, while the second state indicates that the crystal oscillator is operating stably.
[0131] When the crystal oscillator is in its first state, the output frequency of the crystal oscillator may change over time. The first state includes the state in which the crystal oscillator starts oscillating.
[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 crystal oscillator is in its first operating state, S403 or S404 can be performed.
[0134] Step S403: Determine whether the first acquisition number N3 of the crystal oscillator's operating status after the electronic device is powered on is less than or equal to the third preset acquisition number threshold Np3.
[0135] If the first number of acquisitions N3 is less than or equal to the third preset number of acquisitions threshold Np3, S402 can be performed.
[0136] If the first acquisition count N3 is greater than the third preset threshold count Np3, an alarm message can be output, and the current correction process for the crystal oscillator ends.
[0137] Step S404: Start the first timer. The first duration T1 recorded by the first timer represents the elapsed time since the last acquisition of the crystal oscillator's operating status.
[0138] If the first duration T1 is greater than or equal to the first preset duration Tp1, step S402 can be performed.
[0139] If the crystal oscillator's operating state is the second state as obtained in S402, steps S405 and S406 can be performed. In step S405, the frequency deviation ΔF1 of the crystal oscillator's output signal frequency F1 relative to the preset operating frequency Fp is calculated.
[0140] Before step S405, the frequency F1 of the crystal oscillator's output signal can be obtained. The frequency of the crystal oscillator's output signal can be obtained by calling the crystal oscillator's frequency interface.
[0141] When the crystal oscillator is in the second operating state, the frequency interface of the crystal oscillator outputs the frequency of the output signal of the crystal oscillator.
[0142] Frequency offset Δ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 offset ΔF1 is greater than or equal to the preset frequency offset ΔFp.
[0144] If the frequency offset ΔF1 is less than the preset frequency offset ΔFp, it can be determined that the crystal oscillator is working normally, and the current correction process for the crystal oscillator is complete.
[0145] If the frequency offset ΔF1 is greater than or equal to the preset frequency offset, step S407 can be performed.
[0146] Step S407: Determine whether the number of successful corrections N1 of the crystal oscillator within the fourth preset time period Tp4 is greater than the first preset number threshold Np1.
[0147] The number of successful corrections N1 of the crystal oscillator within the fourth preset time period Tp4 can be understood as the number of successful corrections of the crystal oscillator within the fourth preset time period Tp4 before the time of step S407.
[0148] If the number of successful corrections N1 is greater than the first preset threshold Np1, an alarm message can be output, and the correction process for the crystal oscillator ends.
[0149] If the number of times N1 that the crystal oscillator is successfully corrected 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 length of time elapsed after the crystal oscillator restarts.
[0152] Step S410: If the third duration T3 is greater than or equal to the third preset duration Tp3, obtain the operating status of the crystal oscillator.
[0153] The operating status of the crystal oscillator can be obtained by calling its status interface.
[0154] The third preset duration Tp3 can be determined based on the restart time generally required for the crystal oscillator to restart and reach stable operation. In other words, the restart time is a statistical or empirical value. The third preset duration Tp3 can be equal to or approximately equal to the restart time, or it can be slightly greater or slightly less than the restart time.
[0155] Under normal circumstances, the restart time is less than the sum of the system initialization time and the network registration time. Therefore, the third preset time Tp3 can be less than the first preset time Tp1.
[0156] If the crystal oscillator's operating state obtained in step S410 is the first state, then S411 or S412 can be performed.
[0157] Step S411: Determine whether the second acquisition number N4 for obtaining the crystal oscillator's operating status after the crystal oscillator restarts is less than or equal to the third preset acquisition number threshold Np3.
[0158] If the second number of acquisitions N4 is less than or equal to the third preset number of acquisitions threshold Np3, S412 can be performed.
[0159] If the second acquisition number N4 is greater than the third preset acquisition number threshold Np3, an alarm message can be output, and the current correction process for the crystal oscillator ends.
[0160] Step S412: Start the first timer. The first duration T1 recorded by the first timer represents the elapsed time since the last acquisition of the crystal oscillator's operating status.
[0161] If the first duration T1 is greater than or equal to the first preset duration Tp1, step S411 can be performed.
[0162] If the crystal oscillator's operating state 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 crystal oscillator's output signal can be obtained. This can be achieved by calling the crystal oscillator's frequency interface.
[0165] Frequency F1 was obtained before the crystal oscillator restarted, representing the output signal frequency of the crystal oscillator under stable operating conditions before the restart. Frequency F2 was obtained after the crystal oscillator restarted, representing the output signal frequency of the crystal oscillator under stable operating conditions after the restart.
[0166] Step S414: Determine whether the frequency offset ΔF2 is greater than or equal to the preset frequency offset ΔFp.
[0167] If the frequency offset ΔF2 is less than the preset frequency offset ΔFp, it can be determined that the crystal oscillator is working normally. The correction of the crystal oscillator is successful, proceed to step S415.
[0168] If 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 of successful correction can be either the moment of the last crystal oscillator restart or the moment when the frequency offset ΔF2 is determined to be less than the preset frequency offset.
[0171] Based on the moment of successful correction recorded in step S415, in step S407, the number of successful corrections N1 of the crystal oscillator within the fourth preset time period Tp4 can be determined.
[0172] In step S407, it is determined whether the number of successful corrections N1 of the crystal oscillator within the fourth preset time period Tp4 is greater than the first preset number threshold Np1. If the number of successful corrections N1 is greater than the first preset number threshold Np1, the current correction process for the crystal oscillator is terminated. This avoids frequent restarts of the crystal oscillator when the user of the electronic device frequently restarts the mobile phone, thus reducing the possibility of damage caused by frequent restarts of the crystal oscillator.
[0173] After S416, the current correction process for the crystal oscillator is complete.
[0174] It should be understood that if the frequency of the crystal oscillator's output signal does not meet the frequency offset requirement, the crystal oscillator's output signal may not be used as the basis for determining the clock, that is, it may not be used as the clock signal for the first to third timers, nor as the basis for determining to proceed to step S415. The electronic device may determine the time length in other ways. The specific method by which the electronic device determines the time length is not limited in the embodiments of this application.
[0175] In the embodiments of this application, the moment of successful correction is recorded each time the crystal oscillator is restarted and the correction is successful. If the number of successful corrections within a fourth preset time period is greater than or equal to the first preset number threshold, the crystal oscillator is no longer restarted, thus avoiding damage to the crystal oscillator due to excessive restarts.
[0176] and Figure 4 Compared to the oscillator control method shown, in Figure 5 In the oscillator control method shown, step S507 can be performed after S406.
[0177] Step S507: Determine whether the number of restarts N2 of the crystal oscillator within the fifth preset time period Tp5 is greater than the second preset number threshold Np2.
[0178] If the number of restarts N2 within the fifth preset time period Tp5 exceeds the second preset threshold Np2, an alarm message can be output, and the current correction process for the crystal oscillator ends. Determine whether to proceed to step S408.
[0179] If the number of restarts N2 within the fifth preset duration Tp5 is less than or equal to the second preset threshold Np2, steps S408 to S410 and step S515 can be performed.
[0180] Step S515: Record the moment when the crystal oscillator restarts.
[0181] The moment the crystal oscillator is restarted is the moment when step S408 is performed.
[0182] Based on the moment of successful correction recorded in step S515, in step S507, the number of times N2 of restarting the crystal oscillator within the fifth preset time period Tp5 can be determined.
[0183] Step S515 can be performed before or after step S409, or it can be performed simultaneously with step S409.
[0184] exist Figure 5 In the oscillator control method shown, if it is determined in S414 that the frequency deviation ΔF2 is less than the preset frequency deviation ΔFp, the current correction process for the crystal oscillator ends. If it is determined in S414 that the frequency deviation ΔF2 is greater than or equal to the preset frequency deviation ΔFp, either step S408 or step S507 can be performed.
[0185] In the embodiments of this application, the time of crystal oscillator restart is recorded each time the crystal oscillator is restarted, and the crystal oscillator is no longer restarted if the number of restarts within a fifth preset time period is greater than or equal to a second preset number threshold, so as to avoid damage to the crystal oscillator due to excessive restarts.
[0186] In progress Figure 5 During the oscillator control method shown, it is also possible to perform... Figure 4Steps S415 and S407 are shown. That is, if it is determined in step S406 that the frequency offset ΔF1 is greater than or equal to the preset frequency offset ΔFp, then step S408 is performed to restart the crystal oscillator if the number of restarts N2 within the fifth preset time period Tp5 is less than or equal to the second preset number threshold Np2, and the number of successful corrections N1 of the crystal oscillator within the fourth preset time period Tp4 is greater than the first preset number threshold Np1.
[0187] It should be understood that the above examples are provided to help those skilled in the art understand the embodiments of this application, and are not intended to limit the embodiments of this application to the specific values or scenarios illustrated. Those skilled in the art can obviously make various equivalent modifications or changes based on the above examples, and such modifications or changes also fall within the scope of the embodiments of this application.
[0188] The above text combined Figures 1 to 5 The oscillator control method of the embodiments of this application is described in detail below, and will be combined with Figure 6 The present application describes the device embodiments in detail. It should be understood that the oscillator control device in the embodiments of the present application can execute the various oscillator control methods described in the foregoing embodiments of the present application. That is, the specific working processes of the various products described below can be referred to the corresponding processes in the foregoing method embodiments.
[0189] Figure 6 This is a schematic diagram of the oscillator control device provided in the embodiments of this application.
[0190] It should be understood that the oscillator control device 600 can perform... Figures 3 to 5 The oscillator control method shown; the oscillator control device 600 includes: an acquisition unit 610 and a control unit 620.
[0191] The acquisition unit 610 is used to acquire a first frequency deviation when the oscillator is operating stably, wherein the first frequency deviation represents the difference between the output frequency of the output signal of the oscillator and a preset reference frequency.
[0192] The control unit 620 is used to control the oscillator to restart when the first frequency deviation is greater than or equal to a preset frequency deviation.
[0193] Optionally, the acquisition unit 610 is further configured to acquire the state parameters output by the oscillator, the state parameters being used to indicate whether the oscillator is operating stably.
[0194] The acquisition unit 610 is further configured to, when the state parameter indicates that the oscillator is operating stably, acquire the frequency parameter output by the oscillator, wherein the frequency parameter indicates the output frequency when the state parameter indicates that the oscillator is operating stably.
[0195] Optionally, the acquisition unit 610 is further configured to, when the state parameter indicates that the oscillator is not operating stably, acquire the state parameter again after acquiring the state parameter and a first preset time has elapsed.
[0196] Optionally, the oscillator is located in an electronic device.
[0197] The acquisition unit 610 is further configured to acquire the first frequency offset after the electronic device is started and a second preset time has elapsed.
[0198] Optionally, the first frequency offset is acquired at a first moment, and the first frequency offset represents the difference between the first output frequency of the oscillator's output signal at the first moment and a preset reference frequency.
[0199] The acquisition unit 610 is further configured to acquire a second frequency offset at a second moment after the oscillator restarts and the oscillator is running stably, the second frequency offset representing 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 also configured to control the oscillator to restart again if the second frequency deviation is greater than or equal to the preset frequency deviation.
[0201] Optionally, the acquisition unit 610 is specifically used to detect whether the oscillator is operating stably after the oscillator is restarted and a third preset time has elapsed.
[0202] The acquisition unit 610 is specifically used to acquire the second frequency offset when the oscillator is operating stably.
[0203] Optionally, the oscillator is located in an electronic device, and the first frequency offset is obtained at the first moment after the electronic device is started without being restarted. The first frequency offset represents the difference between the first output frequency of the oscillator's output signal at the first moment and a preset reference frequency.
[0204] The control unit 620 is specifically configured to control the oscillator to restart when the number of successful corrections within a fourth preset time period is less than a first preset threshold number. The number of successful corrections represents the number of times the second frequency deviation is less than the preset frequency deviation during multiple restarts of the oscillator within the fourth preset time period. The second frequency deviation is obtained at a second moment after the oscillator restarts and when the oscillator is running 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.
[0205] Optionally, the control unit 620 is specifically configured to control the oscillator to restart, including: controlling the oscillator to restart if the number of times the oscillator restarts within a fifth preset time period is less than a second preset number threshold.
[0206] Optionally, the oscillator is a crystal oscillator.
[0207] It should be noted that the aforementioned oscillator control device 600 is embodied in the form of a functional unit. The term "unit" here can be implemented in software and / or hardware, without specific limitations.
[0208] For example, a "unit" can be a software program, a hardware circuit, or a combination of both that implements the above functions. The hardware circuit may include an application-specific integrated circuit (ASIC), electronic circuitry, a processor (e.g., a shared processor, a proprietary processor, or a group processor) and memory for executing one or more software or firmware programs, integrated logic circuitry, and / or other suitable components that support the described functions.
[0209] Therefore, the units of the various examples described in the embodiments of this application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0210] This application provides a chip including one or more processors, which can support the oscillator control method in the chip implementation method embodiments. The processor can be a general-purpose processor or a special-purpose 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] A processor can be used to control a chip, execute software programs, and process data from those programs.
[0212] The chip may include a communication interface. The chip may also include input and / or output circuitry. The chip may be disposed within an electronic device as a component of the device. The processor can read programs or instructions stored in memory via 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 storing programs that can be executed by a processor to generate instructions that cause the processor to execute the oscillator control method described in the above method embodiments.
[0214] Optionally, the memory may also store data. Optionally, the processor may also read data stored in the memory, which may be stored at the same memory address as the program, or the data may be stored at a different memory address than the program.
[0215] Processors and memory can be configured separately or integrated together; for example, integrated on a system-on-chip (SOC) in a terminal device.
[0216] For example, the memory can be used to store the relevant program of the oscillator control method provided in the embodiments of this 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 this application; for example, when the oscillator is running stably, a first frequency deviation is obtained, the first frequency deviation representing the difference between the output frequency of the output signal of the oscillator and a preset reference frequency; when the first frequency deviation is greater than or equal to the preset frequency deviation, the oscillator is controlled to restart.
[0217] It should be understood that the processor in this chip can be a central processing unit in an electronic device or other processors.
[0218] This application also provides a computer program product that, when executed by a processor, implements the oscillator control method described in any of the method embodiments of this application.
[0219] The computer program product can be stored in memory, for example, it is a program. The program is eventually converted into an executable object file that can be executed by the processor after processes such as preprocessing, compilation, assembly and linking.
[0220] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a computer, implements the oscillator control method described in any of the method embodiments of this application. The computer program may be a high-level language program or an executable object program.
[0221] The computer-readable storage medium is, for example, memory. Memory can be volatile or non-volatile, or it can include both volatile and non-volatile memory. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), which serves as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM).
[0222] The embodiments of this application may involve the use of user data. In practical applications, user-specific personal data may be used in the scheme described herein within the scope permitted by applicable laws and regulations, provided that it complies with the applicable laws and regulations of the country (e.g., with the user's explicit consent, with the user being properly notified, etc.).
[0223] In the description of this application, the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance, or a specific order or sequence. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances.
[0224] In this application, "at least one" means one or more, and "more than one" means two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or multiple items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.
[0225] It should be understood that in the various embodiments of this application, the order of the above-mentioned processes does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0226] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0227] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0228] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for example, the division of units is merely a logical functional division, and other division methods may exist in actual implementation; for example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0229] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0230] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0231] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. An oscillator control method, characterized in that, The method is applied to an electronic device, and the method includes: If the time elapsed after the electronic device is started is greater than or equal to a second preset time, and the oscillator is running stably, a first frequency offset is obtained. The second preset time is greater than or equal to the sum of the initialization time and network registration time of the electronic device. The first frequency offset represents the difference between the output frequency of the oscillator's output signal and a preset reference frequency at the first moment when the first frequency offset is obtained. The oscillator is a crystal oscillator. If the network registration of the electronic device is in a successful state, the electronic device is used to communicate with other electronic devices through the registered network. Both the network registration and the communication are performed by the electronic device based on the output signal of the oscillator. After the electronic device is started and the second preset time has elapsed, the network registration of the electronic device is in a successful state or a failed state. If the first frequency deviation is greater than or equal to the preset frequency deviation, the oscillator is controlled to restart. If the time elapsed after the restart of the oscillator is greater than or equal to the third preset time, and the oscillator is running stably, a second frequency deviation is obtained. The second frequency deviation represents the difference between the second output frequency of the oscillator's output signal and the preset reference frequency at the second moment when the second frequency deviation is obtained. The third preset time is the oscillator restart time. If the second frequency deviation is greater than or equal to the preset frequency deviation, the oscillator is restarted again.
2. The method according to claim 1, characterized in that, The method further includes: Obtain the state parameters output by the oscillator, which indicate whether the oscillator is operating stably. The step of obtaining the first frequency offset when the oscillator is operating stably includes: obtaining the frequency parameter output by the oscillator when the state parameter indicates that the oscillator is operating stably, wherein the frequency parameter represents the output frequency when the state parameter indicates that the oscillator is operating stably.
3. The method according to claim 2, characterized in that, The method further includes: If the state parameter indicates that the oscillator is not operating stably, the state parameter is acquired again after a first preset time period has elapsed.
4. The method according to any one of claims 1-3, characterized in that, The control of restarting the oscillator includes: If the number of successful corrections within the fourth preset time period is less than the first preset threshold, the oscillator is restarted. The number of successful corrections represents the number of times the oscillator's frequency deviation is less than the preset frequency deviation after restarting during the multiple restarts within the fourth preset time period. The frequency deviation of the oscillator represents the difference between the output frequency of the oscillator's output signal under stable operation and the preset reference frequency.
5. The method according to any one of claims 1-4, characterized in that, The method of controlling the oscillator to restart includes: controlling the oscillator to restart if the number of times the oscillator restarts within a fifth preset time period is less than a second preset number threshold.
6. An electronic device, characterized in that, The device includes a processor and a memory, the memory being used to store a computer program, and the processor being used to retrieve and run the computer program from the memory, causing the electronic device to perform the method of any one of claims 1 to 5.
7. A chip, characterized in that, It includes a processor and a data interface, wherein the processor reads instructions stored in memory through the data interface to execute the method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program for implementing the method of any one of claims 1 to 5.