Author Topic: is it possible? a crystal oscillator from SN74LS04 TTL hex inverter  (Read 18185 times)

0 Members and 1 Guest are viewing this topic.

Offline ali6x944Topic starter

  • Frequent Contributor
  • **
  • Posts: 567
  • Country: sa
Re: is it possible? a crystal oscillator from SN74LS04 TTL hex inverter
« Reply #25 on: January 30, 2016, 05:36:38 pm »
adding inductance to fix it back?
 

Offline uncle_bob

  • Supporter
  • ****
  • Posts: 2441
  • Country: us
Re: is it possible? a crystal oscillator from SN74LS04 TTL hex inverter
« Reply #26 on: January 30, 2016, 05:43:52 pm »
adding inductance to fix it back?

Hi

The size of the inductor at 32 KHz is going to be pretty big ...

The bigger problem is the one that got this whole thread started. The high speed gate takes off on it's own when put in the linear region. It does that without much of a feedback path at all. Taming it is a real pain. Yes, with good layout techniques on your custom pc board it can be done at HF. Doing it at 32 KHz ... not easy.

Bob
 
The following users thanked this post: ali6x944

Offline ali6x944Topic starter

  • Frequent Contributor
  • **
  • Posts: 567
  • Country: sa
Re: is it possible? a crystal oscillator from SN74LS04 TTL hex inverter
« Reply #27 on: January 31, 2016, 02:02:15 pm »
any final schamatic
 

Offline uncle_bob

  • Supporter
  • ****
  • Posts: 2441
  • Country: us
Re: is it possible? a crystal oscillator from SN74LS04 TTL hex inverter
« Reply #28 on: January 31, 2016, 03:19:09 pm »
any final schamatic

Hi

Power up the inverter (B+ and ground). Bypass the supply (always a good idea). With 4000 series the supply can be anything from 15V down to a couple of volts. Bypass can be anything from 0.01 uf to infinity, ceramic is a good idea.

Use one inverter stage as the oscillator. Bias it into the linear region by putting a 1 M ohm resistor from output to input. At this point the inverter should be sitting with about 1/2 your supply on the output pin. It also will be pulling a couple of ma.

The crystal goes in parallel with the resistor. At this point it probably will oscillate.

A cap goes from output to ground. Something in the 10 to 100 pf range makes sense. It should be an NPO /COG type part. A similar
cap goes from input to ground (same value). This is where the tinkering comes in. Higher values may stop it oscillating. Lower values may allow it to generate crud. The caps are what puts the oscillator on frequency, so if you are concerned with accuracy, that comes in as well.

There are a few optional refinements that can be added.

First is a tuning capacitor in series with the crystal. That way you can set it on frequency without messing up the oscillation.

Next is a current limiting resistor in series with the output of the gate (but before the capacitor and other stuff). This allows you to reduce the crazy stuff without killing the oscillation.

Last is to use another section of the inverter package (another inverter) to bufferer the output. That way, whatever you are driving does not mess up the oscillator.

I hope that makes sense.

Bob

 
The following users thanked this post: ali6x944

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3036
  • Country: us
 
The following users thanked this post: ali6x944

Offline uncle_bob

  • Supporter
  • ****
  • Posts: 2441
  • Country: us
Re: is it possible? a crystal oscillator from SN74LS04 TTL hex inverter
« Reply #30 on: January 31, 2016, 08:34:17 pm »
I've had luck with this drive circuit:

http://www.discovercircuits.com/DJ-Circuits/ultralowpwrxtlosc1.htm

Hi

That circuit will be highly dependent on the capacitance at the output. It really is designed for the load to be high-z (> 10 meg) and low C (around 12 pf). It will run fine into a scope probe. It's not clear it will run well into a heavy load. A simple solution would be some sort of buffer amplifier (emitter follower maybe) on the output.  If you do put in a good buffer, you may need to add the 12 pf back in ....

One other thing to be a bit careful of - not all 2N3904's are created equal. At 1ua collector current you are two decades below the typical data sheet information on the part. A part from source A may do absolutely perfect in the circuit. A part from source B may have issues.

Bob
 
The following users thanked this post: ali6x944

Offline orolo

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: es
Re: is it possible? a crystal oscillator from SN74LS04 TTL hex inverter
« Reply #31 on: January 31, 2016, 10:13:36 pm »
I remembered reading something about TTL xtal oscillators and problems with variable impedances, and, after some digging, found it.

The schematic attached is taken from "Crystal Oscillator Circuits" by Robert J. Matthys, Krieger Publishing Company, 1992. It is described in Sec. 11.3 "TTL Two-Inverters-7404", pp. 160ff. This kind of oscillators are described as "waveforms are fairly good" and "relatively insensitive to power supply and temperature" but "many versions of this oscillator are poorly designed".

The idea is: a single resistor feedback around the inverter is acceptable only in the second one, but not in the first. The reason is that a TTL gate has a gain of 10X, but because of feedback, the 470 Ohm resistance has a dynamic impedance of 470 Ohm at the extremes, but only 47 Ohm when transitioning. Such unequal load is not aceptable as a crystal load.

