I made a circuit where the microcontroller works. I made a duplicate of the same circuit with a working micro, but that circuit does not start and there is no smoke and the PCB is clean (no loose wires touching in bad places) So I suspect my problem is the crystal circuitry.

In my micro setup (as with any other 8051 micro), I have an external crystal connected close to the micro's XTAL1 and XTAL 2 pins and each of those pins are grounded through the ceramic capacitors.

Since I use a socket for my micro IC to insert into, I want to make an in-circuit crystal "tester" circuit so that I can touch probes to the correct metal pins of my micro IC (representing XTAL1 and XTAL2 and GND). I want this tester circuit to distinguish between a working and a non-oscillating crystal arrangement.

I looked up pierce oscillators online and based on schematics, the only way I could see me possibly pull this off is to use some sort of inverter from a logic IC like this:

Inverter oscillator

and hooking up its output to something (555 timer?) to lower the frequency and output that to a speaker so I hear a screech if the crystal works.

Could I use a 74HC04 inverter here to complete the tester without any issues in the inverter not handling the 24 MHz crystal frequency?

Also, what should the maximum length be for the test wires if the wires were at 24AWG thickness before the crystal circuit doesn't function correctly?

For clarification, in my test, C1, C2, and X1 are already soldered on to the target board.

  • \$\begingroup\$ You may need some extra phaseshift, to ensure oscillation. Add 1Kohm from Inverter output to top of C2. \$\endgroup\$ Commented May 25, 2019 at 3:42

3 Answers 3


An oscillating crystal generates a sine wave, which cannot be amplified very well by a normal digital logic inverter (especially if it has hysteresis).

A Pierce oscillator works better with an unbuffered inverter (U04 instead of 04), which has a linear operating region:

unbuffered inverter VO vs. VI
source: SN74LVC1GX04 datasheet

SN74LVC1GU04 typical application
source: SN74LVC1GU04 datasheet

The additional inverter at the output converts the sine wave into a digital signal. (The SN74LVC1GX04 combines both inverters.)

Every microcontroller datasheet tells you that the traces between the crystal and the chip must be as short as possible; using leads of any length is likely to break the oscillation, and even the socket might be a problem.

For how to choose the components, see, e.g., Use of the CMOS Unbuffered Inverter in Oscillator Circuits.

  • \$\begingroup\$ "...using leads of any length is likely to break the oscillation..." Damn. Well its a good thing I'm replacing my 20% tolerance caps with 5% once because now I probably have a big amount of parasitic capacitance since I am using a socket for my micro. Why? well because if I make a mistake in my code, then I don't want to have to desolder the micro just to change the code on it. \$\endgroup\$ Commented May 26, 2019 at 3:36

Theoretically you should use the unbuffered 74HCU04 because it has less delay and is more linear. I tried your circuit with both gate types, using a 1MΩ resistor and 18pF capacitors, and a variety of 24MHz crystals. I fed the output through two extra buffers in the IC to square up the signal and isolate the oscillator from the load.

The 74HC04 worked with all my crystals except one, but with poor symmetry (duty cycle ratio was closer to 70/30 than 50/50). Worse, when it didn't work it oscillated at ~40MHz whether the crystal was installed or not, which makes it pretty useless as a 'go/no-go' crystal tester.

The 74HCU04 worked with all of the crystals, had better symmetry, and didn't oscillate when the crystal was removed. I also tried it with a 27MHz and 16MHz crystal, and it worked well with them too.

If you don't have an oscilloscope and want to check that the circuit is actually oscillating (rather than just sitting at about 2.5V DC) you could use a counter such as the 74HC4060 to divide the square wave down to an audible frequency.


Cypress quotes up to 25MHz from external Xtal.

Your best advice comes here enter image description here Using any other CMOS device will not prove that it works on an 8051 unless it is exactly the same lithographic and gate size, unless you do some comparative research and test to match them.

Drive Level = I² * ESR
Drive level does vary with load capacitance.

If you are having troubles boost the voltage to 5.5. This is the upper Vdd limit and that boosts the linear gain RdsOn and slew rate.

The Series R also performs a LPF effect with the series R. So smaller C1 than needed may reduce attenuation at 25MHz. ( 10pF)

However, I suspect the 25MHz is a lower impedance Xtal so the series R will degrade the gain too much, which is why Cypress does not show one.

Although one thinks 10uW max seems pretty small, but what happens inside the Xtal is the signal is boosted inside the Xtal by 10k times then back down again. The motional capacitance can have x kV inside it but not connected to the electrodes.

But the drive power is thru the ESR, not the motional capacitance with is reactive gain.

My best advice, is if any of this confuses you buy the 25MHz Xtal OScillator chip. They are cheap and reliable. You can figure out how to make the necessary PCB Mods with AWG 30 very short magnet wire. enter image description here enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.