Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 00:11 31 Jan 2026 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Crystal Oscillator query

     Page 1 of 2    
Author Message
Bowden_P
Senior Member

Joined: 20/03/2019
Location: United Kingdom
Posts: 169
Posted: 10:37pm 26 Jan 2026
Copy link to clipboard 
Print this post

Hi,
I am looking for advice on how to use a small SMD quartz crystal with a Microchip micro's on-chip oscillator module, seeeking to get the drive level within the crystal's spec.

I am intending to use an ABRACON ABM3 20MHz SMD crystal, with a PIC16F1779 micro. The crystal has a drive level spec. of 10uW typical, 100uW max, with an ESR of typically 30 Ohms, and a load capacitance of 18pF.

The micro's spec. doesn't mention any oscillator o/p amplitude, but if I assume an o/p swing of 2V peak-to-peak, this equates to 0.707V rms. With an ESR of 30 Ohms this will make a drive level of 16.6mW to the crystal, way over its max spec.

I gather a series resistor can be added to reduce this. If I assume a drive level of about 30uW would be OK, this is equivalent to 30mV rms, or about 1/24 of the oscillator o/p.

So, if I add a series resistor of 24 x 30 Ohms, or about 720 Ohms, does this fix the drive level problem?
Or are these calculations plain wrong!

With best regards, Paul.
Nothing so constant as change.
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2958
Posted: 11:04pm 26 Jan 2026
Copy link to clipboard 
Print this post

  Quote  if I assume an o/p swing of 2V peak-to-peak, this equates to 0.707V rms. With an ESR of 30 Ohms this will make a drive level of 16.6mW to the crystal, way over its max spec.

That output swing is with respect to ground, but the other end of the crystal isn't connected to ground.
The clock input pin may be a fairly high impedance even at the crystal operating frequency.
The datasheet for the micro might have some information regarding that and what sort of crystal is needed. Sometimes loading capacitors are needed on either side of the crystal which could complicate things further.
 
Bowden_P
Senior Member

Joined: 20/03/2019
Location: United Kingdom
Posts: 169
Posted: 11:34pm 26 Jan 2026
Copy link to clipboard 
Print this post

Hi Phil99,
Thanks for your reply.

The output swing will be somewhere between Gnd and Vdd, but I doubt it will be that amplitude, hence my assumption of 2V pk-pk. Just a guess, however.

I don't know what effect the loading caps. will have either, but are usually the same as the 18pF crystal load value.

In past projects I have used crystals in small metal can-type packages with wire leads, and haven't worried about drive levels or load caps. For this project reliability is more important, hence my query!

With best regards, Paul.
Nothing so constant as change.
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2958
Posted: 11:57pm 26 Jan 2026
Copy link to clipboard 
Print this post

Page 104 of the Microchip PIC16(L)F1777/8/9 datasheet has a little info, but for "low drive level" crystals says consult the crystal datasheet.
 
Bowden_P
Senior Member

Joined: 20/03/2019
Location: United Kingdom
Posts: 169
Posted: 01:02am 27 Jan 2026
Copy link to clipboard 
Print this post

Hi Phil,
Yes, I looked up the ABRACON site. They suggested using a current probe to measure crystal current in order to calculate the required series resistor, or a more suck-it-and-see approach of increasing the resistor value until it stops oscillating, then divide that value by the crystal ESR to get a Gain Margin for the oscillator amplifier.

Not sure what I would do with that. The resistor and the o/p load cap. form a voltage divider, so as you say it gets complicated here.

Thanks for your interest, Paul.
Nothing so constant as change.
 
mozzie
Senior Member

Joined: 15/06/2020
Location: Australia
Posts: 197
Posted: 01:18am 27 Jan 2026
Copy link to clipboard 
Print this post

G'day Paul,
It might pay to take a look at AN588, this will hopefully steer you in the right direction.

AN00588

Regards,
Lyle.
Edited 2026-01-27 11:19 by mozzie
 
Bowden_P
Senior Member

Joined: 20/03/2019
Location: United Kingdom
Posts: 169
Posted: 01:54am 27 Jan 2026
Copy link to clipboard 
Print this post

Hi Mozzie,
Thanks for the link, I'll give it a good read.
This topic gets more complicated than I thought.

Before now I just connected a crystal, and it always worked, but now I'm a bit more concerned about getting it right.