Hence the peculiar feedback around the first inverter. The resistor-capacitor tee is used to reflect the load RL to the crystal the whole oscillation cycle. This very much reduces distortion (and is recommended also for CMOS inverter oscillators). The shunt resistor R3 has two functions: pulling the inverter into the transition region, so both the input and the output of the inverter are somewhere near 1.6V. Second, to trim the duty cycle of the oscillator to a perfect 50/50 ratio.

Now the circuit given is designed for operation at 1Mhz, whit crystal resistance of 240 Ohm (therefore, RL = 220, a little less). At 32Khz, the load resistance should be around 20K, so RL should be set to that value or a little less. I have no TTL inverters at hand, nor the time to test this circuit, but maybe it can help. Anyway, my guess would be RL = 18K, R3=200K.

« Last Edit: January 31, 2016, 10:29:21 pm by orolo »
 
The following users thanked this post: ali6x944

Offline uncle_bob

  • Supporter
  • ****
  • Posts: 2441
  • Country: us
Re: is it possible? a crystal oscillator from SN74LS04 TTL hex inverter
« Reply #32 on: January 31, 2016, 10:35:33 pm »
Hi

A few bits of terminology in terms of crystal oscillators:

A crystal operates into a load capacitance. That is the value that the manufacturer used when the set it to frequency. It will work into a wide range of load C.

A crystal's equivalent circuit has four basic elements. The easy one is the capacitance across the device, often called C0. The rest of the model is a series circuit made up of Lm, Cm, and Rm (also called C1, L1 and R1). One way to look at Rm is that it is the impedance of the device when run at series resonance. That's not exactly correct (C0 gets in there) but it is a start. Since you operate the crystal into a load C, it's not going to be at series resonance. The effective resistance will actually be higher (strange but true).

You can analyze an oscillator circuit a lot of different ways. The net result is always the same. If it is a stable oscillator, the losses in the circuit are perfectly made up by the gain of the circuit. If you want to think in terms of 10K ohms of loss, then the oscillator will provide -10K ohms of negative resistance from it's gain. 

A *much* more common way to do the analysis is to split the gain transistor in half. The base to emitter side is split from the emitter to collector side. You move a ground to the emitter to to this and re-arange the rest of the circuit. The resultant circuit must have zero phase (or zero phase modulo 360 degrees) and gain at the crystal's frequency. Good old LT Spice will let you run through this once you know the right numbers for your crystal. Some 32 KHz crystals have Rm up around 150K ohms, Q's in the 100,000 range are doing quite well. C0 of a pf or two is not unusual.

Lots of fun.

Bob
 
The following users thanked this post: ali6x944

Offline alsetalokin4017

  • Super Contributor
  • ***
  • Posts: 2055
  • Country: us
Re: is it possible? a crystal oscillator from SN74LS04 TTL hex inverter
« Reply #33 on: February 01, 2016, 02:59:11 am »
I remembered reading something about TTL xtal oscillators and problems with variable impedances, and, after some digging, found it.

The schematic attached is taken from "Crystal Oscillator Circuits" by Robert J. Matthys, Krieger Publishing Company, 1992. It is described in Sec. 11.3 "TTL Two-Inverters-7404", pp. 160ff. This kind of oscillators are described as "waveforms are fairly good" and "relatively insensitive to power supply and temperature" but "many versions of this oscillator are poorly designed".

The idea is: a single resistor feedback around the inverter is acceptable only in the second one, but not in the first. The reason is that a TTL gate has a gain of 10X, but because of feedback, the 470 Ohm resistance has a dynamic impedance of 470 Ohm at the extremes, but only 47 Ohm when transitioning. Such unequal load is not aceptable as a crystal load.

Hence the peculiar feedback around the first inverter. The resistor-capacitor tee is used to reflect the load RL to the crystal the whole oscillation cycle. This very much reduces distortion (and is recommended also for CMOS inverter oscillators). The shunt resistor R3 has two functions: pulling the inverter into the transition region, so both the input and the output of the inverter are somewhere near 1.6V. Second, to trim the duty cycle of the oscillator to a perfect 50/50 ratio.

Now the circuit given is designed for operation at 1Mhz, whit crystal resistance of 240 Ohm (therefore, RL = 220, a little less). At 32Khz, the load resistance should be around 20K, so RL should be set to that value or a little less. I have no TTL inverters at hand, nor the time to test this circuit, but maybe it can help. Anyway, my guess would be RL = 18K, R3=200K.

Using the resistor values you suggested, I could not get the circuit to work using generic unbranded 7404 or TI SN7404N. However it did "sort of" work with TI SN74LS04J and worked fairly well with RCA SN74HCT04E. Using about 2 1/2 volts for Vcc for LS and 3-5 V for HCT.  See the scopeshots below. I tied unused gates to ground and used a 100nF local decoupling cap across pins 14 and 7.

118=SN74HCT04E
119=SN74LS04J


