CN111614319A - Combined crystal oscillator switching method suitable for humid environment - Google Patents

Combined crystal oscillator switching method suitable for humid environment Download PDF

Info

Publication number
CN111614319A
CN111614319A CN202010358503.1A CN202010358503A CN111614319A CN 111614319 A CN111614319 A CN 111614319A CN 202010358503 A CN202010358503 A CN 202010358503A CN 111614319 A CN111614319 A CN 111614319A
Authority
CN
China
Prior art keywords
crystal oscillator
external
equipment
internal
external crystal
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010358503.1A
Other languages
Chinese (zh)
Inventor
梁昆
黄栋
王利强
钱伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Tpson Technology Co ltd
Original Assignee
Hangzhou Tpson Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Tpson Technology Co ltd filed Critical Hangzhou Tpson Technology Co ltd
Priority to CN202010358503.1A priority Critical patent/CN111614319A/en
Publication of CN111614319A publication Critical patent/CN111614319A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03BGENERATION OF OSCILLATIONS, DIRECTLY OR BY FREQUENCY-CHANGING, BY CIRCUITS EMPLOYING ACTIVE ELEMENTS WHICH OPERATE IN A NON-SWITCHING MANNER; GENERATION OF NOISE BY SUCH CIRCUITS
    • H03B1/00Details
    • H03B1/04Reducing undesired oscillations, e.g. harmonics

Landscapes

  • Oscillators With Electromechanical Resonators (AREA)

Abstract

The invention relates to a combined crystal oscillator switching method suitable for a humid environment, which comprises the steps of detecting the working environments of an external crystal oscillator and an internal crystal oscillator by stages through an apparatus by arranging the external crystal oscillator and the internal crystal oscillator which are parallel, and switching the external crystal oscillator and the internal crystal oscillator based on the actual conditions of the working environments, so that the external crystal oscillator and the internal crystal oscillator can normally work and work under the optimal conditions. The invention solves a series of problems of abnormal clock, continuous reset, fast power consumption, crash and the like of the current equipment caused by the failure of the external crystal oscillator in a humid environment, not only ensures the stable operation of the equipment, but also improves the accuracy of the clock in operation.

Description

