3
\$\begingroup\$

I am working on a design which involves an FPGA having an external clock, the clock source is supposed to be programmable clock synthesiser, however this needs to be programmed at power on by the FPGA to output the correct clock frequency. I don't have great experience in this domain, but I am kind of sure that the FPGA will not operate correctly without an appropriate clock.

My solution to this is to use a 125MHz crystal, which is connected to a programmable clock multiplexer. At power on the FPGA will receive the clock from the oscillator, after this it will program the clock synthesiser and switch the clock source on the clock multiplexer. The purpose of this is to have a precise phase synchronised system. My BIG issue with this is that I don't know if it is safe to disrupt the clock being delivered to the FPGA and if it will remain operational during this switchover phase. Hopefully someone may have a better idea of how FPGA's behave with regards to the clock.

The FPGA in question is a Xilinx ZC7Z010 Cortex A9. I am welcome to other ideas, but the FPGA most certainly needs to be clocked by an external oscillator.

Many thanks for reading this.

\$\endgroup\$
  • \$\begingroup\$ How many clocks are you going to synthesize? Could you use Clocking Wizard IP? and then control the multiplexer and other PL with PS? \$\endgroup\$ – Nazar Jan 6 '17 at 15:38
  • \$\begingroup\$ The Zynq has a lot of clock management resources on board. Are you absolutely sure that you need an external synthesizer? This sounds like an X-Y problem -- you might get better answers if you describe in a more general way the clock(s) that your system needs and what they're used for. \$\endgroup\$ – Dave Tweed Jan 6 '17 at 17:08
  • \$\begingroup\$ Yeah, if this is for a Zynq, you can use the AXI clock for your config peripherals. \$\endgroup\$ – mng Jan 7 '17 at 5:19
  • \$\begingroup\$ So you can have the config core running on this AXI clock which is derived internally, and just to confirm can this be done in the presence of no external clock whatsoever? If so this would make my clock switching method redundant. \$\endgroup\$ – Renegade243 Jan 7 '17 at 11:56
  • \$\begingroup\$ The standard way to clock the ARM subsystem (PS, in Xilinx lingo) is to provide a separate reference clock on PS_CLK. \$\endgroup\$ – mng Jan 8 '17 at 3:23
2
\$\begingroup\$

By the sounds of it you need to split your design up a bit more. Here's how I would do it:

  1. Run the logic that does the clock configuration on a different clock domain entirely. FPGAs frequently have some low quality internal oscillator which will be available after power on. Use this clock for driving the logic that configures the clock generator.

  2. Feed the logic that runs off the clock synthesiser directly from the synthesiser - don't put a multiplexer in the path (well you can, but you don't need to).

  3. At power on, keep everything in reset except the logic in (1). Once the clock generator has been programmed, bring the rest of the logic out of reset.

As long as you remember to add a clock resynchronisers for signals/flags that go between the two clock domains, you should be fine.

It's frequently the case in FPGA designs that you will essentially have a "management" section of the design that runs off a free-running clock source which is always available. The management hardware is there to get everything ready after the FPGA is configured - things like preparing clock sources, PLLs, and so forth. You can then use that core to bring everything else out of reset once everything is prepared.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Thank you everyone for your comments and quick responses. \$\endgroup\$ – Renegade243 Jan 6 '17 at 15:49
  • \$\begingroup\$ I am not sure if the Zync has an internal oscillator as I am dealing with the FPGA side of things. I am working on a clock distribution system for a much larger design, which clocks the FPGA. As I have touched on my partial solution initially there is one 125MHz crystal oscillator which clocks the FPGA at power on, when the FPGA sees fit, it programs the synthesiser and switches its own clock source. The nature of this system means that I can only have one clock going to the FPGA, as we are desperate to retain the I/O. \$\endgroup\$ – Renegade243 Jan 6 '17 at 15:59
1
\$\begingroup\$

An FPGA can have different blocks controlled by different clocks.

So use some simple not-so-accurate clock that will turn on as soon as the system has power to run the basic control blocks. And use your carefully tuned crystal-referenced clock only to run the parts of the FPGA logic that form the "precise phase synchronized system".

You will of course have to take some care to synchronize the control signals that connect between the two clock domains, but there are well-known techniques to do that.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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