Stability of crystals in clock circuit, Freq vs Duty Cycle...

So, I'm working on a project at the moment. One which requires a clock source, and I've been looking at a LOT of schematics. There really does seem to be a different circuit for every frequency of crystal, and even between manufacturers I've been able to tell a difference in performance. But most seem to be pretty close, and I can only assume that this is a result of varying load capacities of different crystals.

And this brings me to the subject at hand, frequency vs duty cycle. I had originally been trying to use a circuit like this:

This seemed as if I just could not make it work, and if it did work, it was VERY erratic. What I mean by that, is that the crystal seem as though it wouldn't oscillate, then it would but at a super high frequency (2-3 times the one listed), then it would slow down, then speed up, etc. All this was tested with my logic analyzer in case you were wondering. Although it seem that this variation on the circuit is quite popular, I just couldn't manage to make it work.

Then I managed to find a PDF document on the net which was pertaining to clock circuits, and found example 1d on page 2 to be very similar yet different. It had different values for the resistors, which do not seem to be too critical in value. And had done away with the third gate, and the 120pF cap. The pdf is here:

Circuit Techniques for Clock Sources

When I breadboarded this circuit with a 1k and 500k resistor and a 1nF cap, the circuit works great. I get a steady 3mHz squarewave, and all seems good. Except for one thing, the duty cycle. Now in theory, the duty cycle should basically be 50%. And I get that about 2/3 of the time. However, the other 1/3 of the time it is about 62.5%. Now, I don't think this is going to be too big of an issue, if any, considering I'm going to be using this as a clock source for a z80 build. But I cant help but think it might be a problem for any peripherals that I might hook up, read DRAM.

to further complicate the matter, I've noticed that when I use a crystal of a higher frequency I continulally get erratic oscillation, I'm sure as a result of the cap. But this makes be ask three questions:

  1. Is the duty cycle of the oscillator of any concern to the maker?

  2. And if so, what changes can be made to make this, or another, circuit more reliable?

  3. Do you have a preferred circuit for crystals in the 3-20mHz range when building clock sources?

Just for giggles, in case anyone wants to see the data pulled from the analyzer, it is attached.

What you see on the screen could be a low quality oscilloscope that is not accurate with sampling. Is the 50MHz input rate accurate ?

I have never seen a circuit like that for a crystal.
The values are not the same as in the Linear Application Note. The picture in your post has 120pF on the left to GND. That is a big difference.

The duty cycle not being 50% can be due to the logic. Suppose the 74LS04 detects a '0' below 1 Volt and a '1' above 2 Volt. Then the duty cycle is no longer in the middle.

It is common to use a "crystal oscillator" or "crystal oscillator clock module". They are metal boxes that generate a frequency.

That circuit is not guaranteed to start oscillating, you need an odd number of inverters
to get that.

These days you just buy a crystal oscillator if you want an oscillator, not build a circuit
to do it. Even temperature-compensated ones are available all in a small SMT package.

So you need a perfect 50% duty cycle.
Use a crystal with double the frequency you need, followed by a flipflop.
Or a single HEF4060 with a 4x crystal. Oscillator and dividers in a single package.
Leo..

@Peter, 24mHz is the highest sampling rate that I can use with this particular analyzer. It's one of the saleae knockoffs. So I can't comment on whether it is accurate at a higher sampling rate. As for the picture vs the pdf that I linked, I noted that, and commented on it above.

I think that the extra capacitance, along with the third gate, are what were causing it to not function properly. If I connect the third gate, the oscillation stops. If I use the second cap, the oscillation stops. I also couldn't get consistent oscillation with a 100nF cap as the picture above suggests. However, if I switched to a 1000pF/1nF or a 2nF cap, it seems to work fine with the exception of the variations in duty cycle.

As for the 74**04, I am using a 74HC04, so it should only be seeing a 5v or a 0v logic if I'm not mistaken, considering it is CMOS. And I'm aware of the Full and Half Can oscillators. I've ordered a couple of 6mhz ones. However, I have a plethora of the HC49/s and HC49/T (this particular circuit I've etched used the tall variety) oscillators in my parts bin, and wanted to use some of them up.

@Mark, it seems to work fine, although I can't really comment with any authority on a guarantee. Like I just mentioned above, in this circuit, if a third gate/inverter is used it doesn't oscillate at all. Like I also said above, I'm aware of the full and half can varieties. Just never saw the need to purchase any before. And only did because I felt I might be forced to use one. But considering this is going to be used in a retro build, I figured the circuit might be more era correct. But like I said, I may end up using a full can module.

