2
\$\begingroup\$

I'm currently developing an FPGA gateware requiring a regulated frequency divider and I wonder if there is any tricky way to get a linear output frequency regulation?

What I mean is that if I use a simple preloaded counter I get a f~1/x relevance, where x is a counter initial value. As I need to regulate frequency in a relatively wide range (say 0.5Hz-10kHz) I'd like it to be a linear function of some argument (of course, not necessarily a counter value-it can be something more complex ;-) ).

\$\endgroup\$
7
  • \$\begingroup\$ It is linear function of 1/x, as you said. So what is the question? \$\endgroup\$
    – Eugene Sh.
    Nov 27, 2015 at 17:10
  • \$\begingroup\$ I know it is. But notice that change of one value of x in case of small values gives large changes in frequency. Whereas change in large values gives little change. I wounder if there is a method that gives more uniform changes in function of parameter. \$\endgroup\$
    – kaolpr
    Nov 27, 2015 at 18:15
  • \$\begingroup\$ This is a nature of mathematics, you can't fight it. .Frequencies are generated by digital devices using timers, which by their nature can only count time, which is in the denominator. You can use some analog circuitry to overcome this limitation. \$\endgroup\$
    – Eugene Sh.
    Nov 27, 2015 at 18:25
  • 1
    \$\begingroup\$ Most FPGAs have at least one PLL that will give you more linear control. \$\endgroup\$
    – pjc50
    Nov 27, 2015 at 18:33
  • 1
    \$\begingroup\$ Are you wanting PLL or DDS? \$\endgroup\$
    – Autistic
    Nov 27, 2015 at 19:34

3 Answers 3

1
\$\begingroup\$

At the moment, you are considering using a preloaded counter. This means that each clock cycle you get a fixed increment, in a variable accumulator length that you control, hence the frequency is reciprocal to your control value.

If instead you use a controllable variable increment in a fixed accumulator length, your frequency will be linearly dependent on the control value.

This is how a DDS works. A fixed length accumulator, typically a power of 2, for instance an 18 bit accumulator that counts up to 2^18 (250k-ish long) is incremented each clock cycle odf the system clock. In pigHDL, you would write

int count [17 downto 0];
process(on sys_clock rising):
_ count <= count+freq;
_ output := count[17];

This may, or may not, give you what you need. The MSB of the counter will give you the output, but unless freq is an exact power of 2, the output cycles will not be exactly the same length, they will vary by one count.

The average output frequency = freq * fs / accumulator length.

You can get increased resolution for the frequency by increasing the length of accumulator and frequency word, to the right.

There is no way to remove this one cycle jitter, if you are going to use the clock as a digital source. Bear in mind that for an FPGA, it is bad form to take the MSB output and use it as the clock line to other elements. Much better to turn it into a one cycle ClockEnable, and use that to condition the clock into downstream elements.

If it's for an external source, you can take the top several bits of the accumulator into a DAC, filter the waveform, and use a comparator, this will reduce the jitter considerably.

\$\endgroup\$
0
1
\$\begingroup\$

I will suggest using a binary rate multiplier. I have attached a reference sheet that shows what I mean. You can accurately use the binary multiplication to get a good range of output frequencies. Not exactly linear, but easily controlled.

http://www.ti.com/lit/ds/symlink/cd4089b.pdf

\$\endgroup\$
0
\$\begingroup\$

There are several things to consider.

1) The higher the main FPGA frequency you use the better. This gives you more resolution at the higher frequencies. This translated to more bits in your divider.

2) If you were to limit your frequency range you would have a more practical ability to realize a Freq -> Divisor relationship that could be considered more straight line.

\$\endgroup\$
4
  • \$\begingroup\$ 1) I can have 200 MHz clock in my FPGA. That gives 20 'ticks' for 10 kHz. 2) Unfortunately I need such wide range. \$\endgroup\$
    – kaolpr
    Nov 27, 2015 at 18:11
  • 1
    \$\begingroup\$ @kaolpr - I think you are way off. 200MHz/10kHz = 20000 ticks for a divider. \$\endgroup\$ Nov 27, 2015 at 18:15
  • \$\begingroup\$ @kaolpr - Can you do a better job of describing just what you want with regard to "linear"? \$\endgroup\$ Nov 27, 2015 at 18:17
  • \$\begingroup\$ Oh, sorry! I did one mind step further. 20 ticks was after one block downstream. Never mind. I mean that change of one value of x in case of small values gives large changes in frequency. Whereas change in large values gives little change. So if it was linear that changes would be the same. \$\endgroup\$
    – kaolpr
    Nov 27, 2015 at 18:20

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.