Combined crystal oscillator switching method suitable for humid environment
Technical Field
The invention relates to the technical field of basic electronic circuits, in particular to a combined crystal oscillator switching method suitable for a humid environment.
Background
Quartz crystal oscillators are high precision and high stability oscillators widely used in various oscillating circuits such as color televisions, computers, remote controllers, and the like, and in communication systems for frequency generators, generating clock signals for data processing equipment, providing reference signals for specific systems, and the like.
Currently, most MCU processors adopt an external crystal oscillator as a clock crystal oscillation source, when the equipment is installed outdoors or in a humid environment, the inside of the equipment is easily affected by high and low temperatures to form water vapor, so that the external crystal oscillator is affected by moisture and certain influence is generated on the operation of the equipment, in fact, if the external crystal oscillator is short-circuited under severe conditions, the MCU cannot normally operate, and particularly when the MCU is applied to safety production, safety accidents are possibly caused; specifically, the damped external crystal oscillator is prone to have the problems of no oscillation or unstable oscillation, which may cause the situations that the device cannot be awakened, the system clock fails, the program cannot run, and the like, and finally causes the phenomena of device crash, and the like, and the system runs unstably with uncertainty, and frequent restart will also shorten the service life of the system device.
Disclosure of Invention
The invention solves the problem that in the prior art, when the equipment is installed in a humid environment, the external crystal oscillator is easy to lose efficacy, so that the equipment cannot be awakened, the system clock fails, the program cannot run and the like, and finally the equipment is halted, and provides the optimized combined crystal oscillator switching method suitable for the humid environment.
The technical scheme adopted by the invention is that the combined crystal oscillator switching method is suitable for a humid environment, the combined crystal oscillator comprises an external crystal oscillator and an internal crystal oscillator, and the external crystal oscillator and the internal crystal oscillator are both matched with equipment;
the method comprises the steps that the working environments of the external crystal oscillator and the internal crystal oscillator are detected by the device in stages, and the external crystal oscillator and the internal crystal oscillator are switched.
Preferably, in the wake-up phase, the combined crystal oscillator switching method includes the following steps:
step A.1: the equipment receives a starting command;
step A.2: starting the equipment through an internal crystal oscillator, and starting a program to run;
step A.3: the equipment tries to start an external crystal oscillator, if the external crystal oscillator starts oscillation, crystal oscillator switching is prepared, and if the external crystal oscillator starts oscillation, the internal crystal oscillator is kept running;
step A.4: and finishing the crystal oscillator switching.
Preferably, in the step a.3, when the external crystal oscillator starts oscillation, the internal crystal oscillator and the external crystal oscillator are adjusted to have the same frequency, the baud rate is adjusted, data generated by the internal crystal oscillator is obtained as initial data, and the external crystal oscillator data is connected after the initial data.
Preferably, in the equipment operation stage, a clock safety system is started;
the combined crystal oscillator is switched by the clock security system.
Preferably, switching the combined crystal oscillator with the clock security system comprises the steps of:
step B.1: in the operation of the equipment, if the clock safety system detects that the external crystal oscillator is abnormal, the next step is carried out, otherwise, the step B.1 is repeated;
step B.2: switching the crystal oscillator to switch the external crystal oscillator into the internal crystal oscillator;
step B.3: the equipment tries to recover the external crystal oscillator, if the external crystal oscillator recovers, the next step is carried out, otherwise, the operation of the internal crystal oscillator is kept, and the step B.3 is repeated or ended;
step B.4: preparing to switch crystal oscillators;
step B.5: and C, finishing crystal oscillator switching and returning to the step B.1.
Preferably, in the step b.3, the device detects the external crystal oscillator by using the clock security system at preset time intervals.
Preferably, in the step b.4, the frequency of the internal crystal oscillator is adjusted to be consistent with that of the external crystal oscillator, the baud rate is adjusted, data generated by the internal crystal oscillator is acquired as transition data, and new external crystal oscillator data is connected after the transition data.
Preferably, the clock security system is cooperatively provided with a forcing unit for forcing the device to restart when a crash exception occurs in the program.
Preferably, when the device is in a sleep state, the clock security system fails, and if the external crystal oscillator is abnormal and the device cannot be waken up, the forcing unit is triggered to restart the device.
The invention relates to an optimized combined crystal oscillator switching method suitable for a humid environment, which comprises the steps of detecting the working environments of an external crystal oscillator and an internal crystal oscillator by stages through an apparatus by arranging the external crystal oscillator and the internal crystal oscillator which are parallel, and switching the external crystal oscillator and the internal crystal oscillator based on the actual conditions of the working environments, so that the external crystal oscillator and the internal crystal oscillator can work normally and work under the optimal conditions.
The invention solves a series of problems of abnormal clock, continuous reset, fast power consumption, crash and the like of the current equipment caused by the failure of the external crystal oscillator in a humid environment, not only ensures the stable operation of the equipment, but also improves the accuracy of the clock in operation.
Detailed Description
The present invention is described in further detail with reference to the following examples, but the scope of the present invention is not limited thereto.
The invention relates to a combined crystal oscillator switching method suitable for a humid environment, wherein the combined crystal oscillator comprises an external crystal oscillator and an internal crystal oscillator, and the external crystal oscillator and the internal crystal oscillator are both matched with equipment;
the method comprises the steps that the working environments of the external crystal oscillator and the internal crystal oscillator are detected by the device in stages, and the external crystal oscillator and the internal crystal oscillator are switched.
In the invention, the external crystal oscillator and the internal crystal oscillator are simultaneously arranged and are simultaneously arranged, the working environments of the external crystal oscillator and the internal crystal oscillator are detected by stages by the equipment, and the external crystal oscillator and the internal crystal oscillator are switched based on the actual condition of the working environment.
The invention ensures the stable operation of the equipment and also improves the accuracy of the running clock, adopts a mode of combining the internal crystal oscillator and the external crystal oscillator as the crystal oscillator source of the processor, adopts the external crystal oscillator to improve the operation accuracy of the system under normal conditions, and intelligently switches the internal crystal oscillator to ensure the stable operation and the reliability of the system when the external crystal oscillator fails.
In the invention, the equipment mainly switches the combined crystal oscillator based on the wake-up stage, the running stage and the dormancy stage.
In the wake-up stage, the combined crystal oscillator switching method comprises the following steps:
step A.1: the equipment receives a starting command;
step A.2: starting the equipment through an internal crystal oscillator, and starting a program to run;
step A.3: the equipment tries to start an external crystal oscillator, if the external crystal oscillator starts oscillation, crystal oscillator switching is prepared, and if the external crystal oscillator starts oscillation, the internal crystal oscillator is kept running;
in the step A.3, when the external crystal oscillator starts oscillation, the frequency of the internal crystal oscillator is adjusted to be consistent with that of the external crystal oscillator, the baud rate is adjusted, data generated by the internal crystal oscillator are obtained to serve as initial data, and the external crystal oscillator data are connected behind the initial data.
Step A.4: and finishing the crystal oscillator switching.
In the invention, in the awakening stage, because the actual condition of the external crystal oscillator cannot be confirmed, if the external crystal oscillator is in a humid environment, the internal crystal oscillator is started firstly, after the program runs, whether the current external crystal oscillator starts oscillation or not is identified, and the crystal oscillator is switched when the selection is based on the result.
In the invention, before the crystal oscillator is switched, the internal crystal oscillator and the external crystal oscillator need to be adjusted to be consistent, so that the conditions of data continuity, code disorder and the like are ensured.
In the equipment operation stage, starting a clock safety system;
the combined crystal oscillator is switched by the clock security system.
The clock safety system is matched with a forcing unit which is used for forcing the equipment to be restarted when a crash exception occurs in a program.
When the equipment is in a dormant state, the clock safety system fails in function, and if the external crystal oscillator is abnormal and the equipment cannot be awakened, the forced unit is triggered to restart the equipment.
In the invention, after the equipment runs, a clock safety system is started, whether an external crystal oscillator is invalid or not is detected when the equipment runs normally, and meanwhile, the equipment is forcibly restarted when a program is in a halt abnormal state; when the clock safety system detects that the external crystal oscillator is abnormal in the running process of the program, the relative system clock is switched to the internal crystal oscillator, the external crystal oscillator state is sniffed at regular intervals, and the external crystal oscillator is switched to the external crystal oscillator again after being recovered; when the program is in the dormancy process, the clock safety system function is invalid, and the equipment can not be awakened after the external crystal oscillator is abnormal, and at the moment, the equipment is restarted and starts from the awakening stage.
The switching of the combined crystal oscillator by the clock security system comprises the following steps:
step B.1: in the operation of the equipment, if the clock safety system detects that the external crystal oscillator is abnormal, the next step is carried out, otherwise, the step B.1 is repeated;
step B.2: switching the crystal oscillator to switch the external crystal oscillator into the internal crystal oscillator;
step B.3: the equipment tries to recover the external crystal oscillator, if the external crystal oscillator recovers, the next step is carried out, otherwise, the operation of the internal crystal oscillator is kept, and the step B.3 is repeated or ended;
and in the step B.3, the equipment detects the external crystal oscillator by the clock safety system at preset time intervals.
Step B.4: preparing to switch crystal oscillators;
and in the step B.4, adjusting the frequency of the internal crystal oscillator to be consistent with that of the external crystal oscillator, adjusting the baud rate, acquiring data generated by the internal crystal oscillator as transition data, and connecting new external crystal oscillator data after the transition data.
Step B.5: and C, finishing crystal oscillator switching and returning to the step B.1.
In the invention, before the crystal oscillator is switched, the internal crystal oscillator and the external crystal oscillator need to be adjusted to be consistent, and the data generated by the internal crystal oscillator is used as transition data, so that the conditions of data continuity, code disorder and the like are ensured.
The external crystal oscillator and the internal crystal oscillator are arranged in parallel, the working environments of the external crystal oscillator and the internal crystal oscillator are detected by the equipment in stages, and the external crystal oscillator and the internal crystal oscillator are switched based on the actual conditions of the working environments, so that the external crystal oscillator and the internal crystal oscillator can work normally and work under the optimal condition. The invention solves a series of problems of abnormal clock, continuous reset, fast power consumption, crash and the like of the current equipment caused by the failure of the external crystal oscillator in a humid environment, not only ensures the stable operation of the equipment, but also improves the accuracy of the clock in operation.