Leo, I don't necessarily need a perfect 50% duty cycle. The question I have is of what concern is the duty cycle, and what can be done to make it more stable if it is indeed important.

The 74HC04 is CMOS, and it switches from high to low (and vice versa) when the input passes half the voltage. So the duty cycle trouble is only the instability of the circuit.
Why do you want to use the circuit with two 74HC04 instead of just one ? That circuit seems to depend on the value of the components for a certain frequency/crystal.
This is a more normal circuit : Schematheek - Forum - SMD kristal vervangen door een gewone kristal?
Or this (figure 5) : Front End Turns PC Sound Card into High-Speed Sampling Oscilloscope | Analog Devices
(The tuning is only needed for a precise frequency).

The original of your picture in the first post seems to be this : Thomas Scherrer Crystal Oscillator Circuits

Have a look af fig 7 of this datasheet.
One single inverting port with bias resistor to force the port in lineair mode, and split load capacitance (Pi filter).
Should work with the ports you're using.
Leo..

edit: Same circuit as the links from Peter_n

@Peter, it's not two 74hc04s, it simply two of the gates. So as an example, pin 1 would be an input, and pin 2 would be it's output. The same for 3 & 4, and 5 & 6. As for CMOS, I think you might be mixing it up with TTL. CMOS minimum high input, per my understanding, as well as every technical article I've ever read, is 3.5v, versus TTL which is 2.0v. The low on CMOS is 1.5v-0v, versus TTL which is 0.8v - 0v. Are you referring to the grey space in between? If so, I also thought that CMOS wouldn't switch high unless it had reached it's minimum voltage. And that is why TTL was more desirable in most situations as the grey space between was narrower, and it would switch high or low at a narrower point. Whereas CMOS wouldn't. Am I wrong?

As for the circuit that you linked to, I've tried that one. And it was worse than this particular circuit. As for the link to z80.info, yeah, I have read almost the entire website.

@Wawa, yeah, thats the same one. Noted, but as I said, I can't see to make it work for me. It may be the particular crystal I have requiring a different load capacitance or something. Dunno...

Guys, this question isn't geared towards finding a different circuit, although I appreciate the pointers. Like I pointed out above, my main question is of what level of importance is duty cycle in oscillating circuits (i.e. what is the acceptable margin of error), how to tune a circuit like this to be more reliable, and lastly, if you have used these circuits in the past or still do, do you have a preference of one circuit over another.

Can you provide more info on the crystal?
In particular, is it cut for series or parallel mode , and is it a fundamental or overtone crystal.
Thats a very odd circuit for a crystal oscillator.

Hi,

www.electronics-tutorials.ws/oscillator/crystal.html

These two refs tell you quite bit about crystals and their behaviour, in particular about parallel and series resonant cuts.

The first ref has a modified version of your circuit with some values of surrounding components.
Also note, that even the method of connection to the crystal will effect performance due to stray capacitance, if you are using a protoboard there is a considerable amount of stray capacitance.

Its worth prototyping RF on a veroboard or other strip soldering board as the strips offer minimal stray capacitance.

Tom.... :slight_smile:

looks like OP image has a web page at:

http://www.z80.info/uexosc.htm

It shows a second circuit with 74LS00 gates and said only 7400 and 74LS00 were tested. It said nothing about testing the circuit on OP. They also talk about HCT technology not working because it is difficult to bias the inverter in the linear region. I don't think HC is very different than HCT, so why not try 74LS04 or the circuit that was tested.

mauried:
Thats a very odd circuit for a crystal oscillator.

The only odd thing about it is the 120 pF capacitor.

As mentioned in passing on that web page, crystals can be operated in either series or parallel mode. The circuit in question will excite the crystal in series mode which IIRC is appropriate for overtone crystals, while those with an odd number of inverters will excite it in parallel mode, more appropriate for fundamental oscillation.

The 120 pF capacitor is presumably to prevent operation in an inappropriately high overtone mode. It is not the loading capacitance for the crystal. (More ...)

ron_sutherland:
They also talk about HCT technology not working because it is difficult to bias the inverter in the linear region.

That of course, makes no sense at all.

ron_sutherland:
I don't think HC is very different than HCT, so why not try 74LS04 or the circuit that was tested.