The easiest person to fool is yourself. -- Richard Feynman
 
The following users thanked this post: ali6x944

Offline orolo

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: es
Re: is it possible? a crystal oscillator from SN74LS04 TTL hex inverter
« Reply #34 on: February 01, 2016, 07:27:55 pm »
Using the resistor values you suggested, I could not get the circuit to work using generic unbranded 7404 or TI SN7404N. However it did "sort of" work with TI SN74LS04J and worked fairly well with RCA SN74HCT04E. Using about 2 1/2 volts for Vcc for LS and 3-5 V for HCT.  See the scopeshots below. I tied unused gates to ground and used a 100nF local decoupling cap across pins 14 and 7.

118=SN74HCT04E
119=SN74LS04J
Whoa! Thank you for the tests, they are wonderful. Today at work I asked a kind friend with a stock of old ICs for 74LS04Ns, and he borrowed me two. I think they are Signetics dated '78 and '79! Okay, I set up a quick test, and failed to start the oscillator with the resistors I suggested. So I changed R3 and RL by pots, and started tweaking until I found a rather consistent circuit.

The values that worked for me are:  R1 = 2.2K (I didn't have 1.8K at hand, too lazy to use two resistors.) R3 = 15K. RL = 13K. R2 = 470 as suggested by the book. The 13K value for RL is reasonable: looking up the series resistance of 32Khz crystals, I found 18K being a typical value. I tried both 7404s and the oscillator worked. I also tried three crystals, and worked for them all. I have attached a waveform capture with my cheap 'scope, and a picture of the circuit.

Some comments: the circuit sometimes locks to an harmonic (the fifth in my case), and oscillates heavily without the crystal. The duty cycle is not good: when I tweaked R3 to reach 50/50, the short pulses before and after the main waveform that plagued your  SN74LS04J appeared. Some of these effects may relate to parasitics in the circuit, but perhaps the two TTL stages have not enough gain to drive the load of the crystal. I wonder what would happen if two more inverters were added, for additional gain.

Thanks again for the experiments!
« Last Edit: February 01, 2016, 07:30:23 pm by orolo »
 
The following users thanked this post: ali6x944

Offline ali6x944Topic starter

  • Frequent Contributor
  • **
  • Posts: 567
  • Country: sa
Re: is it possible? a crystal oscillator from SN74LS04 TTL hex inverter
« Reply #35 on: February 05, 2016, 08:55:05 am »
thanks guys, really good explanation and documentation!
u r the best!  :-+ ;) 
 

Offline orolo

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: es
Re: is it possible? a crystal oscillator from SN74LS04 TTL hex inverter
« Reply #36 on: February 05, 2016, 10:35:05 pm »
Just to bring some closure to the topic, you mentioned you had at hand a 74HC00. I think TTL, as chris_leyson mentioned early on, is not good for 32768Khz: the low input impedance spoils the Q of the oscillator big time. Why don't you try Pierce with 74HC00?

I have done just that in about half a hour, with the only problem of some ringing in the transitions, which I haven't bothered to track down. The schematic, image of the prototype and 'scope capture are attached. The duty cycle and stability are greatly improved in comparison to the TTL circuit above!

 
The following users thanked this post: ali6x944

Offline ali6x944Topic starter

  • Frequent Contributor
  • **
  • Posts: 567
  • Country: sa
Re: is it possible? a crystal oscillator from SN74LS04 TTL hex inverter
« Reply #37 on: February 06, 2016, 05:45:54 am »
i looked at the second schematic and it worked just fine like the first one...
but i was wondering why did u use a NAND 74HC00 instead of NOR 74HC32 ?
will it make any difference ?
and why didn't u connect both inputs of the 74HC00 together to form an inverter?
 

Offline orolo

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: es
Re: is it possible? a crystal oscillator from SN74LS04 TTL hex inverter
« Reply #38 on: February 06, 2016, 10:52:09 am »
but i was wondering why did u use a NAND 74HC00 instead of NOR 74HC32 ?
will it make any difference ?
Well, some posts back you mentioned you had some 74HC00s but you couldn't make the two-inverter circuit to work. With CMOS inverters I thought it was better to use Pierce instead of the two-inverter circuit. Using NOR gates should not make any difference at all, any high-impedance inverter circuit with enough gain should work.
and why didn't u connect both inputs of the 74HC00 together to form an inverter?
I guess it would not make any difference, but since I had the power rails close to the gate inputs, I preferred to have as many inputs in a fixed state as possible. In fact, the normal arrangement is with both inputs connected, as you mention. Just to make sure there is not difference, I'll try with both inputs connected and let you know. Thank you for being so thorough.
 
The following users thanked this post: ali6x944

Offline ali6x944Topic starter

  • Frequent Contributor
  • **
  • Posts: 567
  • Country: sa
Re: is it possible? a crystal oscillator from SN74LS04 TTL hex inverter
« Reply #39 on: February 06, 2016, 10:57:43 am »
thanks man for all the info, it was very helpful!  :-+
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf