Crystal Clock Circuit, Extal and Xtal and Differences.

Thread Starter

tony tipo80

Joined Feb 11, 2016
4
Hi guys

I'm looking for a very basic explanation on how a crystal circuit is designed to generate a clock pulse that drives an 8bit CPU. I gather from reading around that a 4pin Crystal Oscillator is a total package set to produce a certain frequency. What I am trying to comprehend is how to generate a clock pulse using a 2pin stand alone crystal with whatever passive components and or inverters. I recently came across a 6809 that has Extal and Xtal pins with a crystal across both pins grounded via two capacitors. (I believe this is used to produce an external clock pulse?)

So if possible can somebody please explain
1) The design of a stand alone 2 pin crystal circuit that produces a square clock wave (not a 4pin crystal oscillator)
2) How and what the crystal does when connected to cpu pins Extal and Xtal via capacitors.

Thanks
 

k1ng 1337

Joined Sep 11, 2020
539
Ericgribb's second pdf shows the popular crystal (Pierce) oscillator circuit in Figure 3. You can use the output for anything you like such as a clock signal.

In the case of the device you mentioned as well as microcontrollers such as Arduino Uno, all you need to do is connect a discreet crystal and two 'load' capacitors to the two XTAL pins to complete the circuit as the other components are already on the chip.

As far as I know, when you see XTAL pins, it's asking for a discreet external crystal to generate a clock signal which is not to be confused with a compete crystal oscillator package that only requires external power connections to operate. Microcontrollers such as the Arduino uno give the option to save money and avoid the crystal altogether by enabling the internal RC oscillator.

The ATTiny85 by default runs at 1MHz via it's internal RC oscillator. Note the XTAL pins provide the option for a crystal for accurate timing or you can use the pins for other things if timing isn't important. Datasheets will show if and when a clock source is needed.

ATTiny85.jpg
 
Last edited:

Papabravo

Joined Feb 24, 2006
18,431
The basic component inside an IC like the 6809 is an inverting amplifier. This amplifier along with some load capacitance wants to oscillate at a particular frequency determined by the electromechanical properties of the crystal. A crystal has an equivalent circuit that can be modeled with inductance, capacitance and resistance. Like this:

1653483583096.png
1653483700768.png
 

Thread Starter

tony tipo80

Joined Feb 11, 2016
4
example extal.png
The basic component inside an IC like the 6809 is an inverting amplifier. This amplifier along with some load capacitance wants to oscillate at a particular frequency determined by the electromechanical properties of the crystal. A crystal has an equivalent circuit that can be modeled with inductance, capacitance and resistance. Like this:

Thanks for reply and the circuit comparison Papabravo, but all of the above is a little two over my paygrade ATM. So lets back up a lot to a beginner level, and if the above is a basic explanation then I guess ill have no hope!. What I am trying to ascertain initially is a breakdown of the how the signal is generated from the circuit I uploaded. Lets start with

1)What powers this crystal to begin oscillating, is it coming from one of the caps connected to ground into or somehow from the 6809.?

2) This is a DC circuit so from reading I gather that the inductor only allows Dc through so I assume the sin wave generated by the crystal gets converted to Dc but after that I'm lost as to how it proceeds to move through the capacitor then out to create a clock signal.?

3) Does the crystal given its connected across both TAL pins enter in via the xtal and out via the extal or vice versa.

3) What do the capacitors at ground do and why are they grounded.

View attachment 267973
View attachment 267974
 
Last edited:

Thread Starter

tony tipo80

Joined Feb 11, 2016
4
Hi guys

I'm looking for a very basic explanation on how a crystal circuit is designed to generate a clock pulse that drives an 8bit CPU. I gather from reading around that a 4pin Crystal Oscillator is a total package set to produce a certain frequency. What I am trying to comprehend is how to generate a clock pulse using a 2pin stand alone crystal with whatever passive components and or inverters. I recently came across a 6809 that has Extal and Xtal pins with a crystal across both pins grounded via two capacitors. (I believe this is used to produce an external clock pulse?)

