Clock switching circuit
By designing a clock switching circuit for digital-to-analog hybrid electronic system, it is possible to automatically switch to the secondary clock signal after the main clock signal is lost and switch back to the main clock signal after recovery, solving the low manual switching efficiency in the prior art The problem is to ensure the system is operating normally and simplify the circuit structure and area occupation.
Patent Information
- Application Number
- CN202411152978.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2024-11-29
AI Technical Summary
When the main input clock signal is lost, the existing digital-to-analog hybrid electronic system needs to manually switch the clock signal, which is inefficient and cannot guarantee the best switching time, resulting in the system functional module not working normally.
Design a clock switching circuit, including a clock output module and a signal control module, and perform state detection of the main clock signal through the signal control module, generate control signals, and automatically switch the output of the main clock signal and the secondary clock signal according to the detection results to ensure that When the main clock signal is lost, switch to the secondary clock signal and switch back to the main clock signal after recovery.
It realizes automatic switching to the secondary clock signal after the main clock signal is lost, and automatically switch back to the main clock signal after recovery, avoiding system paralysis caused by the loss of clock signal, and the circuit structure is simple and the area occupied is small.
Smart Images

Figure CN119051636A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to an analog integrated circuit, and in particular to a clock switching circuit. Background Art
[0002] With the development and progress of science and technology, digital-analog hybrid electronic systems have been applied to equipment in various industries. Digital-analog hybrid electronic systems often synchronize the operation of various circuit elements through clock signals. At present, many digital-analog hybrid electronic systems have two clock sources. During the operation of digital-analog hybrid electronic systems, communication link failures or equipment failures may occur. For example, equipment failures and other reasons may cause the input main input clock source signal to be lost. When the main input clock signal is lost, the subsequent system function modules cannot work normally, and the system clock needs to be switched to another clock source. In actual operation, if the abnormality of the main input clock signal is detected by the technician, the technician will manually switch the system clock signal to another clock source immediately after detection. However, manual switching of the clock signal is not only inefficient, but the staff cannot guarantee that the switching time of the clock signal is optimal each time.
[0003] Therefore, how to provide a clock switching circuit with short main input clock switching time and high efficiency is a technical problem that urgently needs to be solved. Summary of the invention
[0004] In view of the above-mentioned shortcomings of the prior art, the present invention provides a clock switching circuit to solve at least one of the above-mentioned technical problems.
[0005] In order to achieve the above-mentioned purpose and other related purposes, the technical solution provided by this application is as follows.
[0006] The present application provides a clock switching circuit, comprising:
[0007] A clock output module switches and outputs a primary clock signal and a secondary clock signal based on a control signal;
[0008] A signal control module, performing state detection on the master clock signal, and generating the control signal according to the detection result;
[0009] When the detection result is that the main clock signal is lost, the signal control module outputs a control signal of the first state, and the clock output module outputs the secondary clock signal according to the control signal of the first state; when the detection result changes from lost to existing, the signal control module outputs a control signal of the second state, and the clock output module outputs the main clock signal according to the control signal of the second state.
[0010] In one embodiment of the present invention, the signal control module includes a main clock detection unit, a main clock state monitoring unit, a main clock recovery unit, a latch and a signal output unit, the main clock detection unit performs state detection on the main clock signal to obtain a pulse signal; the main clock state monitoring unit monitors whether the main clock signal is lost based on the secondary clock signal and the pulse signal, and the main clock recovery unit determines the change of the main clock signal based on the reset signal and the main clock signal; the latch stores the state of the main clock signal according to the signal output by the main clock state monitoring unit and the signal output by the main clock recovery unit; the signal output unit controls the working mode of the clock switching circuit based on the mode selection signal, and when the clock switching circuit is in the intelligent switching mode, the signal latched by the latch is output to obtain the control signal.
[0011] In one embodiment of the present invention, the master clock detection unit includes a first NOT gate, a second NOT gate, a third NOT gate, a first delay, a second delay, a first NAND gate, a second NAND gate, a first AND gate, and a second AND gate; the output end of the first NOT gate is connected to the first input end of the first NAND gate via the first delay and the second NOT gate, the output end of the first NOT gate is also connected to the second input end of the first NAND gate, the output end of the first NAND gate is connected to the first input end of the first AND gate, the input end of the first NOT gate is connected to the first input end of the second NAND gate via the second delay and the third NOT gate, the input end of the first NOT gate is also connected to the second input end of the second NAND gate, the output end of the second NAND gate is connected to the first input end of the second AND gate, the second input end of the second AND gate is connected to the mode selection signal, and the output end of the second AND gate is connected to the second input end of the first AND gate, wherein the input end of the first NOT gate is connected to the master clock signal, and the first AND gate outputs the pulse signal.
[0012] In one embodiment of the present invention, the main clock state monitoring unit includes a first trigger and a second trigger, the input end of the first trigger is connected to the power supply voltage, the output end of the first trigger is connected to the input end of the second trigger, wherein the clock signal input end of the first trigger and the clock signal input end of the second trigger are connected to the secondary clock signal, the reset end of the first trigger and the reset end of the second trigger are connected to the pulse signal, and the positive phase output end of the second trigger is the output end of the main clock state monitoring unit.
[0013] In one embodiment of the present invention, the master clock recovery unit includes N third flip-flops and a fourth NOT gate, the inverting output end of the i-th third flip-flop is connected to the input end of the i-th third flip-flop, the inverting output end of the i-th third flip-flop is also connected to the clock signal input end of the i+1-th third flip-flop, the positive output end of the N-th third flip-flop is connected to the input end of the fourth NOT gate, wherein the clock signal input end of the first third flip-flop is connected to the master clock signal, the reset ends of the N third flip-flops are connected to the reset signal, and the output end of the fourth NOT gate is the output end of the master clock recovery unit.
[0014] In one embodiment of the present invention, the latch includes a fifth NOT gate, a third NAND gate and a fourth NAND gate, the output end of the fifth NOT gate is connected to the first input end of the third NAND gate, the output end of the third NAND gate is connected to the first input end of the fourth NAND gate, the second input end of the fourth NAND gate is connected to the mode selection signal, and the output end of the fourth NAND gate is connected to the second input end of the third NAND gate, wherein the input end of the fifth NOT gate and the third input end of the fourth NAND gate are the input ends of the latch, and the output end of the third NAND gate is the output end of the latch.
[0015] In one embodiment of the present invention, the signal output unit includes a sixth NOT gate, a seventh NOT gate, an eighth NOT gate and a two-to-one multiplexer, the output end of the sixth NOT gate is connected to the first input end of the two-to-one multiplexer via the seventh NOT gate and the eighth NOT gate, wherein the input end of the sixth NOT gate is the input end of the signal output unit, the output end of the seventh NOT gate outputs the reset signal, the second input end of the two-to-one multiplexer is connected to a manual input signal, the selection end of the two-to-one multiplexer is connected to the mode selection signal, and the output end of the two-to-one multiplexer outputs the control signal to the outside.
[0016] In one embodiment of the present invention, the clock output module includes a first XOR gate, a second XOR gate, a third XOR gate and a ninth NOT gate, the output end of the first XOR gate is connected to the first input end of the third XOR gate, the output end of the ninth NOT gate is connected to the first input end of the second XOR gate, the output end of the second XOR gate is connected to the second input end of the third XOR gate, wherein the second input end of the first XOR gate is connected to the control signal, the input end of the ninth NOT gate is connected to the control signal, the second input end of the second XOR gate is connected to the main clock signal, the first input end of the first XOR gate is connected to the secondary clock signal, and the output end of the third XOR gate is the output end of the clock output module.
[0017] The present application provides a clock switching circuit, which includes a clock output module and a signal control module. The signal control module detects the state of the main clock signal and generates control signals of different states according to the detection result. The clock output module automatically switches and outputs the main clock signal and the secondary clock signal according to the control signals of different states. When the main clock signal is abnormal, the secondary clock signal is output, and when the main clock signal returns to normal, the secondary clock signal is switched to the main clock signal. The clock switching circuit provided by the present application can automatically switch to the secondary clock signal after the main clock signal is lost, and automatically switch back to the main clock signal when the main clock signal is restored, which can avoid the adverse effect of circuit system paralysis caused by the loss of the main clock signal, and the circuit structure is simple and occupies a small area.
[0018] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present invention, and together with the specification, are used to explain the principles of the present invention. Obviously, the drawings described below are only some embodiments of the present invention, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0020] Figure 1 is a block diagram of a clock switching circuit according to an exemplary embodiment of the present invention;
[0021] Figure 2 is a specific circuit structure of a clock switching circuit shown in an exemplary embodiment of the present invention;
[0022] Figure 3 is a timing diagram showing that a master clock detection unit delays two signals according to an exemplary embodiment of the present invention;
[0023] Figure 4 is a timing diagram of pulse signal generation shown in an exemplary embodiment of the present invention;
[0024] Figure 5 is a timing diagram of master clock state monitoring unit sampling shown in an exemplary embodiment of the present invention;
[0025] Figure 6 is a timing diagram showing a normal operation of a master clock recovery unit according to an exemplary embodiment of the present invention.
[0026] Reference numerals: 110 - clock output module, 210 - master clock detection unit, 220 - master clock state monitoring unit, 230 - master clock recovery unit, 240 - latch, 250 - signal output unit. DETAILED DESCRIPTION
[0027] The following will describe the embodiments of the present invention with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be understood that the preferred embodiments are only for illustrating the present invention, not for limiting the scope of protection of the present invention.
[0028] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0029] In the following description, numerous details are discussed to provide a more thorough explanation of the embodiments of the present invention. However, it is obvious to those skilled in the art that the embodiments of the present invention can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present invention difficult to understand.
[0030] With the development and progress of science and technology, digital-analog hybrid electronic systems have been applied to equipment in various industries. Digital-analog hybrid electronic systems often synchronize the operation of various circuit elements through clock signals. At present, many digital-analog hybrid electronic systems have two clock sources. During the operation of digital-analog hybrid electronic systems, communication link failures or equipment failures may occur. For example, equipment failures and other reasons may cause the input main input clock source signal to be lost. When the main input clock signal is lost, the subsequent system function modules cannot work normally, and the system clock needs to be switched to another clock source. In actual operation, if the abnormality of the main input clock signal is detected by the technician, the technician will manually switch the system clock signal to another clock source immediately after detection. However, manual switching of the clock signal is not only inefficient, but the staff cannot guarantee that the switching time of the clock signal is optimal each time.
[0031] To solve the above problems, Figure 1 As shown, the present application provides a clock switching circuit, comprising:
[0032] A clock output module switches and outputs the main clock signal P1 and the secondary clock signal P2 based on the control signal A;
[0033] The signal control module detects the state of the main clock signal P1 and generates a control signal A according to the detection result;
[0034] When the detection result is that the main clock signal P1 is lost, the signal control module outputs a control signal A in the first state, and the clock output module outputs a secondary clock signal P2 according to the control signal in the first state; when the detection result changes from lost to existing, the signal control module outputs a control signal A in the second state, and the clock output module outputs the main clock signal P1 according to the control signal A in the second state.
[0035] It should be noted that the control signal in the first state is a control signal at a low level, and the control signal in the second state is a control signal at a high level.
[0036] In detail, Figure 2 As shown, the signal control module includes a main clock detection unit 210, a main clock state monitoring unit 220, a main clock recovery unit 230, a latch 240 and a signal output unit 250. The main clock detection unit 210 performs state detection on the main clock signal P1 to obtain a pulse signal PWM; the main clock state monitoring unit monitors whether the main clock signal P1 is lost based on the secondary clock signal P2 and the pulse signal PWM, and the main clock recovery unit 230 determines the change of the main clock signal P1 based on the reset signal RST and the main clock signal P1; the latch 240 stores the state of the main clock signal P1 according to the signal output by the main clock state monitoring unit and the signal output by the main clock recovery unit 230; the signal output unit 250 controls the working mode of the clock switching circuit based on the mode selection signal C. When the clock switching circuit is in the intelligent switching mode, the signal stored in the latch 240 is output to obtain the control signal A.
[0037] In more detail, Figure 2As shown, the master clock detection unit 210 includes a first NOT gate NOT1, a second NOT gate NOT2, a third NOT gate NOT3, a first delay Buf1, a second delay Buf2, a first NAND gate NAND1, a second NAND gate NAND2, a first AND gate AND1, and a second AND gate AND2; the output end of the first NOT gate NOT1 is connected to the first input end of the first NAND gate NAND1 after passing through the first delay Buf1 and the second NOT gate NOT2, the output end of the first NOT gate NOT1 is also connected to the second input end of the first NAND gate NAND1, and the output end of the first NAND gate NAND1 is connected to the first input end of the first AND gate AND1 An input end, an input end of the first NOT gate NOT1 is connected to the first input end of the second NAND gate NAND2 after passing through the second delay device Buf2 and the third NOT gate NOT3, the input end of the first NOT gate NOT1 is also connected to the second input end of the second NAND gate NAND2, the output end of the second NAND gate NAND2 is connected to the first input end of the second AND gate AND2, the second input end of the second AND gate AND2 is connected to the mode selection signal C, the output end of the second AND gate AND2 is connected to the second input end of the first AND gate AND1, wherein the input end of the first NOT gate NOT1 is connected to the main clock signal P1, and the first AND gate AND1 outputs a pulse signal PWM.
[0038] In detail, Figure 2 As shown, the main clock state monitoring unit 220 includes a first trigger D1 and a second trigger D2, the input end of the first trigger D1 is connected to the power supply voltage VCC, the output end of the first trigger D1 is connected to the input end of the second trigger D2, wherein the clock signal input end of the first trigger D1 and the clock signal input end of the second trigger D2 are connected to the secondary clock signal P2, the reset end of the first trigger D1 and the reset end of the second trigger D2 are connected to the pulse signal PWM, and the positive phase output end of the second trigger D2 is the output end of the main clock state monitoring unit.
[0039] In more detail, Figure 2 As shown, the master clock recovery unit 230 includes N third flip-flops (D31~D3N) and a fourth NOT gate NOT4, the inverting output terminal of the i-th third flip-flop D3i is connected to the input terminal of the i-th third flip-flop D3i, the inverting output terminal of the i-th third flip-flop D3i is also connected to the clock signal input terminal of the i+1-th third flip-flop D3(i+1), the positive output terminal of the N-th third flip-flop D3N is connected to the input terminal of the fourth NOT gate NOT4, wherein the clock signal input terminal of the first third flip-flop D31 is connected to the master clock signal P1, the reset terminals of the N third flip-flops are connected to the reset signal RST, and the output terminal of the fourth NOT gate NOT4 is the output terminal of the master clock recovery unit.
[0040] In more detail, Figure 2As shown, the latch 240 includes a fifth NOT gate NOT5, a third NAND gate NAND3 and a fourth NAND gate NAND4, the output end of the fifth NOT gate NOT5 is connected to the first input end of the third NAND gate NAND3, the output end of the third NAND gate NAND3 is connected to the first input end of the fourth NAND gate NAND4, the second input end of the fourth NAND gate NAND4 is connected to the mode selection signal C, and the output end of the fourth NAND gate NAND4 is connected to the second input end of the third NAND gate NAND3, wherein the input end of the fifth NOT gate NOT5 and the third input end of the fourth NAND gate NAND4 are the input ends of the latch, the input end of the fifth NOT gate NOT5 is connected to the positive phase output end of the second trigger D2, the third input end of the fourth NAND gate NAND4 is connected to the output end of the fourth NAND gate NOT4, and the output end of the third NAND gate NAND3 is the output end of the latch.
[0041] In more detail, Figure 2 As shown, the signal output unit 250 includes a sixth NOT gate NOT6, a seventh NOT gate NOT7, an eighth NOT gate NOT8 and a two-to-one multiplexer MUX, the output end of the sixth NOT gate NOT6 is connected to the first input end of the two-to-one multiplexer MUX via the seventh NOT gate NOT7 and the eighth NOT gate NOT8, wherein the input end of the sixth NOT gate NOT6 is the input end of the signal output unit, the input end of the sixth NOT gate NOT6 is connected to the output end of the third NAND gate NAND3, the output end of the seventh NOT gate NOT7 outputs a reset signal RST, the second input end of the two-to-one multiplexer MUX is connected to a manual input signal D, the selection end of the two-to-one multiplexer MUX is connected to a mode selection signal C, and the output end of the two-to-one multiplexer MUX outputs a control signal A to the outside.
[0042] In more detail, Figure 2 As shown, the clock output module 110 includes a first XOR gate NOR1, a second XOR gate NOR2, a third XOR gate NOR3 and a ninth NOT gate NOT9, the output end of the first XOR gate NOR1 is connected to the first input end of the third XOR gate NOR3, the output end of the ninth NOT gate NOT9 is connected to the first input end of the second XOR gate NOR2, and the output end of the second XOR gate NOR2 is connected to the second input end of the third XOR gate NOR3, wherein the second input end of the first XOR gate NOR1 is connected to the control signal A, the input end of the ninth NOT gate NOT9 is connected to the control signal A, the second input end of the second XOR gate NOR2 is connected to the main clock signal P1, the first input end of the first XOR gate NOR1 is connected to the secondary clock signal P2, and the output end of the third XOR gate NOR3 is the output end of the clock output module.
[0043] like Figures 1 to 6 As shown, the working principle of the clock switching circuit provided by the present application is as follows:
[0044] The clock switching circuit provided by the present invention includes a manual switching mode and an intelligent switching mode. Figure 2 As shown, the working mode of the clock switching circuit is controlled by the mode selection signal C. When the mode selection signal C=0, the clock switching circuit is in manual switching mode. When the mode selection signal C=1, the clock switching circuit is in intelligent switching mode.
[0045] like Figure 1 As shown, the input signals of the clock output module are the main clock signal P1 and the secondary clock signal P2. The final output signal of the clock output module is determined by the control signal A, such as Figure 2 As shown, the clock output module 110, when the control signal is in the first state, that is, the control signal is at a low level, the second XOR gate NOR2 on the main clock signal transmission path is affected by the control signal A, and the output of the second XOR gate NOR2 is fixed to 1, therefore, the waveform of the main clock signal P1 cannot be transmitted, while the transmission of the secondary clock signal P2 is not affected, therefore, when the control signal A is at a low level, the clock output module 110 outputs the secondary clock signal P2 to the outside; similarly, when the control signal A is in the second state, that is, the control signal is at a high level, the first XOR gate NOR1 on the secondary clock signal P2 transmission path is affected by the control signal A, and the output of the first XOR gate NOR1 is fixed to 1, then the waveform transmission of the main clock signal P1 is not affected, and the clock output module 110 outputs the main clock signal P1 to the outside.
[0046] When the clock switching circuit is in the intelligent switching mode, that is, the mode selection signal C is 1, the clock switching circuit outputs the main clock signal P1 by default. If the main clock signal P1 is lost, it automatically switches to the secondary clock signal P2. In the intelligent switching mode, the control signal A is controlled by the signal control module.
[0047] like Figure 2 As shown, when the main clock signal P1 and the secondary clock signal P2 exist at the same time, the main clock detection unit 210 performs state detection on the main clock signal P1, such as Figure 3As shown, the master clock signal P1 is input into the master clock detection unit 210, and the master clock detection unit 210 divides the input master clock signal P1 into one signal and two signals. One signal is the signal input into the second delay device buf2, and one signal is further divided into two signals for transmission. The third NOT gate NOT3 outputs one delayed signal, and one signal and one delayed signal are input into the second NAND gate NAND2, and one output signal with a low potential pulse width of the delay time Δt is output. Similarly, the two signals are input into the first delay device Buf1 after passing through the first NOT gate NOT1, and the two signals are the signals input into the first delay device buf1, and the two signals are further divided into two signals for transmission. The second NOT gate NOT2 outputs two delayed signals, and the two signals and two delayed signals are input into the first NAND gate NAND1, and two output signals with a low potential pulse width of the delay time Δt are output. Because the mode selection signal C is equal to 1, it has no effect on the signal output by the second AND gate AND2, as shown in FIG. Figure 4 As shown, one output signal is input into the second AND gate AND2, and then the signal output from the second AND gate AND2 and the two output signals are input into the first AND gate AND1, and the first AND gate AND1 outputs a pulse signal PWM, and the low potential pulse width of the pulse signal PWM is the delay time Δt.
[0048] like Figure 2 As shown, the secondary clock signal P2 is input into the clock signal trigger end of the first trigger D1 and the clock signal input end of the second trigger D2 in the main clock state monitoring unit 220, and the pulse signal PWM is input into the reset end of the first trigger D1 and the reset end of the second trigger D2 in the main clock state monitoring unit 220, as shown in FIG. Figure 5 As shown, when the first rising edge of the secondary clock signal P2 arrives, the first trigger D1 is sampled, and the output terminal Q1 of the first trigger D1 is high level, because the output terminal Q1 of the first trigger D1 becomes 1 only after the rising edge of the secondary clock signal P2 arrives. Therefore, when the first clock edge of the clock signal P2 arrives, the second trigger D2 still samples a low level, Q2=0. Since the reset terminals of the two triggers (D1 and D2) input the pulse signal PWM, the pulse signal PWM is a frequency multiplication signal of the main clock signal P2. Therefore, when the frequency of the secondary clock signal P2 does not exceed twice the frequency of the main clock signal P1, before the next rising edge of the secondary clock signal P2 arrives, the pulse signal PWM will definitely reset the two triggers (D1 and D2), so that the output terminal Q2 of the second trigger D2 is always equal to 0.
[0049] When the output of the second flip-flop D1 is always 0, the signal output by the fifth NOT gate NOT5 is always 1. Since the default output of the clock switching circuit is the main clock signal P1, the initial state of the latch 240 defaults to the main clock signal being normal, the latch outputs a low level to the outside, and the reset signal RST is a low level. The master clock recovery unit 230 is reset by the reset signal RST, so that the positive output end of the Nth third flip-flop D3N is a low level, and the fourth NOT gate NOT4 outputs a high level.
[0050] The state of the main clock signal P1 is stored by the latch 240. The storage characteristics of the latch 240 are shown in Table 1:
[0051] Table 1 Latch characteristics
[0052] S’ R’ Q Q* 1 1 0 0 1 1 1 1 0 1 0 1 0 1 1 1 1 0 0 0 1 0 1 0 0 0 0 X 0 0 1 X
[0053] In Table 1, S' is the level signal of the output end of the fifth NOT gate NOT5, R' is the level signal of the output end of the fourth NOT gate NOT4, Q is the output result of the latch at the moment, and Q* is the output result of the latch at the next moment. When S'=1, R'=1, the latch 240 maintains the original state, that is, the output end of the third NAND gate NAND3 is low level, the reset signal RST is also low level, then the control signal A is high level, and the clock output module 110 outputs the main clock signal P1 to the outside according to the control of the high level control signal A.
[0054] When the master clock signal is lost P1, the pulse signal PWM of the master clock detection unit 210 does not exist. Since there is no pulse signal PWM to reset the first trigger D1 and the second trigger D2, the second trigger D2 in the master clock state monitoring unit 220 samples and outputs a high level, and the fifth NOT gate NOT5 outputs a low level. If the master clock recovery unit 230 includes three third triggers (D31, D32, D33), there is no master clock signal P1 to sample and trigger the master clock recovery unit 230, so the output signal of the master clock recovery unit 230 maintains the original state, and the output of the master clock recovery unit 230 is a high level. It can be seen from Table 1 that when S'=0, R'=1, the output result of the latch 240 is a high level, that is, the output end of the third NAND gate NAND3 is a high level, and the reset signal RST is also a high level, then the control signal A is a low level, and the clock output module 110 outputs the secondary clock signal P2 to the outside according to the control of the low-level control signal A.
[0055] When the master clock signal P1 is restored, it can be seen from the above process that the master clock detection unit 210 restarts to output the pulse signal PWM, and resets the first trigger D1 and the second trigger D2 in the master clock state monitoring unit 220, so that the sampling signal of the second trigger D2 remains at a low level, that is, S'=1. It can be seen from the loss of the master clock signal that at this time RST=1, the N third triggers (D31~D3N) are not reset, and work normally. If the master clock recovery unit 230 includes three third triggers (D31, D32, D33), the timing diagram of the working state of the master clock recovery unit 230 is as follows Figure 6 As shown, Q31' is the signal output from the inverting output terminal of the first third flip-flop D31, Q32' is the signal output from the inverting output terminal of the second third flip-flop D32, Q33' is the signal output from the output terminal of the third third flip-flop and then passes through the fourth NOT gate NOT4, Q31', Q32', Q33' are the results of the master clock signal divided by two, four, and eight respectively. However, when the low level of the third third flip-flop D33 arrives, R'=0. As can be seen from Table 1, when S'=1, R'=0, the output state of the latch 240 is locked at 0, at this time RST=0, and the N third flip-flops (D31~D3N) are reset, so that the output terminal R' of the fourth NOT gate NOT4 in the master clock recovery unit 230 becomes 1. As can be seen from Table 1, when S'=1, R'=1, the latch 240 maintains its original state, so RST=0, the control signal A is high level, and the clock output module 110 outputs the main clock signal P1 according to the control of the control signal A.
[0056] After the master clock signal P1 is recovered, the clock output module 110 inputs two clock signals. In addition to reflecting the state of the master clock, the multiple third triggers of the master clock recovery unit 230 also have another function: after the master clock signal is recovered, the moment when R'=0 arrives is after the moment when S'=1 arrives, so as to avoid the state where S' and R' are both equal to 0. If S' and R' are both equal to 0, it will make it difficult to determine the next state of the register 240, that is, the X state will appear, and the circuit will be unstable.
[0057] It should be noted that the frequency difference between the main clock signal P1 and the secondary clock signal P2 cannot be too large. If the secondary clock frequency exceeds twice the main clock frequency, the main clock state monitoring unit 220 cannot work normally. If the secondary clock frequency is too low, during the recovery process of the main clock signal P1, the moment when R'=0 arrives will be before the moment when S'=1 arrives, and S' and R' will be equal to 0 at the same time, making it difficult to determine the next state of the register 240. The delay time Δt depends on the specific operating frequency and cannot be too large, exceeding half a cycle of the main clock signal.
[0058] When the clock switching circuit is in manual switching mode, that is, C=0, the two-to-one selector MUX selects the first input terminal, that is, A=D. When the external input manual control signal D=0, the clock output module selects the secondary clock signal P2, and D=1, the clock output module selects the main clock signal P1. In addition, when C=0, the result of the clock detection unit 210 is always 0, and D1 and D2 are always reset, so that the second trigger D2 outputs 0, the fifth NOT gate NOT5 outputs a high level, and the fourth NAND gate NAND4 in the latch 240 outputs 1 because the mode selection signal is low, and S'=1, and finally the latch outputs a low level to the outside, that is, RST=0, and the main clock recovery unit 230 is in a reset state. Therefore, in the manual mode, each unit in the signal control module is in a constant state, which reduces power consumption.
[0059] The present application provides a clock switching circuit, which includes a clock output module and a signal control module. The signal control module detects the state of the main clock signal and stores the state of the main clock signal to generate control signals of different states. The clock output module automatically switches and outputs the main clock signal and the secondary clock signal according to the control signal, so that when the main clock signal is abnormal, the secondary clock signal is output, and when the main clock signal returns to normal, the secondary clock signal is switched to the main clock signal. The clock switching circuit provided by the present application can automatically switch to the secondary clock signal after the main clock signal is lost, and automatically switch back to the main clock signal when the main clock signal is restored, which can avoid the adverse effects of circuit system paralysis caused by the loss of the main clock signal, and the circuit structure is simple and occupies a small area.
[0060] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present invention. Therefore, all equivalent modifications or changes made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed by the present invention shall still be covered by the claims of the present invention.
Claims
1. A clock switching circuit, characterized in that: include: A clock output module switches and outputs a primary clock signal and a secondary clock signal based on a control signal; A signal control module, performing state detection on the master clock signal, and generating the control signal according to the detection result; When the detection result is that the main clock signal is lost, the signal control module outputs a control signal of the first state, and the clock output module outputs the secondary clock signal according to the control signal of the first state; when the detection result changes from lost to existing, the signal control module outputs a control signal of the second state, and the clock output module outputs the main clock signal according to the control signal of the second state.
2. The clock switching circuit according to claim 1, characterized in that: The signal control module includes a master clock detection unit, a master clock state monitoring unit, a master clock recovery unit, a latch and a signal output unit. The master clock detection unit performs state detection on the master clock signal to obtain a pulse signal. The main clock state monitoring unit monitors whether the main clock signal is lost based on the secondary clock signal and the pulse signal, and the main clock recovery unit determines the change of the main clock signal based on the reset signal and the main clock signal; The latch stores the state of the master clock signal according to the signal output by the master clock state monitoring unit and the signal output by the master clock recovery unit; the signal output unit controls the working mode of the clock switching circuit based on the mode selection signal, and when the clock switching circuit is in the intelligent switching mode, the signal latched by the latch is output to obtain the control signal.
3. The clock switching circuit according to claim 2, characterized in that: The master clock detection unit includes a first NOT gate, a second NOT gate, a third NOT gate, a first delay, a second delay, a first NAND gate, a second NAND gate, a first AND gate, and a second AND gate; the output end of the first NOT gate is connected to the first input end of the first NAND gate via the first delay and the second NOT gate, the output end of the first NOT gate is also connected to the second input end of the first NAND gate, the output end of the first NAND gate is connected to the first input end of the first AND gate, the input end of the first NOT gate is connected to the first input end of the second NAND gate via the second delay and the third NOT gate, the input end of the first NOT gate is also connected to the second input end of the second NAND gate, the output end of the second NAND gate is connected to the first input end of the second AND gate, the second input end of the second AND gate is connected to the mode selection signal, and the output end of the second AND gate is connected to the second input end of the first AND gate, wherein the input end of the first NOT gate is connected to the master clock signal, and the first AND gate outputs the pulse signal.
4. The clock switching circuit according to claim 2, characterized in that: The main clock state monitoring unit includes a first trigger and a second trigger, the input end of the first trigger is connected to the power supply voltage, the output end of the first trigger is connected to the input end of the second trigger, wherein the clock signal input end of the first trigger and the clock signal input end of the second trigger are connected to the secondary clock signal, the reset end of the first trigger and the reset end of the second trigger are connected to the pulse signal, and the positive phase output end of the second trigger is the output end of the main clock state monitoring unit.
5. The clock switching circuit according to claim 2, characterized in that: The master clock recovery unit includes N third flip-flops and a fourth NOT gate, the inverting output end of the i-th third flip-flop is connected to the input end of the i-th third flip-flop, the inverting output end of the i-th third flip-flop is also connected to the clock signal input end of the i+1-th third flip-flop, the positive output end of the N-th third flip-flop is connected to the input end of the fourth NOT gate, wherein the clock signal input end of the first third flip-flop is connected to the master clock signal, the reset ends of the N third flip-flops are connected to the reset signal, and the output end of the fourth NOT gate is the output end of the master clock recovery unit.
6. The clock switching circuit according to claim 2, characterized in that: The latch includes a fifth NOT gate, a third NAND gate and a fourth NAND gate, wherein the output end of the fifth NOT gate is connected to the first input end of the third NAND gate, the output end of the third NAND gate is connected to the first input end of the fourth NAND gate, the second input end of the fourth NAND gate is connected to the mode selection signal, and the output end of the fourth NAND gate is connected to the second input end of the third NAND gate, wherein the input end of the fifth NOT gate and the third input end of the fourth NAND gate are the input ends of the latch, and the output end of the third NAND gate is the output end of the latch.
7. The clock switching circuit according to claim 2, characterized in that: The signal output unit includes a sixth NOT gate, a seventh NOT gate, an eighth NOT gate and a two-to-one multiplexer, wherein the output end of the sixth NOT gate is connected to the first input end of the two-to-one multiplexer via the seventh NOT gate and the eighth NOT gate, wherein the input end of the sixth NOT gate is the input end of the signal output unit, the output end of the seventh NOT gate outputs the reset signal, the second input end of the two-to-one multiplexer is connected to a manual input signal, the selection end of the two-to-one multiplexer is connected to the mode selection signal, and the output end of the two-to-one multiplexer outputs the control signal to the outside.
8. The clock switching circuit according to claim 1, characterized in that: The clock output module includes a first XOR gate, a second XOR gate, a third XOR gate and a ninth NOT gate, wherein the output end of the first XOR gate is connected to the first input end of the third XOR gate, the output end of the ninth NOT gate is connected to the first input end of the second XOR gate, and the output end of the second XOR gate is connected to the second input end of the third XOR gate, wherein the second input end of the first XOR gate is connected to the control signal, the input end of the ninth NOT gate is connected to the control signal, the second input end of the second XOR gate is connected to the main clock signal, the first input end of the first XOR gate is connected to the secondary clock signal, and the output end of the third XOR gate is the output end of the clock output module.
Citation Information
Cited By
Control circuit for avoiding read-write conflict of RAM (Random Access Memory) of display driver
CN119296598A
A control circuit for avoiding RAM read-write conflicts in display drivers
CN119296598B
Clock detection device and method
CN119782021A
