Design Idea

Circuit avoids metastability

Edited by Bill Travis and Anne Watson Swager

Jonathan Eckrich, Adaptivation, Sioux Falls, SD -- EDN, 8/30/2001

Consider a computer system that has a host processor connected to a remote-I/O subsystem (Figure 1). The host clock treats the I/O system, which is located far from the main hardware, as a slave. Because of the transmitters, receivers, remote-system logic, and cable length, the data the host receives has a dramatic latency. This latency can be larger than the clock period. If the length of the cable is indeterminate, then the latency is also indeterminate. The problem with such latency is that receiving registers in the host system might clock in the data from the remote system while some bits are changing. The result is that some data may be corrupt, or, worse, the input registers may go into a metastable state. The circuit in Figure 2 prevents clocking bad or changing data. It does so using only general-purpose, "jellybean" logic. The key is to remote-clock back to host. This action allows XOR gate IC1A to compare the phase difference between the host clock and the delayed clock.

When the two clocks are nearly in phase, the duty cycle of IC1A's output is close to 0%. When the two clocks are close to 180° out of phase, the duty cycle approaches 100%. Whatever the duty cycle is, it is constant during normal operation. The only way it can change is for the cable length between the two systems to change. R1 and C1 form a lowpass filter. Set R3 equal to R4 so that the reference voltage is at midpoint. IC2 and IC1B then select whether to clock register IC3 on the rising or falling edge of the host clock. IC4 ensures that the data changes consistently with the rest of the host system. Figure 3 shows a (delayed) remote clock that is nearly 360° out of phase with the host clock. If the host were to clock in the data on the rising edge of its clock, metastability would become a concern. You can simply clock in the data on the falling edge of the host clock, but this solution yields the same problem if you choose a new cable with a different length.

Without any analytical effort on the designer's part, the circuit in Figure 2 automatically selects which clock edge to use. Note that comparator IC2 can be a low-speed part, because it operates at dc only. Note also that if the two clocks are 360±90° out of phase, the circuit uses the falling edge of the clock. If they are 180±90° out of phase, the circuit uses the rising edge. If the R1C1 time constant is too low, the resulting ripple can cause the output of the comparator to be unstable. You could use a comparator with hysteresis to reject the ripple. Some instability of the comparator's output is acceptable, because you can safely use either the rising or the falling edge for most latencies. You need stability only when the clock is near 360 and 180° out of phase, so you have little to lose by using a large R1C1 time constant to present a dc voltage to the comparator's input.

Is this the best Design Idea in this issue? Vote at www.ednmag.com.



Reed Business Information Resource Center

Featured Company


Related Resources

ADVERTISEMENT

ADVERTISEMENT

Feedback Loop


Post a CommentPost a Comment

There are no comments posted for this article.

Related Content

 

By This Author

There are no additional articles written by this author.


ADVERTISEMENT

Knowledge Center



Technology Quick Links

EDN Marketplace


©1997-2009 Reed Business Information, a division of Reed Elsevier Inc. All rights reserved.
Use of this Web site is subject to its Terms of Use | Privacy Policy

Please visit these other Reed Business sites