How to connect XTAL to FPGA clock? - Page 1
Forum section: electronics / general

author: soFPG
author_rank: Frequent Contributor
timestamp: May 01, 2021, 06:27:14 pm
content: Hello,sorry for this stupid beginner question but how do I connect an XTAL crystal to an FPGA clock input pin?I mean - the XTAL has two pins, how am I supposed to connect those?Best regards

author: ataradov
author_rank: Super Contributor
timestamp: May 01, 2021, 06:34:11 pm
content: You can't connect it directly. You need to build an external oscillator circuit.But the best way to go is to use CMOS clock generator.A search term for the distributor sites is "MEMS Oscillator". I personally use DSC61xx series from Microchip. But there is no particular reason for this, they all are basically the same.

author: langwadt
author_rank: Super Contributor
timestamp: May 01, 2021, 06:35:56 pm
content: you don't, you use an external oscillator

author: SiliconWizard
author_rank: Super Contributor
timestamp: May 01, 2021, 07:33:02 pm
content: While the usual (and most sensible) approach is to use an external oscillator, for not too high frequencies, and on *some* FPGAs you *may* be able to make an oscillator using 2 *properly* configured IOs (assuming said FPGA has schmitt trigger inputs), one as input and the other as output, implement an inverter between them, and externally route the output to the pin used as clock input. This is not guaranteed to work, but could save a few cents if it does.Now if you're a beginner, don't even try this.

author: dtodorov
author_rank: Contributor
timestamp: May 01, 2021, 09:03:15 pm
content: Quote from: SiliconWizard on May 01, 2021, 07:33:02 pmHow does such a system boot-up, if this xtal is the only clock source?

author: ataradov
author_rank: Super Contributor
timestamp: May 01, 2021, 09:14:18 pm
content: FPGAs don't need external clock to boot up or work. They configure themselves with the internal clock. Often the same clock is accessible to the user logic. Or you can implement your whole project to not need a clock at all. It is all good.

author: SiliconWizard
author_rank: Super Contributor
timestamp: May 01, 2021, 10:27:47 pm
content: Quote from: ataradov on May 01, 2021, 09:14:18 pmYup of course. You can even use an FPGA without any "clock" at all, if all you implement is combinatorial logic.Conversely, you can have several external clocks. How would the FPGA ever know which one to use if it required an external clock for its configuration?So yeah, they all have an internal oscillator for this AFAIK. Not always accessible to the user though. Lattice parts, for instance, have internal oscillators that are, but for Xilinx parts, I'm not sure.

author: Shadowfire
author_rank: Contributor
timestamp: May 02, 2021, 08:03:19 pm
content: Yep, they *all* have an internal oscillator for configuration, as was mentioned previously in this thread.What hasn't been mentioned previously in this thread, is that (if they are available to you) they are NOT very accurate.Their frequency depends on temperature, voltage, and phase of the moon when they were manufactured.For instance, some of the MAX10 devices are spec'ed at "55Mhz to 116Mhz" (with this kind of spec its a sure bet that they are RC oscillators, not MEMS or crystal, and also are likely to be internally running at twice this speed and sent through a flipflop to even out the duty cycle).Some parts allow you to feed this clock into an onboard PLL to change the frequency, some do not.It's a great way to reduce component count (and thus cost) if your design can deal with the ridiculous frequency variations from part to part.As for the OP, a crystal is an analog (RLC) device, and does NOT generate a digital clock signal like the FPGA is expecting. A crystal needs a supplemental inverting amplifier circuit to oscillate, and a signal conditioner to generate a logic-level voltage to drive the FPGA's clock input pin. You get this in the same package when you buy a device classified as an oscillator.

author: vstrakh
author_rank: Contributor
timestamp: May 03, 2021, 11:17:57 am
content: Quote from: SiliconWizard on May 01, 2021, 07:33:02 pmCharles H. Moore went even further with GA144 chip, having ceramic resonator with low Q being driven by software.One of the chip's nodes had subroutines that attempts to excite the resonator and to monitor the oscillation health using single gpioQuartz resonators with high Q had too much problems with this approach.

author: asmi
author_rank: Super Contributor
timestamp: May 03, 2021, 01:10:44 pm
content: You can technically use built-in config clock in Xilinx 7 series devices too, but since it's horribly inaccurate (±50% frequency tolerance), I can't really see how it can be useful in any practical designs.

author: langwadt
author_rank: Super Contributor
timestamp: May 03, 2021, 01:18:12 pm
content: Quote from: asmi on May 03, 2021, 01:10:44 pmthis might be more accurate,r-c-r osciallatorhttp://xilinx.pe.kr/_xilinx/html/tip/sixeasypieces.htm

author: asmi
author_rank: Super Contributor
timestamp: May 03, 2021, 01:22:59 pm
content: Quote from: langwadt on May 03, 2021, 01:18:12 pmIt's ridiculous. The whole point of the clock in FPGA is to account for time. So it has to be precise enough for application. And besides, MEMS generators are fairly cheap, so no reason to bother with anything else.

author: langwadt
author_rank: Super Contributor
timestamp: May 03, 2021, 03:42:24 pm
content: Quote from: asmi on May 03, 2021, 01:22:59 pmsure in most cases it would be silly to not use a real oscillator, but not all applications need an accurate clock

author: soFPG
author_rank: Frequent Contributor
timestamp: May 04, 2021, 08:12:30 am
content: Quote from: asmi on May 03, 2021, 01:22:59 pmThe cheapest one I can find are around 0,80€ / piece. In absolute values its fairly cheap with compared to a crystal it is 10x more expensive

author: asmi
author_rank: Super Contributor
timestamp: May 04, 2021, 01:31:51 pm
content: Quote from: soFPG on May 04, 2021, 08:12:30 amIt's also much simpler, and takes less room on a PCB. This kind of penny-pinching is beyond ridiculous. Cheaper is not always better, infact at some point it becomes a serious drag, when saving just a little more introduces serious issues. Also simplicity is a virtue all by itself - the simpler the circuit, the less chance of things going wrong - especially if you need to guarantee operations over wide PVT range.

author: Zero999
author_rank: Super Contributor
timestamp: May 04, 2021, 03:02:38 pm
content: Use an IC such as the 74LVC1404, or 74LVC1GX04 to make an oscillator with the crystal.https://www.ti.com/lit/ds/symlink/sn74lvc1404.pdfhttps://assets.nexperia.com/documents/data-sheet/74LVC1GX04.pdf

author: ataradov
author_rank: Super Contributor
timestamp: May 04, 2021, 04:05:25 pm
content: Quote from: soFPG on May 04, 2021, 08:12:30 amThere are cheaper parts directly from China. I've seen some on LCSC as cheap as 40 cents. But yest that's about the price for them. It is more expensive than the crystal. But in case of the FPGA you have no other options. You can use that inverter gate and implement your own oscillator. But with the cost of the IC and tuning it to start and work reliably, it makes no financial sense.