Claims (9)

1. A combined crystal oscillator switching method suitable for a humid environment is characterized in that: the combined crystal oscillator comprises an external crystal oscillator and an internal crystal oscillator, and the external crystal oscillator and the internal crystal oscillator are both matched with equipment;
the method comprises the steps that the working environments of the external crystal oscillator and the internal crystal oscillator are detected by the device in stages, and the external crystal oscillator and the internal crystal oscillator are switched.
2. The method according to claim 1, wherein the crystal oscillator switching method comprises: in the wake-up stage, the combined crystal oscillator switching method comprises the following steps:
step A.1: the equipment receives a starting command;
step A.2: starting the equipment through an internal crystal oscillator, and starting a program to run;
step A.3: the equipment tries to start an external crystal oscillator, if the external crystal oscillator starts oscillation, crystal oscillator switching is prepared, and if the external crystal oscillator starts oscillation, the internal crystal oscillator is kept running;
step A.4: and finishing the crystal oscillator switching.
3. The method according to claim 2, wherein the crystal oscillator switching circuit comprises: in the step A.3, when the external crystal oscillator starts oscillation, the frequency of the internal crystal oscillator is adjusted to be consistent with that of the external crystal oscillator, the baud rate is adjusted, data generated by the internal crystal oscillator are obtained to serve as initial data, and the external crystal oscillator data are connected behind the initial data.
4. The method according to claim 1, wherein the crystal oscillator switching method comprises: in the equipment operation stage, starting a clock safety system;
the combined crystal oscillator is switched by the clock security system.
5. The method according to claim 4, wherein the crystal oscillator switching circuit comprises: the switching of the combined crystal oscillator by the clock security system comprises the following steps:
step B.1: in the operation of the equipment, if the clock safety system detects that the external crystal oscillator is abnormal, the next step is carried out, otherwise, the step B.1 is repeated;
step B.2: switching the crystal oscillator to switch the external crystal oscillator into the internal crystal oscillator;
step B.3: the equipment tries to recover the external crystal oscillator, if the external crystal oscillator recovers, the next step is carried out, otherwise, the operation of the internal crystal oscillator is kept, and the step B.3 is repeated or ended;
step B.4: preparing to switch crystal oscillators;
step B.5: and C, finishing crystal oscillator switching and returning to the step B.1.
6. The method according to claim 5, wherein the crystal oscillator switching circuit comprises: and in the step B.3, the equipment detects the external crystal oscillator by the clock safety system at preset time intervals.
7. The method according to claim 5, wherein the crystal oscillator switching circuit comprises: and in the step B.4, adjusting the frequency of the internal crystal oscillator to be consistent with that of the external crystal oscillator, adjusting the baud rate, acquiring data generated by the internal crystal oscillator as transition data, and connecting new external crystal oscillator data after the transition data.
8. The method according to claim 4, wherein the crystal oscillator switching circuit comprises: the clock safety system is matched with a forcing unit which is used for forcing the equipment to be restarted when a crash exception occurs in a program.
9. The integrated crystal oscillator switching method suitable for use in a humid environment according to claim 8, wherein: when the equipment is in a dormant state, the clock safety system fails in function, and if the external crystal oscillator is abnormal and the equipment cannot be awakened, the forced unit is triggered to restart the equipment.
CN202010358503.1A 2020-04-29 2020-04-29 Combined crystal oscillator switching method suitable for humid environment Pending CN111614319A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010358503.1A CN111614319A (en) 2020-04-29 2020-04-29 Combined crystal oscillator switching method suitable for humid environment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010358503.1A CN111614319A (en) 2020-04-29 2020-04-29 Combined crystal oscillator switching method suitable for humid environment