With best regards, Paul.
Nothing so constant as change.
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5646
Posted: 07:14am 27 Jan 2026
Copy link to clipboard 
Print this post

Paul,

Not all crystal oscillator circuits inside micro's are capable of working with these low power crystals. The resistor value you calculated is in the ballpark. Typical values for low power crystals can be 1k to 4k.

Then, before you settle on a value, try to run the circuit warm (+50C) and cold (-20C) with a resistor dual the value (so if you goal for 1k, use a 2k resistor).
Most important in these tests is to make sure the micro starts up cold and warm.

A 18pf low power crystal is not easy to use. You most likely end up with 2 x 33pf (or 27pf). The 2k resistor in combination with the 33pf load capacitors give quite some phase shift. That is why most low power crystals are 12pf.

Happy Engineering

Volhout

P.S. check 3.5.2 and 3.5.3 of attached ST document on how to measure drive level with simple means. A 1pF probe is used, but if you have a probe that is 10pF input, you can change the 33pf board capacitor (for the test only) with 22pF, parallel to the probe.


cd00221665-oscillator-design-guide-for-stm8af-al-s-stm32-mcus-and-mpus-stmicroelectronics.zip
Edited 2026-01-27 17:29 by Volhout
PicomiteVGA PETSCII ROBOTS
 
bfwolf
Senior Member

Joined: 03/01/2025
Location: Germany
Posts: 153
Posted: 12:19pm 27 Jan 2026
Copy link to clipboard 
Print this post

  Volhout said  
...
cd00221665-oscillator-design-guide-for-stm8af-al-s-stm32-mcus-and-mpus-stmicroelectronics.zip


A really interesting document!

I only skimmed it, but I think I'll take a closer look at it when it's "the time".

Perhaps the crystal circuit could also be simulated with SPICE if some parameters (such as the oscillator impedances in the microcontroller) are found "reasonably accurately" in the datasheet?

https://www.analog.com/en/resources/design-tools-and-calculators/ltspice-simulator.html
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 8477
Posted: 12:33pm 27 Jan 2026
Copy link to clipboard 
Print this post

Oscillator modules did away with the messing about. Give it a supply, accept the clock off it. Done. It adds a little to the cost and takes a little more board area, but end results are more predictable and often more stable.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5646
Posted: 01:59pm 27 Jan 2026
Copy link to clipboard 
Print this post

Paul,

There is one important thing to keep in mind when designing your own crystal oscillator. In the PCB layout:
- keep traces between crystal and chip as short as possible.
- keep a continuous ground plane directly under the crystal and capacitors, and connect that to the nearest GND pin of the chip.
- absolutely avoid digital signals running under the crystal oscillator.

