• 0
bhclowers

PYNQ Frequency Chirp Resolution

Question

We've been conducting an experiment where we are recording the impulse response from a linear frequency sweep.  This linear frequency typically spans from 5 Hz - 20 kHz.  It produces a signal that looks like the red decay curve attached.  We can obviously transform this using the FT to get the respective frequency components back. However, we've noticed that depending on what function generator we use we get artifacts in the resulting spectrum.  To be clear, these ARE NOT overtones.  That is an obvious issue that we've eliminated.  In short, we've narrowed the problem down to the way some function generators (e.g. the Analog Discovery) output the sweep is that the step size for the frequency change scales depending upon the frequency range being swept.  Another way to say this is that it is the rate of frequency changes which induces kink in the sweep which shows up at an artifact. (See the following post for more info on that issue). 

Our solution at this point is to define the linear frequency sweep with same resolution (which is overkill for the low frequency components) throughout but ensures that the data come out correctly.  We currently use a NI card but we are running into some issues there too.  So, now to the questions are:

Is there a python interface to the pynq board that will allow us to define a waveform that has the same resolution (1 us or shorter) throughout and sustain this waveform for 10's of minutes?

Alternatively, is there way to stream a waveform from disk on the pynq (of course latency could be an issue there) or load a large waveform into memory (~10 million points in byte form (0's/1's))?

I've thought about trying to search for issues related to PWM but that is not quite right as in some cases we might want a non-linear or custom waveform. 

Any advice or guidance would be appreciated.

Brian

 

 

 

 

 

Artifacts.png

Sweep.png

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Just a thought: can't you simply use a sound card?

You do not need FFT. if you generate a cos(omega t) source signal. For the received signal r (t), calculate

A = average of r(t) cos(omega t)
B = average of r(t) sin (omega t)

where the average is calculated over an integer number of periods at frequency omega (this drops out an unwanted double frequency term).

Sqrt(A^2+B^2) gives the magnitude and atan2 the phase.

In an implementation, you can do independent bursts for each frequency, with differing source power (according to the power handling capabilities of your transducer) and length (to set the required accuracy for each frequency). Make each source burst slightly longer than the averager window, so that the measured system can settle into steady state.

I've done this with radio frequency testing equipment, but there's no reason why it shouldn't work with a sound card. A loopback reference measurement usually improves accuracy significantly.

Share this post


Link to post
Share on other sites
  • 0

The use of the sound card is an interesting concept.  I will have to look into it but worry that the sound card will ultimately be limited in the types of waveforms it can output with respect to custom binary waveforms (i.e. not sine/cos). This gets to the heart of my original question is whether or not the pynq be used to output the waveform of interest at the specific resolution (i.e. 1 us control spanning across multiple minutes and even an hour)?

Share this post


Link to post
Share on other sites
  • 0

Hi @bhclowers,

If you are looking to generate a signal with Pynq with a python script, I would recommend asking on pynq.io as they are the ones that created all of the material for the Pynq board. Although, if you had questions on how the Analog Discovery generates it's waveforms, I would recommend asking on the Scopes and Instruments section of the forum (which I believe you've done before) where attila will be able to see and respond to your question. I know quite a few versions of WaveForms have come out since you originally posted there.

Thanks,
JColvin

Share this post


Link to post
Share on other sites
  • 0
Posted (edited)
4 hours ago, bhclowers said:

This gets to the heart of my original question is whether or not the pynq be used to output the waveform of interest at the specific resolution (i.e. 1 us control spanning across multiple minutes and even an hour)?

@bhclowers

Feel free to let me know if I'm being unhelpful....

From your original post I think that your question is a bit more complicated than you let on. I have never used the Pynq though I did look at it carefully when it was introduced. My understanding of the Pynq1 concept is that it provides a sort of "walled garden" approach to using an FPGA; that is it promises a 'friendlier' user interface if you stick to the scripts, third-party software, and community support arena. I mention. this because a more general question that I think you are trying to ask is if an FPGA board can do what you want. 

If you implement everything in and HDL the answer is sure. I assume, but aren't sure from what I've read about Pynq is that it should be possible to use the board without the normal supporting software, that is as a regular FPGA board. I have no idea how difficult this would be.

If you wer to use, say the ATLYS, with its parallel ADEPT USB 2.0 interface and audio codec, and wrote everything in VHDL or Verilog then it shoudl be straightforward. Not necessarily easy, but straightforward. You custom waveforms would be prototyped in OCTAVE and implemented in HDL. This approach requires you to do all of the heavy lifting but also gives you total control. If your sampling rates are fixed then things are a lot easier.

As you have no doubt found out, the cost for convenience, is a significant probability that you can't to home plate.

Edited by zygot

Share this post


Link to post
Share on other sites
  • 0
Posted (edited)
On 4/3/2019 at 3:29 PM, bhclowers said:

but worry that the sound card will ultimately be limited in the types of waveforms it can output with respect to custom binary waveforms

Well, let me put it this way: Recording an audio frequency impulse response e.g. 5 - 20 kHz based on a CW-ish sweep is a problem that has been solved with sound cards for ages.

Now the word binary raises some alarm flags, whether your problem is well defined and / or fully understood (and if not, I wonder how much better hardware you will need to fix it).

Hint (blind guessing at the problem):

- mathematically, "binary" signals are Dirac pulse streams with an unlimited spectrum

- technically, communications folks use "pulse shaping filters" to tame the bandwidth, e.g. to 125 % of the symbol rate

- in reality, ill-informed people and Simulink default-options-users rely on "sample-and-hold" aka stairstep or (putting lipstick on a pig) "zero-order interpolation"). Which combines the disadvantages from both worlds: the result is neither mathematically tractable nor anywhere near bandlimited.

Edited by xc6lx45

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now