That would seem to be rather retrograde. The difference between HC and HCT is that HC is symmetrical in contrast to HCT and LS. If one is trying different, more primitive logic types, it simply means one has no idea what one is doing. :grinning: I would be more inclined to "lose" the 120 pF capacitor which appears to be peculiarly unique to that particular web-page!

Inverter chain oscillators need their overall propagation delay tuned to the frequency
of oscillation, so one circuit will not work from 3MHz to 20MHz. For that you need
analog circuitry, not digital, something like a Colpitts oscillator which will work for
a wider range of frequencies. You always have to worry about un-intended overtones
though. I think your circuit is entering the chaotic regime (hence different duty
cycles).

Overtone oscillators do need to select the right overtone so they are generally tuned
roughly to the right frequency with an LC circuit so they select the correct harmonic.

With analog oscillators you then have to put the output through a digital gate to get
a square wave (assuming the threshold is set right).

I think that your perceived 'problem', is due to the limitations of your test equipment.

Your logic analyser, is sampling a waveform that is roughly sinusoidal, and converting it to a square/rectangular waveform.

The sampling frequency of 24MHz is only 8 times the oscillator frequency.

If the waveform that you are viewing is high for 4 of the logic analyser's clock periods, and then low for 4 clock periods, it will indicate a duty cycle of 50%.
However if the logic analyser 'sees' the signal as being high for 5 clock cycles and low for 3 clock cycles, it will indicate 62.5% duty cycle.

For an input frequency of 3MHz, your analyser can only indicate certain quantised values for the duty cycle.

For example if you put in a rectangular pulse with a duty cycle of 51%, because that is greater than 50%, it would indicate the next higher value that it can, i.e. 62.5%.

mauried:
Can you provide more info on the crystal?
In particular, is it cut for series or parallel mode , and is it a fundamental or overtone crystal.
Thats a very odd circuit for a crystal oscillator.

A google search doesn't turn up anything on the particular 3mHz crystal I'm using. It's marked "D.M. 3.000 LY0330". Most of the other crystals I have on hand do not have part numbers on them. That is the disadvantage to getting cheap parts off Fleebay. As for the circuit being odd, I'll have to agree with Paul, it's not really an odd circuit. Circuits like these were fairly common 20 years ago in many 8-bit systems. Although many times they would also use a divider of one kind or another to achieve a lower lower frequency of oscillation. Take the TI-99/4a as an example, it used a 12mHz crystal, which was then divided by four to achieve 3mhz. Also, you have to remember, back then many processors (possibly all?) didn't have two XTAL pins. They had a single clock pin. So the method of providing a clock signal was similar to the various examples mentioned above. Like the PDF I linked to above states, "relatively little information has appeared on circuitry for crystals and engineers often view(ed) crystal circuitry as a black art, best left to a few skilled practitioners". Today, all the additional circuitry is located within the MCU.

@Tom, I will definitely read those two. I appreciate the links. I did the initial prototyping on breadboard just to confirm the circuit was doing 'something'. Once that was confirmed I designed a quick board in eagle and tried them out with a few different values of caps and resistors trying to fine tune. I don't know what it is about perfboard or strip board, but I tend to get about half way through and loose track of where I'm at and what I missed. So if it isn't a large circuit, and I have some appropriate pieces of scrap PCB laying around, I'll just etch a small circuit.

@Paul, So can I assume that, since this particular crystal seems to oscillate with two inverters versus three, these crystals I have are cut for series oscillation, not parallel?

Paul__B:
That would seem to be rather retrograde. The difference between HC and HCT is that HC is symmetrical in contrast to HCT and LS. If one is trying different, more primitive logic types, it simply means one has no idea what one is doing. :grinning: I would be more inclined to "lose" the 120 pF capacitor which appears to be peculiarly unique to that particular web-page!

Ha, I'm not sure which of us that you're referring to in the sentence before the smiley, but the humor definitely made me smile on this rainy day. I tend to think that most of the time, when one resorts to the forums, it's because they don't know what they're doing, and are looking to bath in the pool of knowledge of other, more knowledgeable, individuals.

