This application claims priority from Italian patent application No. TO2005A000307, filed May 6, 2005, which is incorporated herein by reference.
An embodiment of the present invention relates generally to circuits and methods to generate clock signals selected by switching from a plurality of clock signals, in particular asynchronous clock signals operating at different frequencies in micro-controllers. The field of application of the invention clearly extends to all electronic devices in which there is switching among clock signals.
Devices such as micro-controllers require clock signals for their operation. This clock signal determines the operating frequencies of the circuits of the micro-controller.
It is possible, and frequently occurs, that a micro-controller operates employing a source of clock signals at high frequency, in order to achieve high performance, or a source of clock signals at low frequency, in order to reduce power consumption. For this reason it is frequently desirable to be able to change the source of clock signals on command during operation of the micro-controller.
In order to switch between two different sources of clock signals, it is necessary to ensure, for instance in applications on micro-controllers where the clock signal must be provided to the central processing unit (CPU), that the clock signal is free of spurious impulses generated by the switching operation between asynchronous signals at different frequencies, such spurious impulses also being known as “glitches”.
As may be seen in
Many circuits are known in the literature that deal with avoiding the problem of creating glitches.
Known circuits perform a switch control based on one of the external clock signals: a limitation of such circuits, however, lies in the fact that when the external signal stops, for example due to the quartz of the oscillator breaking, operation of the circuit is likewise interrupted.
Other solutions are known, for example from U.S. Pat. Nos. 5,483,185, 5,604,452, and 5,790,609, which are incorporated by reference. However, these solutions present a long switch delay. Further solutions, such as that known from U.S. Pat. No. 6,593,780, which is incorporated by reference, require a high frequency oscillator to be available, incorporated into the device, in order to manage the clock signal switching process.
An embodiment of the present invention solves at least some of the drawbacks mentioned above and offers a solution that enables the onset of disturbances such as glitches to be controlled.
According to an embodiment of the invention, a clock generator includes a logic circuit coupled to a controller. The logic circuit is operable to select one of multiple input clock signals and to generate an output clock signal from the selected input clock signal. And the controller is operable to switch the logic circuit from selecting a first of the input clock signals to selecting a second of the input clock signals, disable the logic circuit from generating the output clock signal in response to an edge of the first input clock signal that occurs before the controller switches the logic circuit, and enable the logic circuit to generate the output clock signal in response to an edge of the second input clock signal that occurs after the controller switches the logic circuit.
Embodiments of the invention will now be described, as a pure example without limiting intent, with reference to the attached drawings.
In brief, a circuit according to an embodiment of the invention is proposed that switches between clock signals selected in a plurality of clock signals in response to a switch command sent to a control module, which sends a corresponding select signal to a selection module, in particular a multiplexer, operating on said plurality of clock signals to provide a selected clock signal. This selected clock signal is passed through a digital filter comprising a logic circuit controlled by a filter signal emitted by the control module. The filter signal is made active for control in an interval of time that comprises the last edge of the previous clock signal before the switch instant, and the subsequent first edge of the new clock signal, that is the two edges immediately adjacent to the switch instant that identify the possible spurious impulse. The control module is thus configured for timing the filter signal so that the digital filter eliminates any spurious impulse due to switching. The select signal, considering the propagation time through elements such as registers and flip-flops and the stabilization time of the new clock signal, is likewise conveniently generated by the control module with reference to reception of the switch command.
According to a further embodiment of the invention, the circuit includes a circuit for detecting the clock signal configured for verifying the availability of an active source of clock signals. When this active source of clock signals ceases to function, the switch control module automatically sets registers at a predetermined value that corresponds to selecting a low-frequency and low-consumption internal source of clock signals, available in the architecture of the device in which the proposed circuit is applied.
This circuit 10 comprises a multiplexer circuit 20, which receives as inputs a plurality of incoming clock signals CK1 . . . CKn and provides as output a selected clock signal CKM. The multiplexer circuit 20 is controlled with regard to switch selection by a select signal S.
The selected clock signal CKM constitutes one of two inputs into a gate 30 that implements an AND function so as to provide as output an outgoing clock signal CKO′ of the circuit to generate a clock signal 10.
According to an embodiment of the invention, this circuit for generating a clock signal 10 also comprises a switch control module 40, that provides at its outputs the select signal S for the multiplexer circuit 20, as well as a filter signal SR to the second input of the AND gate 30 that, when it is at low logic level, activates filtering of the selected clock signal CKM, with the consequent possibility of activating switching between clock signals.
This switch control module 40 receives as input a clock select command CKS, that contains an identifier of which of the n clock signals CK1 . . . CKn available in the microprocessor is to be selected, that may be sent by the user or in any case by the microprocessor, and a stable clock signal CKT, which indicates whether the next selected clock signal is stable or not. In general, to provide the new next selected clock signal, a new oscillator is switched on, and thus a period of time exists in which the output frequency of this new oscillator is not stable. It thus may be necessary to monitor the clock signal sources, with a circuit not described here, and provide this clock signal CKT that indicates to the control module 40 when the new clock signal source is available for use. This switch control module 40 also receives as input the selected clock signal CKM emitted by the multiplexer circuit 20. This switch control module 40 also receives as input a reset signal R as well as a clock stopped warning signal CF originating from the clock signal detector circuit 50. This clock signal detector circuit 50 receives in parallel as inputs the plurality of incoming clock signals CK1 . . . CKn to verify the availability of an active source of clock signals.
The switch control module 40 comprises a register 41, whose output consists of the selector signal S and whose working frequency is scheduled by the selected clock signal CKM, as well as a register 42 likewise scheduled by the selected clock signal CKM that receives and memorizes the incoming clock select command CKS. The registers 41 and 42 have a width of m bits, where m=log2n, n being the number of clock signals CK1 . . . CKn.
The outputs from the registers 41 and 42 are sent as inputs to a comparator circuit 43. The comparator circuit 43 also receives the stable clock signal CKT as an enable input. The result of the comparison made by the comparator circuit 43 is then sent as a control signal COMP to a flip-flop 44 of the D (delay) type (delay flip-flop). The flip-flop 44 also receives at one of its clock input terminals the selected clock signal CKM and provides as one of its outputs an enable signal E, which is sent back to the enabling input terminal of the register 41. The flip-flop 44 on the contrary provides the filter signal SR at its inverted output.
Operation of the circuit 10 for generating a clock signal will now be illustrated, also in reference to
When the user intends to change the source of clock signals, the clock select command CKS is therefore sent, and is written in the register 42, in order to select a signal from among the plurality of clock signals CK1 . . . CKn as source of clock signals for the microcontroller.
For convenience as an example and also for comparison with the diagrams in
The clock selection register 42 switches on the leading edge of the previous clock signal CK1, indicating that the clock signal switching process begins. The control signal COMP is then set if the new clock signal CK2 is already stable and different from the preceding one. As has been said, this is signaled through the stable clock signal CKT that, when it is at high logic level, enables the output of the comparator 43. In the diagram in
On the successive falling edge of the previous clock signal CK1, the filter signal SR, which is at high logic level, moves to low logical level, thus forcing the output clock signal CKO′ to low logic level, through the AND gate 30.
The gate 30 then performs a digital filter function during switching from the previous clock signal CK1 to the new clock signal CK2. As may be seen in the diagram in
At the following falling edge of the first clock signal CK1, contemporaneously to when the filter signal SR goes to low logic level, the enable signal E that operates on the register 41 assumes high logic value, so that the register 41 is loaded on the next leading edge of the first clock signal CK1 with the content of the register 42, that is the value relative to the new clock signal to be selected. This value is sent through the selector signal S to the multiplexer 20, thus determining the selection of the new clock signal CK2 as selected clock signal CKM.
The control signal COMP generated by the comparator 43, due to the identity between the contents of the two registers 41 and 42, goes to low logic level and thus the filter signal SR may transit to high logic level at the subsequent falling edge of the selected clock signal CKM that schedules the flip-flop 44, that now however corresponds to the new clock signal CK2.
When the filter signal SR again moves to high logic level, the switching process is considered terminated and the outgoing clock signal CKO′, glitch-free, is available to the system.
The detector circuit 50 operates through the clock stopped signal CF on the register 41 to select the internal signal source should the circuit be switching from a clock signal source that is no longer available, for example due to breaking of the quartz of the oscillator. The clock stopped signal CF sets the register 41, and consequently the select signal S, to a default value that corresponds to selecting an internal source of clock signals at low frequency and low consumption, available in the architecture of the micro-controller. Any subsequent switches of the clock signal may then occur on the basis of such default clock source.
The circuit according to this embodiment of the invention, advantageously, thus does not require an auxiliary clock signal source at higher frequency to supervise the switching process, thus there is no energy consumption due to that high frequency source to be maintained always active.
The circuit according to an embodiment of the invention enables rapid glitch-free switching, despite being of very simple structure and occupying a very limited area on the chip. Furthermore, the circuit according to an embodiment of the invention entails low power consumption and is thus suitable for low-consumption devices.
Referring again to
As a consequence, the principle of the invention remaining the same, the construction details and embodiments may vary, also widely significantly, with respect to what is described and illustrated here, as a simple example without limiting intent, without thereby departing from the spirit and scope of the invention, as defined by the claims that follow.
Number | Date | Country | Kind |
---|---|---|---|
TO2005A0307 | May 2006 | IT | national |
Number | Name | Date | Kind |
---|---|---|---|
5483185 | Scriber et al. | Jan 1996 | A |
5604452 | Huang | Feb 1997 | A |
5790609 | Swoboda | Aug 1998 | A |
6501304 | Boerstler et al. | Dec 2002 | B1 |
6593780 | Lammers | Jul 2003 | B2 |
20050012525 | Starr et al. | Jan 2005 | A1 |
Number | Date | Country | |
---|---|---|---|
20070257710 A1 | Nov 2007 | US |