Publications (1)

Publication Number Publication Date
CN111614319A true CN111614319A (en) 2020-09-01

Family

ID=72205644

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010358503.1A Pending CN111614319A (en) 2020-04-29 2020-04-29 Combined crystal oscillator switching method suitable for humid environment

Country Status (1)

Country Link
CN (1) CN111614319A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6970045B1 (en) * 2003-06-25 2005-11-29 Nel Frequency Controls, Inc. Redundant clock module
CN1713527A (en) * 2004-06-24 2005-12-28 华为技术有限公司 Crystal oscillation duplicaltion and its duplicating circuit
CN103399808A (en) * 2013-06-06 2013-11-20 北京航天自动控制研究所 Method for achieving crystal oscillator dual redundancy in flight control computer
CN105404374A (en) * 2015-11-06 2016-03-16 中国电子科技集团公司第四十四研究所 In-chip reset system and reset method for system-on-chip chip
CN105677518A (en) * 2016-02-05 2016-06-15 福建师范大学 Redundancy control method of clock signal in embedded system
CN110257794A (en) * 2019-07-05 2019-09-20 佛山王氏航空光学科技有限公司 For crystal-vibration-chip automatic switching control equipment in the furnace of coating machine
CN110262305A (en) * 2019-04-29 2019-09-20 东风商用车有限公司 A kind of ECU crystal oscillator application method

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6970045B1 (en) * 2003-06-25 2005-11-29 Nel Frequency Controls, Inc. Redundant clock module
CN1713527A (en) * 2004-06-24 2005-12-28 华为技术有限公司 Crystal oscillation duplicaltion and its duplicating circuit
CN103399808A (en) * 2013-06-06 2013-11-20 北京航天自动控制研究所 Method for achieving crystal oscillator dual redundancy in flight control computer
CN105404374A (en) * 2015-11-06 2016-03-16 中国电子科技集团公司第四十四研究所 In-chip reset system and reset method for system-on-chip chip
CN105677518A (en) * 2016-02-05 2016-06-15 福建师范大学 Redundancy control method of clock signal in embedded system
CN110262305A (en) * 2019-04-29 2019-09-20 东风商用车有限公司 A kind of ECU crystal oscillator application method
CN110257794A (en) * 2019-07-05 2019-09-20 佛山王氏航空光学科技有限公司 For crystal-vibration-chip automatic switching control equipment in the furnace of coating machine

