Time to take a look at clocks, and what exactly we need for the Cyclone II FPGA.

I’ve spent considerable time digging around in different corners of the internet trying to find good advice on selecting a clock for my FPGA without much luck. So, I decided to get my hands dirty and figure it out on my own.

Like my regulator design, the goal was to keep the component count and number of wires to a minimum. I want to make sure the core FPGA system simply works always. Keeping the base FPGA design simple lets me spend more time worrying about the new circuits I’m designing, rather than worrying about if some wire got dislodged in my setup.

The idea is to keep improving on the design in small steps; get a simple solution working, then in an iterative process, continue to improve on it. This sort of incremental design technique will help save a lot of time debugging, and headaches in the future.

Perhaps I’m a little OCD, but I’m pretty sure the following picture is what nightmares are made of, good luck trying to diagnose and fix the problem if one of those small wires falls out:

Breadboard Horror

Breadboard Horror

Okay, now take some time to recover from the cold sweats and uncurl from a ball, and we’ll move on….

FPGA clock selection is very similar to selecting a clock for a microcontroller. If you hunt the internet for tips on selecting a clock for an FPGA you won’t find much information. However, if you search for microcontroller clocks you’ll have more luck.

To summarize some information found in a Maxim Application Note, there are two major types of clocks for Microcontrollers/FPGAs: mechanical resonators (crystal & ceramic) and electrical phase-shift circuits such as RC oscillators.

The mechanical resonators offer high initial accuracy, and small variations based on changes in temperature, while the oscillator circuits suffer from poor accuracy related to temperature and supply voltage variations. In either case, complex circuits must be designed and tuned, including resistor/capacitor or op-amp selection.

Instead of trying to design my own clock circuit, I decided to opt for a clock module. These modules incorporate all the complexities of the clock design into a single integrated package. They come in both flavors, mechanical resonator, and integrated circuit oscillators. One of the major trade offs for using a module is they generally are higher in cost, but since I’m not doing any mass production at this point, I don’t mind paying a little bit more.

Clock Module

The next important decision for selecting a clock is picking the frequency. The max allowable frequency for the FPGA is bound by the I/O Standard you use for the clock’s input pin. I’m going to use 3.3V TTL level I/O, so the max frequency I can input is 340Mhz. (See page 5-47 of the Altera Cyclone II Handbook). In order to avoid generating a lot of high frequency noise on my Breadboard, I want to use a much lower frequency input clock, then use one of the Cyclone II’s PLLs to kick up the clock frequency internally.

Since I plan to get a USB interface working for the FPGA, I decided to pick a 24MHz clock, since 24Mhz, multiplied by two (using the second PLL) will give me the USB standard 48MHz clock I need. Once I create a PCB for my Saturn Project, which should be much more immune to noise, I will probably use a 48MHz clock in order to free up one of the PLL’s.

After much hunting, I ended on the 24MHz ECS-2200, 3.3V Clock Oscillator Module from ECS Inc. Here is the datasheet. It is a fat, ugly looking little DIP, but it only cost $2.63, so it will suffice. It has four pins: supply voltage, ground, output, and a disable signal, no external components required.

Currently, I do not own a scope so I can’t display any pretty waveforms of the clock in action, so I guess I’ll have to put together some sequential logic demonstration to show that it is working.

Here are some links that might be useful, related to clocks:
Crystal oscillators
Ceramic resonator
RC oscillator
Advanced Clocks Tutorial