So if possible can somebody please explain
1) The design of a stand alone 2 pin crystal circuit that produces a square clock wave (not a 4pin crystal oscillator)
2) How and what the crystal does when connected to cpu pins Extal and Xtal via capacitors.

Thanks
Hi guys

I'm looking for a very basic explanation on how a crystal circuit is designed to generate a clock pulse that drives an 8bit CPU. I gather from reading around that a 4pin Crystal Oscillator is a total package set to produce a certain frequency. What I am trying to comprehend is how to generate a clock pulse using a 2pin stand alone crystal with whatever passive components and or inverters. I recently came across a 6809 that has Extal and Xtal pins with a crystal across both pins grounded via two capacitors. (I believe this is used to produce an external clock pulse?)

So if possible can somebody please explain
1) The design of a stand alone 2 pin crystal circuit that produces a square clock wave (not a 4pin crystal oscillator)
2) How and what the crystal does when connected to cpu pins Extal and Xtal via capacitors.

Thanks
Eric I did try and attempt to read the documentaion however a little too technical for me at this stage, thankyou for trying to assist though.
 

Papabravo

Joined Feb 24, 2006
18,431
OK, Let's try something a bit less challenging. The circuit below is called a relaxation oscillator. It involves an amplifier, a resistor, and a capacitor. It cycles between charging a capacitor when the output is high and discharging the capacitor when the output is low.

1653574387914.png
The first line in black text defines the parameters of the inverting amplifier A1. Td is propagation delay. Vhigh is the high level output voltage. Trise is the rise time of the output. Vt is the threshold, and Vh gives the hysteresis. So the thresholds for the amplifier A1, are 2.5+1.25=3.75, and 2.5-1.25=1.25. The second line in blue, shows how to calculate the frequency from the values of R and C.

If you replace R1 and C1 with a crystal and some load capacitance you have the same thing as the microprocessor circuit, but at a significantly higher frequency.
 

Thread Starter

tony tipo80

Joined Feb 11, 2016
4
OK, Let's try something a bit less challenging. The circuit below is called a relaxation oscillator. It involves an amplifier, a resistor, and a capacitor. It cycles between charging a capacitor when the output is high and discharging the capacitor when the output is low.

View attachment 268055
The first line in black text defines the parameters of the inverting amplifier A1. Td is propagation delay. Vhigh is the high level output voltage. Trise is the rise time of the output. Vt is the threshold, and Vh gives the hysteresis. So the thresholds for the amplifier A1, are 2.5+1.25=3.75, and 2.5-1.25=1.25. The second line in blue, shows how to calculate the frequency from the values of R and C.

If you replace R1 and C1 with a crystal and some load capacitance you have the same thing as the microprocessor circuit, but at a significantly higher frequency.
Thank you PB, this made more sense, tbh I spent all of yesterday reading up on this and I think I have a better grasp now. Having a look at the original diagram you posted I now understand the LC/R with respect to the crystal properties. Essentially as the cap charges then begins to discharge the inductor opposes the change by reversing polarity creating a sinwave (process repeats). Same concept as a crystal. We do experience some loss of signal due to the natural resistance of the crystal and as a result we need an AMP, (inverter or Op amp) to make up the signal loss via its gain in order to keep the signal amplitude constant. The output is sent back through the crystal and the amp input less the gain, via a resistor, (I believe this is negative feedback with respect to the amp) and the process repeats.

Now I am a little stuck on the phase side of things from my reading, this is what I have gathered -the phase of an op amp (also a ttl inverter? not sure) is 180 degrees
(From what I have gathered phase refers to when both signals sync -touch)

The feedback resistor makes up one half 180 degrees of the signal and the caps connected to the crystal make the other 180 up making the signal 360 degrees in phase or 0 degrees out of phase.

