Just a quick post on oscillators – about every recent microcontroller out there has an oscillator circuit built in, so you just add a crystal with capacitors (sometimes optional) and the MCU does the rest. But what happens for devices that don’t have the oscillator circuit built in, such as a low end CPLD?
We have two choices – purchase a crystal oscillator or build one yourself. Seeing how I don’t have a crystal oscillator handy, I thought I’d build one.
The configuration I’ll be using is the pierce one, where you have a inverter, a large value resistor such as 1M and the crystal with two capacitors.
I’m using a 74HC04N hex inverter with a 20 MHz crystal and I found that 16pF capacitors worked well. On the output I’m also using another inverter for a buffer connected to my scope. One downside to this approach is that the 74HC04N seems to be drawing about 6mA during operation.
Spot on 20MHz, nice.
Here’s how it looks when it’s power on, probably about 200-300uS until it’s stable.
I found that if I put a capacitor (tested with 0.1uF and 4.7uF) or measured the voltage with my multimeter across the 1M resistor, the frequency changed to 30-32MHz.