Similar Documents

Publication Publication Date Title
CN101155355A (en) Control method, device and equipment for sleeping mode of user's set
JP4481495B2 (en) Low power clock synchronization in wireless communication devices
CN110424831B (en) Low-power consumption intelligence lock
CN110569148A (en) system and method for realizing automatic restart recovery of dead halt of RK3399 mainboard
CN102163071A (en) Control circuit and power control method during reset thereof
US20170289075A1 (en) Method and Device for Managing Instant Communication Application Program, and Mobile Terminal thereof
CN104977979A (en) Clock source switching method and clock source switching system
CN101360290A (en) Method and terminal implementing timed startup of terminal
CN111614319A (en) Combined crystal oscillator switching method suitable for humid environment
US6996732B2 (en) Method of and apparatus for achieving “watch dog” functions in microcontrollers and microcomputers and the like, required to shut down for extended periods of time for energy-conservation purposes
CN110750374A (en) Watchdog circuit and control method thereof
US8498240B2 (en) Resynchronization method for recovering from sleep mode and apparatuses using the same
JP2011059930A (en) Power supply unit
US6304979B1 (en) Logic to enable/disable a clock generator in a secure way
CN103455448A (en) Shake resisting method and system for server
US6357012B1 (en) Microcontroller with auto-alarm device
US10820046B2 (en) System and method for detecting the removal of a controlling device
JP2003125312A (en) Power consumption controller under stand-by state
US7010709B2 (en) Information processing device
CN101452337A (en) Control method and device for peripheral equipment
CN105528241A (en) Electronic device and wake-up method for operation system of same
CN213092296U (en) Electronic equipment abnormity recovery device and electronic equipment
CN108334358B (en) Notebook computer system restart control method based on EC single chip microcomputer
WO2023141813A1 (en) Scheduled startup control method and electronic device
CN111836275A (en) Method for monitoring wireless communication module by adopting WDT of MCU

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200901