Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

High performance frequency counter

Status
Not open for further replies.

rawbus

Member level 1
Joined
Jun 18, 2010
Messages
33
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,641
Basically I will be reading in signals from 100kHz to 500kHz, or 10 us to 2 us. I want to calculate the frequency to as best precision as possible within a Cyclone III board, atleast 2.5 ns. What is the best way to do this or is it even possible?

Added after 2 hours 3 minutes:

Basically I'm looking to sweep down this frequency range by as small of a value as I can. If I wanted to decrement by 1 Hz, I know using a counter would be unrealistic as you would need a 250 GHz clock. So, I guess I'm looking for a realistic answer of what resolution is attainable.

Also, is there another technique that can be used instead of a counter? I read something where someone suggested converting the frequency to a linear voltage ramp and measuring the difference in voltages. Does this sound like it would work?
 

Hi,
Yes. in basic research it was long time "the methode", but I think its no more (so)actuell...
It called TAC -time amplitude Converter & need a strt & a stop impulse for these charging. :)
Newly you can buy multichannel ASICs as TAC too.
Otherwise what about "reciproc or computing counters"? :)
I know only the names, but the low frequency -high resolution counters are oer the past ca. 25 years reciproc counters_pls search for that.
K.
 

From what I read about reciprocal counters the resolution is just going to be based off the clock frequency. In a Cyclone III FPGA this is like what, 400 MHz max?

Is there anyway to beat that resolution?
 

Yes, an external counter with 1-2GHz...
K.
 

That lets me sweep down at 2.5ns intervals which is about 625 Hz. If my bandwith range is from 490KHz to 495KHz that gives me about 8 intervals to choose from, where from those about 4 will be useable. This doesn't give me alot of control options if the dB goes from 0-40 in the range of those 4 values.

EDIT:
Ok, so this isn't possible in an FPGA type of setting?
 

How frequently do you need your measurements? If you want one reading per millisecond, time the duration of 64 pulses. If you want ten readings per second, time the duration of 8,192 pulses. If you have a 100MHz counter input, you should be able to latch the time accurate to 5ns (use a graycode counter which counts on both rising and falling edges). At 500Khz, 64 pulses will take 128us, or 25,600 counts. Each count would represent a change of about 20Hz. If you count 8192 pulses at 500KHz, that would take 16,384us or 3,276,800 counts. Each count would represent a change of about 0.16Hz.

Note that it would be possible to have your logic divide the count value into 1,638,400,000,000 to yield frequency in hertz, but it would probably be more practical to let a microprocessor do that.
 

Basically, I guess I'm looking for something that can measure down a frequency range from 500KHz down to 100KHz by a resolution of 1 Hz and then output at the same resolution. The difference between 500KHz and 499.999KHz is roughly 4 ps. I need to measure the period in and then be able to output a period that can be to the resolution of 1 Hz. So, If I measured a 400KHz period I want to be like ok, on the next period I want 399.999KHz.

It just seems to me like this won't be possible with just a counter. I'm thinking you would have something keep track to the best resolution possible on a counter and then since you know you want to end somewhere within the last clock period. Throw in some delays that can be on the order of a couple hundred pico seconds.

So, for an application use lets say I have a Q curve where the resonant frequency is at 400KHz and there is roughly 3KHz between 0dB on the rising part of the curve to 0dB on the falling part. Now at 100% power the frequency output needs to be at 400KHz.

However, if I want to say output at 89% power I would need to output at a frequency that is at 89% power of the resonant power. Now, If I want to be able to go from anywhere between 50-100% by factors of 1% I need to have a very precise measurement of how I'm outputting my period.
 

rawbus said:
Basically, I guess I'm looking for something that can sweep down a frequency range from 500KHz down to 100KHz by a resolution of 1 Hz. The difference between 500KHz and 499.999KHz is roughly 4 ps.

If the incoming pulses are uniform, measuring the time of 64 pulses and dividing by 64 will give you a result that 256 times as accurate as you would get from measuring one pulse. Measuring the time of more pulses would give you a result that was more accurate still.

Getting a 1Hz accuracy on a 500KHz signal would require that you could about 500,000 clock pulses. If your clock can run 100MHz and you can count half-cycles, that would take about 2.5ms. In 2.5ms, your 500Khz signal would cycle 1,250 times. Rounding up to the next handy power of two, I'd suggest that you measure the time for 2048 pulses.

At 500KHz, 2048 pulses would take 819,200 half-counts of your timer; if you counted 819,201 half-counts, that would represent a frequency of 4999,999.4Hz. At 100Khz, 2048 pulses would take 4,096,000 half-counts, so even at 100KHz you would have your answer in just over 1/50 second.

Do you need results faster than that? If so, for what purpose?
 