But as for older technologies, if I'm not mistaken, LS predates HC and HCT. Both examples of the circuit I'm using show LS logic. However, I don't have any on hand. So I figured I might be able to get away with HC. But I'll acknowledge that it could be the source of the duty cycle issue. If LS has a lower threshold of what it sees as a HIGH than the HC does, the problem with duty cycle could be that the HC is seeing the HIGH slower than the LS would. Or to put it another way, because of the variation of the oscillation, the 74HC04 is taking longer to register that there is a HIGH signal, whereas the 74LS04 in the example is able to switch on at a lower voltage. And what you mentioned about the 120pf cap holds water, if I place one in the circuit oscillation stops or becomes very erratic.

@Mark, that is very interesting. I generally though of all crystal circuits as analog, which are then passed through a digital gate to convert the signal to a square. My understanding is they essentially all start off as a sine. And the gates are there to do that conversion. I think I should probably do a little more research on overtones, I really don't know much about them. Most of the material I've read mentions them in passing, but didn't delve too deeply into them.

JohnLincoln:
I think that your perceived 'problem', is due to the limitations of your test equipment.

Your logic analyser, is sampling a waveform that is roughly sinusoidal, and converting it to a square/rectangular waveform.

The sampling frequency of 24MHz is only 8 times the oscillator frequency.

If the waveform that you are viewing is high for 4 of the logic analyser's clock periods, and then low for 4 clock periods, it will indicate a duty cycle of 50%.
However if the logic analyser 'sees' the signal as being high for 5 clock cycles and low for 3 clock cycles, it will indicate 62.5% duty cycle.

For an input frequency of 3MHz, your analyser can only indicate certain quantised values for the duty cycle.

For example if you put in a rectangular pulse with a duty cycle of 51%, because that is greater than 50%, it would indicate the next higher value that it can, i.e. 62.5%.

John, now THAT makes sense. It's a cheap analyzer. I think it was $10 or so. And it obviously has it's limitations. Sticking this on better equipment would be more insightful. However, being a hobbiest, it's not really in the budget. At least not yet. I've got a buddy who is an aviation technician. I need to go drink a few cold ones with him, so I might see if while we're doing so if he'll kindly test it for me. Because if what you're suggesting is true, it very well might be a very consistent clock.

If it is a problem, use a 6MHZ XTAL then feed the signal to a FlipFlop

The best type of crystal oscillator for a Micro is the simple Pierce oscillator.
Works with parallel cut crystals which most low frequency ones are, and it wont run on an overtone of
the crystals frequency.
The 2 parallel caps should be equal and the capacitance around double the parallel shunt capacitance
the crystal is cut for .
Values of 10 - 20 pf are common.
The resistor needs to be quite high, around 1 - 5 megohms.

Realizing I had a serious limitation with my test equipment I decided to go on the search for an O-scope. I found a exceptional deal on an old analog BK Precision 2120. Got it delivered for less than the shipping price of many models.

After some testing the circuit that I was attempting to use (both the 3 inverter and the 2 inverter variants) I decided that this circuit will likely not serve as reliable. And attempts to use it (bear in mind, on a breadboard) proved unreliable.

The attachments below show the results of the wave. The first is of a 3 inverter circuit. The second of the circuit with only two inverters. Retesting showed high level of consistency.

The jury is in, and it appears that the variant with two inverters is superior in function to the former. However, nowhere near a square wave. And as such, would likely not function as a clock source for older CMOS devices.

I plan on proceeding with testing of a pierce style oscillator circuit, and will post the results when I have my conclusions.

Now keep in mind that, at least per my reading, these results would vary with a differently selection of components. The 74HCT04 may by itself be a problem. Parts were from China, and may not be genuine.

Well, another interesting night on the bench. I used the scope on a DIP-14 oscillator to begin with. The frequency of this particular unit is 6mhz. Turns out, clock oscillators don't make a square wave as I expected. At least not this one (MCO-1510A). The first picture attached is of this unit. Once again, very similar to the above circuits. Considering this is intended to run a Z80 processor, in a larger project including an arduino or clone, the square wave really needs to be just that, square.

The images below are scaled at 10x at .5uS. Voltage divisions are set to 5v.

The second photo is of the oscillator through two inverters. Very little difference was seen between using two or three inverters. Read: barely noticeable. As you can see, quite a bit of overshoot is apparent in this example.

The third picture is of the example given on the Z80.info site listed from the OP, using a 3mhz crystal, and three inverters (this time 74AS04D). As you can see, simply switching to the AS variant made a huge difference. Although, there is way too much overshoot on the slope. When using only two inverters the circuit performs the same, however the overshoot almost doubles, registering almost -5v on the oscilloscope. Still trying to work that one out in my head.