These things are needed to keep noise away from the crystal oscillator. Noise in the crystal oscillator (results in phase noise) is killing PLL stability. If you violate above rules, you may end up with a system that either does not work, or that "seems" to work but critical functions don't for some "unknown" reason. PLL's that jitter, or lock/unlock impact all timing critical functions (displays, SPI, USB, ADC's, ethernet, DRAM etc...)

A possible example is the early CMM2 with waveshare STM32H743 board that refused to lock on some VGA resolutions, something that got fixed when an externa oscillator was soldered on the board.

Volhout
Edited 2026-01-28 00:01 by Volhout
PicomiteVGA PETSCII ROBOTS
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10914
Posted: 02:19pm 27 Jan 2026
Copy link to clipboard 
Print this post

  Quote  Oscillator modules did away with the messing about. Give it a supply, accept the clock off it. Done. It adds a little to the cost and takes a little more board area, but end results are more predictable and often more stable.


Just found this. definitely one for the next version of the cmm2 rather than the clock crystal
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 8477
Posted: 03:42pm 27 Jan 2026
Copy link to clipboard 
Print this post

That's nice and neat. Probably cheaper than a clock crystal now too. :) Certainly more robust.

I've laid out CPU clocks on boards in the past but I wouldn't bother now. Too much hassle. By the time you have a crystal plus 2 caps with a guard band or even just a wobbly ceramic resonator you may as well put a module in if there's one available for the frequency you need.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
tgerbic
Senior Member

Joined: 25/07/2019
Location: United States
Posts: 102
Posted: 09:39pm 27 Jan 2026
Copy link to clipboard 
Print this post

One other thing to remember when using crystals with a microprocessor. If possible, measure the frequency at some other pins than those the crystal is connected to. May be at half or quarter frequency but the point is that the test equipment leads may introduce enough capacitance or resistance to alter the frequency making it seem the crystal is a little off frequency. If this is not possible, measure the frequency at both pins and one (which may have an internal driver attached) will give a better frequency reading.
 
Bowden_P
Senior Member

Joined: 20/03/2019
Location: United Kingdom
Posts: 169
Posted: 01:39am 28 Jan 2026
Copy link to clipboard 
Print this post

Hi,
Many thanks for all replies here. Looks like I may have chosen possibly the worst crystal for my PIC!

The app. note posted by Volhout looks very informative - I'll have to study it.
Unfortunately I can't measure the crystal drive as the note suggested, as I don't have a current probe, and my 'scope will run out of bandwidth at 20MHz.

The suggestion by Mixtel90 to use a clock module instead looks a promising solution, so I'll do the research on that. Previously rejected that on cost grounds, but reliability for this project is important, so may have to change my ideas.

Fortunately I have an earth plane in the board design, so grounding will be built-in for any layout mods. At the moment I don't have a guard ring, but there is enough space to add it, with a bit of shuffling of other components.

As an aside, I have recently received another board for this project made by JLCPCB - my first ever own layout. Looks very nice with its gold flashed pads! They approved it for manufacture within 15 minutes of receiving the files, and I had the boards in my hands in 6 days, which included New Year's day! Quite amazing really.

Many thanks again for all your information and wisdom, which will help me greatly to get to the right solution.

With best regards, Paul.
Nothing so constant as change.
 
zeitfest
Guru

Joined: 31/07/2019
Location: Australia
Posts: 655
Posted: 01:41am 28 Jan 2026
Copy link to clipboard 
Print this post

  Mixtel90 said  Oscillator modules did away with the messing about. Give it a supply, accept the clock off it. Done. It adds a little to the cost and takes a little more board area, but end results are more predictable and often more stable.

Definitely.

Microchip processor cards used them to bypass problems with low power higher frequency crystal oscillators.

eg  (very small)

mems
was used for MZ2048 , I copied it for a pcb which worked OK.
 
Bowden_P
Senior Member

Joined: 20/03/2019
Location: United Kingdom
Posts: 169
Posted: 02:18am 28 Jan 2026
Copy link to clipboard 
Print this post

Hi,
A quick skoot through Farnell's Standard Oscillator range gives 4230219 at £1.48, or 9713670 at £2.02 for a bit more stability. At 7mm x 5mm I can just drop one into the space currently housing the ABRACON crystal.

So, a very likely solution!

With best regards, Paul.
Nothing so constant as change.
 
bfwolf
Senior Member

Joined: 03/01/2025
Location: Germany
Posts: 153
Posted: 12:19pm 28 Jan 2026
Copy link to clipboard 
Print this post

  matherp said  
  Quote  Oscillator modules did away with the messing about. Give it a supply, accept the clock off it. Done. It adds a little to the cost and takes a little more board area, but end results are more predictable and often more stable.


Just found this. definitely one for the next version of the cmm2 rather than the clock crystal


I took a look at this device out of curiosity:

"Start-up time 1 (typ) 3 (max) sec" ??

That's very long. Are they all that slow in this segment?

OK: Power Supply Current (Typical) 1.05 µA @ 2.5V to 2.05 µA @ 5V is indeed "very low power"...

But this would need to be taken into account, and the chip that's being clocked might need to be kept in reset mode for that long using an external circuit.
Edited 2026-01-28 22:21 by bfwolf
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10914
Posted: 12:43pm 28 Jan 2026
Copy link to clipboard 
Print this post

  Quote  But this would need to be taken into account, and the chip that's being clocked might need to be kept in reset mode for that long using an external circuit.

External battery for the oscillator together with the rtc circuit in the uP. Then it keeps time perfectly.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 8477
Posted: 01:35pm 28 Jan 2026
Copy link to clipboard 
Print this post

If the chip that's being clocked is waiting for its first clock cycle then I suppose it's a bit irrelevant whether it's held in reset mode or not as it probably won't be doing much. :)

We used to temporarily stop the Z80 clock to let DMA happen. The Z80 knows nothing about it and just carries on when the clock is restored.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
     Page 1 of 2    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026