1. Field of the Invention
This invention relates generally to comparators, and more particularly to ping pong comparators employed to monitor an input voltage.
2. Description of the Related Art
One method of monitoring the level of a given voltage is to use a comparator circuit. Here, a reference voltage (Vref) and the voltage to be monitored (Vin) are applied to the inputs of a comparator, the output of which toggles when Vin increases above or falls below Vref. To provide highly accurate monitoring, the comparator may be periodically auto-zeroed to avoid offset drift which can degrade accuracy. To achieve continuous monitoring, two comparators can be used in a ‘ping pong’ configuration, which allows one comparator to keep monitoring while the other is being auto-zeroed. However, this periodic switching comes with a side effect: a parasitic offset mismatch between the two comparators could potentially yield different comparison results, even if both Vin and Vref remain constant. As a result, the comparator output could become a periodic square wave if Vin is close to Vref.
This problem can be mitigated by adding hysteresis onto the comparator input; however, simply adding a fixed amount of hysteresis onto both comparators can result in additional problems. For example, for reliable operation, the minimum hysteresis value for the individual comparators needs to be larger than the offset mismatch between the two comparators. Depending on the mismatch, this could result in large hysteresis values. This could degrade the monitoring accuracy, especially if Vin is a low voltage for which the hysteresis would be a large percentage of the input threshold. Another drawback is that the hysteresis value needed can vary over time and with changes in the offset mismatch.
This is illustrated with reference to
Reference voltage Vref is applied to the other input of each comparator. However, due to offset mismatch, represented in
When the offset mismatch is zero, the rising and falling trip thresholds for comparator 1 (Vrise1 and Vfall1) are given by:
Vrise1=Vref+hyst±0(due to zero offset)
Vfall1=Vref±0
When Vrise1 and Vfall1 are the rising and falling thresholds, respectively, the hysteresis voltage (Vhyst1) for comparator 1 is given by:
Vhyst1=Vrise1−Vfall1=hyst
The rising and falling trip thresholds for comparator 2 (Vrise2 and Vfall2) are given by:
Vrise2=Vref+hyst
Vfall2=Vref
The hysteresis voltage (Vhyst2) for comparator 2 is given by:
Vhyst2=Vrise2−Vfall2=hyst
Thus, in this ideal case, both comparators have the same rising and falling thresholds, closely resembling a circuit employing only one comparator.
If the offset mismatch between the two comparators is not zero, then the rising and falling trip thresholds and the hysteresis voltage for comparator 1 (Vrise1, Vfall1, Vhyst1) are given by:
Vrise1=Vref+hyst±offset
Vfall1=Vref±offset
Vhyst1=Vrise1−Vfall1=hyst
where offset=|offset1−offset2| and offset1 and offset2 are the offset voltages associated with comparators 1 and 2, respectively.
The rising and falling trip thresholds and hysteresis voltage for comparator 2 (Vrise2, Vfall2, Vhyst2) are given by:
Vrise2=Vref+hyst
Vfall2=Vref
Vhyst2=Vrise2−Vfall2=hyst
Although the two comparators share the same input hysteresis value (hyst), they have different rising and falling thresholds. If one comparator's falling threshold is higher than the other's rising threshold, a potential output disagreement between the two comparators can be caused by an input voltage that is at a level between the two thresholds, in which case one comparator determines that OUT should be high and another determines it should be low. Due to the nature of the ping pong comparators, only one comparator determines the output at a time. But because of the periodic switching of the comparators, if Vin remains constant, an output disagreement could create a square wave waveform at OUT.
Simply adding more hysteresis to the comparators could solve this output switching problem, but the hysteresis value would be required to be larger than the offset mismatch between the comparators. This makes it difficult to use a small hysteresis value, which tends to reduce the voltage monitoring accuracy. Also, the effective hysteresis can vary with the offset mismatch, and thus vary from part to part.
A ping pong comparator voltage monitoring circuit is presented which addresses the problems discussed above, enabling the use of a low hysteresis value independent of the comparator offset mismatch.
The present ping pong comparator voltage monitoring circuit includes:
a first comparator having a first input connected to a voltage Vin to be monitored, a second input connected to a first node, and an output which toggles from a first state to a second state when Vin increases above the voltage applied to the comparator's second input and toggles from the second state to the first state when Vin falls below the voltage applied to the first comparator's second input;
a second comparator having a first input connected to Vin, a second input connected to a second node, and an output which toggles from a first state to a second state when Vin increases above the voltage applied to the second comparator's second input and toggles from the second state to the first state when Vin falls below the voltage applied to the second comparator's second input;
a multiplexer (“mux”) connected to receive the outputs of the first and second comparators at first and second inputs, respectively, and to receive a periodic control signal at a ‘select’ input, the mux arranged to alternately couple the voltage applied to its first and second inputs to an output in response to the periodic control signal, the mux output being the output of the voltage monitoring circuit;
a first reference voltage source which produces a voltage Vref1 at a third node which is referenced to a circuit common point;
a second reference voltage source which produces a voltage Vref2 at a fourth node which is referenced to Vref1 such that the voltage at the fourth node is given by Vref1+Vref2;
a first hysteresis voltage source which produces a voltage hyst1 and is arranged to be switchably connected between the third and first nodes; and
a second hysteresis voltage source which produces a voltage hyst2 and is arranged to be switchably connected between the fourth and second nodes;
the voltage monitoring circuit arranged such that the first and second hysteresis voltage sources are switched in such that the voltage at the first node is Vref1+hyst1 and the voltage at the second node is Vref1+Vref2+hyst2 when the mux output has toggled from the first state to the second state due to a rising value of Vin,
and such that the voltage at the first node is Vref1 and the voltage at the second node is Vref1+Vref2 when the mux output has toggled from the second state to the first state due to a falling value of Vin.
These and other features, aspects, and advantages of the present invention will become better understood with reference to the following description and claims.
One approach to the problems identified above is to add hysteresis as needed to prevent the occurrence of the output switching problem described above. To make sure that there is no falling threshold above a rising threshold, all comparator input levels are examined. The terms appearing in the equations below are as previously defined.
First:
Vref+hyst±offset>Vref=>hyst>|offset|,
Vrise2 must always be higher than Vfall1, leading to:
Vref+hyst>Vref±offset=>hyst>|offset|
This means that, for this approach to work, the hysteresis value needs to be larger than the offset mismatch between the two comparators.
Let hyst=|offset_max|+X,
where offset_max is the maximum offset between the two comparators and X is a fixed value chosen by the user.
The equations then become:
Vrise1=Vref+|offset|+X±offset
Vfall1=Vref±offset
Vrise2=Vref+|offset|+X
Vfall2=Vref
The hysteresis for both individual comparators is hyst; due to the ping-pong action, a slow rising or falling Vin could experience hysteresis created by combining the thresholds of the two comparators. Assume here that the offset value is at its maximum positive value. Then:
where hyst is the hysteresis value for each individual comparator, and hyst_small and hyst_large refer to the hysteresis values that result if the comparator thresholds are combined. Similar values can be derived if the offset value is assumed to be at its maximum negative value.
Thus, hyst_small is formed by the lower rising threshold and the higher falling threshold, and hyst_large is formed by the higher rising threshold and lower falling threshold. These two terms are useful to examine the circuit reaction and its effective hysteresis with slow- and fast-changing input signals.
If Vin is rising or falling slowly, hyst_small would become the effective hysteresis. The output in this case can suffer some delay as discussed above, but smaller overdrive naturally comes with longer delay. For a Vin with a large slew rate (fast changing), the hysteresis value can be either hyst_small or hyst_large, depending on where Vin crosses the thresholds. But whether hyst_small or hyst_large, with a large slew rate Vin will hit the threshold very quickly and thus the output reaction time would be short.
This solution appears to avoid output toggling. One can define hyst_large by choosing hyst if the maximum offset value is known; the minimum value of hyst_small is not limited by the offset. But a problem arises when the offset voltage changes from part to part. Since both hyst_large and hyst_small are a function of offset, as the offset changes these hysteresis values change as well. If the two comparators are perfectly matched, offset=0 and then:
hyst_large=Vrise2−Vfall1=Vref+hyst−Vref+0=hyst
hyst_small=Vrise1−Vfall2=Vref+hyst+0−Vref=hyst
This is illustrated in
Both hystereses can be varied by:
hyst−X=|offset|
In this case, even a slowly rising or falling input signal would experience input hysteresis of |offset|+X. This makes the datasheet specification of a hysteresis value difficult to know and potentially large. This is especially undesirable for low level voltage monitoring, as the offset could become a large percentage of the threshold. From an accuracy perspective, both rising and falling thresholds for this approach could vary by ±offset.
Thus, while this approach is simple to implement, it also requires a large hysteresis specification, which degrades monitoring accuracy. Furthermore, the hysteresis value changes with offset, and thus can vary from part to part.
These drawbacks are overcome with the ping pong comparator voltage monitoring circuit shown in
In the case where the offset is zero, the equations for the rising and falling thresholds are as follows. Comparator 1 (with large hysteresis hyst1):
Vrise1=Vref+hyst1
Vfall1=Vref
Vhyst_large=Vrise1−Vfall1=hyst1
Comparator 2 (with small hysteresis hyst2):
Vrise2=Vref+Vref2+hyst2±0
Vfall2=Vref+Vref2±0
Vhyst_small=Vrise2−Vfall2=hyst2
In the case where the offset mismatch between the two comparators is at its maximum, the equations for the rising and falling thresholds are as follows.
Vrise1=Vref+hyst1
Vfall1=Vref
Vrise2=Vref+Vref2+hyst2±offset
Vfall2=Vref+Vref2±offset
To ensure that there is no output dispute, the rising threshold of one comparator must be above the falling threshold of the other comparator. Thus:
Vref+Vref2+hyst2±offset>Vref=>Vref2+hyst2>|offset|
Let Vref2=|offset|
Then:
Vref+hyst1>Vref+Vref2±offset=>hyst1>Vref2+|offset|
Let hyst1=Vref2+|offset|+X,
where X is a fixed value chosen by the user.
Combining the equation above gives:
hyst1=2×|offset|+X
The hysteresis values are hyst1 and hyst2 for comparators 1 and 2, respectively. Due to the ping-pong action, a slowly rising and falling Vin would experience only the small hysteresis on comparator 2. If the offset value is at its maximum positive value:
If we make X=hyst2, then the hysteresis here would become hyst2.
If the offset value is at its maximum negative value:
Thus, no matter what the offset value is, the hysteresis experienced by a slowly rising and falling Vin would be hyst2.
The comparator hysteresis with small and large hysteresis values, with zero offset, was illustrated in
Vin would be detected immediately if it crosses a threshold set by comparator 1, as either comparator would detect the voltage at this level. Comparator 2 may miss Vin if it is not on duty, so its reaction time to Vin crossing its threshold could be longer. The reaction time depends on the comparator switching period T and propagation delay.
For a slowly rising/falling Vin, hyst2 becomes the effective hysteresis, and for inputs with a large slew rate, the hysteresis value can be either hyst2 or hyst1, depending on where Vin crosses the thresholds. But no matter which one it is, with a large slew rate, Vin will hit a threshold very quickly and thus the output reaction time will be short. This matches the characteristic of most voltage monitoring devices, for which higher overdrive results in a shorter delay.
Thus, for the approach shown in
From an accuracy perspective, the rising and falling thresholds of the
The embodiments of the invention described herein are exemplary and numerous modifications, variations and rearrangements can be readily envisioned to achieve substantially equivalent results, all of which are intended to be embraced within the spirit and scope of the invention as defined in the appended claims.