I guess part of me is getting a little confused with what you're trying to say. If I have a 200 MHz clock I can count at 400MHz using double edge. Also, The period would be 2 us at 500KHz. So, I would need to know the timing at least 3/4 the way through that time, so I could set up the next firing period. Making the frequency larger so I can measure it more accurately doesn't help me if I can't output a signal at the same accuracy.

The way I see it so far, is I read in an analog signal, which is a current, at roughly 100 MSPS. Then I count to the didt goes to 0 to the current goes to 0 and get a time, shift it by 2, and i get a period. Then I need to be able to decrease or increase the period by 1 which is easy. The hard part is how do I output something for that decreased period because my clock is capped at roughly 400 MHz.

In other words, I measured 400KHz now I want to output something for 399.999KHz. I'm guessing I would need to use an asynchronous signal and not a clock to be able to do this because the difference between 400KHz and 399.999KHz is roughly 6.25 ps?
 

rawbus said:
I guess part of me is getting a little confused with what you're trying to say. If I have a 200 MHz clock I can count at 400MHz using double edge. Also, The period would be 2 us at 500KHz. So, I would need to know the timing at least 3/4 the way through that time, so I could set up the next firing period. Making the frequency larger so I can measure it more accurately doesn't help me if I can't output a signal at the same accuracy.

Your original question just seemed to be about measuring a signal. Are you seeking the ability to output a signal with some relation to the original one? How quickly do you need to react to changes in the original signal?

If you feed the original signal into a divide-by-256 counter and then measure the period of the counter's output accurate to the nearest e.g. 5ns, that will let you know the period of the original signal accurate to the nearest (5/256) ns.

If you want to produce a signal around 100KHz to 500KHz, and your clock source is a 200MHz square wave, you won't be able to avoid 2.5ns of jitter in your output, but you can achieve any desired level of accuracy on your output frequency by a variety of means. Conceptually, the simplest would be to have two 32-bit registers, and add the constant of the first one to the second every clock cycle. If the value in the first register is called N and the clock frequency is F, the MSB of the second register will toggle N times every 4,294,967,296 cycles, so the frequency will be N*F/4,294,967,296. If F is 200,000,000 that will give you frequency steps of 0.023Hz.
 

Yes, I guess I was thinking if I could have an accurate measurement then I could just do the same thing to produce an output wave to the same accuracy. I will be reading a current signal that is at most 2 us period. I need to have my output signal ready to go at the end of that first period.

For example, the first period is measured in a quarter cycle, 500ns. From this information and some set values by the user I will output the new period after the previous period is over. During this time the resonant frequency will be changing but the new period can't start until after the previous period is finished. Hence, at the highest frequency, 2us, I will need to be able to measure that frequency and have a new one ready to go in 2 us.

As far as what I can understand your idea works conceptually. But, as far as timing goes I don't see how your idea would work. If I can't avoid the 2.5 ns of jitter on my output then how can I tell if I'm outputting a signal at 500KHz or 499.999KHz if the difference is 4 ps? This is a real output signal I'm driving to a gate driver of some power FETS.

Basically, I have a load that I'm putting a current through. The load is going to be going through a EMF and getting very high temperatures. Hence the resonant frequency is going to be changing with time. If there is no change in the frequency I'm outputting, then the power I'm driving to the load is very inefficient. I want to track the changing resonant frequency as well as give the user control over the power output.

This would require me being able to know the frequency and have the next one ready to go by no slower than 2us.
 

rawbus said:
Basically, I have a load that I'm putting a current through. The load is going to be going through a EMF and getting very high temperatures.

If you drive a resonant load with something near the resonant frequency, the frequency on the load is going to be whatever it's driven with. The efficiency with which you can drive the load will vary depending upon how your frequency compares with the load's resonant frequency, but I think what you will need will be some sort of analog circuitry to sense whether your pulse arrived earlier or later than would have been ideal. You could then either feed that into a FPGA/CPLD or else an analog frequency-control loop.

It's useless to speculate more how exactly you should solve your problem without really understanding more of what you need?
 

Sorry for the delayed response my internet went out.

I won't be running it at resonant frequency, I will be running it somewhere on the falling slope of the q curve. Also, I've just found out that the resonant requency won't be changing faster than lets say 1 ms. So, at 400KHz resonance I can shoot out 400 pulses before I need to change the pulsing period.

Now, If I want to maximize the amount of frequencies I can pulse at on the falling Q curve would it just be a combination of pulsing at different frequencies and then taking the average?

For clarification, some loads can't handle the power at resonant frequency. Therefore, I will need to operate at a lower power or away form the resonant frequency, in my case always above resonant frequency.

The goal is to control the power output to within 1%. Does this seem doable at high frequency of 400KHz?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top