If im on the money could you please explain the feedback phase process a little more clearly . Why is the feedback connected to the negative side of the op amp (and the positive side is grounded) I assume its because we are taking the gain off the signal, however from my limited knowledge the negative side of the op amp will produce a negative output if its higher than the non inverting pin(+) so wouldn't it just produce a low output.? if so how do we get a positive-negative clock signal.

With regard to the caps making up the phase differential are they just boosting the signal coming back into the crystal from the output, to keep the sin amplitude at the right level.

I think the penny has dropped a little although I'm still stuck on the phase feedback side of things.

Many thanks TB
 

Papabravo

Joined Feb 24, 2006
18,431
Thank you PB, this made more sense, tbh I spent all of yesterday reading up on this and I think I have a better grasp now. Having a look at the original diagram you posted I now understand the LC/R with respect to the crystal properties. Essentially as the cap charges then begins to discharge the inductor opposes the change by reversing polarity creating a sinwave (process repeats). Same concept as a crystal. We do experience some loss of signal due to the natural resistance of the crystal and as a result we need an AMP, (inverter or Op amp) to make up the signal loss via its gain in order to keep the signal amplitude constant. The output is sent back through the crystal and the amp input less the gain, via a resistor, (I believe this is negative feedback with respect to the amp) and the process repeats.

Now I am a little stuck on the phase side of things from my reading, this is what I have gathered -the phase of an op amp (also a ttl inverter? not sure) is 180 degrees
(From what I have gathered phase refers to when both signals sync -touch)

The feedback resistor makes up one half 180 degrees of the signal and the caps connected to the crystal make the other 180 up making the signal 360 degrees in phase or 0 degrees out of phase.

If im on the money could you please explain the feedback phase process a little more clearly . Why is the feedback connected to the negative side of the op amp (and the positive side is grounded) I assume its because we are taking the gain off the signal, however from my limited knowledge the negative side of the op amp will produce a negative output if its higher than the non inverting pin(+) so wouldn't it just produce a low output.? if so how do we get a positive-negative clock signal.

With regard to the caps making up the phase differential are they just boosting the signal coming back into the crystal from the output, to keep the sin amplitude at the right level.

I think the penny has dropped a little although I'm still stuck on the phase feedback side of things.

Many thanks TB
The A1 device in the relaxation oscillator is not an opamp. It is a special purpose digital device with a Schmitt trigger characteristic.
https://en.wikipedia.org/wiki/Schmitt_trigger. The pin showing the connection to ground is a "common" pin which is not required to be connected to anything. This is the quote from the LTspice help pages.

A. Special Functions
Symbol names: INV, BUF, AND, OR, XOR, SCHMITT, SCHMTBUF, SCHMTINV, DFLOP, VARISTOR, and MODULATE

Syntax: Annn n001 n002 n003 n004 n005 n006 n007 n008 <model> [instance parameters]

These are Linear Technology Corporation's proprietary special function/mixed mode simulation devices. Most of these and their behavior are undocumented as they frequently change with each new set of models available for LTspice. However, here we document some of them because of their general interest.

INV, BUF, AND, OR, and XOR are generic idealized behavioral gates. All gates are netlisted with eight terminals. These gates require no external power. Current is sourced or sunk from the complementary outputs, terminals 6 and 7, and returned through device common, terminal 8. Terminals 1 through 5 are inputs. Unused inputs and outputs are to be connected to terminal 8. The digital device compiler recognizes that as a flag that that terminal is not used and removes it from the simulation. This leads to the potentially confusing situation where AND gates act differently when an input is grounded or at zero volts. If ground is the gate's common, then the grounded input is not at a logic false condition, but simply not part of the simulation. The reason that these gates are implemented like that is that this allows one device to act as 2-, 3-, 4- or 5- input gates with true, inverted, or complementary output with no simulation speed penalty for unused terminals. That is, the AND device acts as 12 different types of AND gates. The gates default to 0V/1V logic with a logic threshold of .5V, no propagation delay, and a 1Ohm output impedance.
 
Top