Close
0%
0%

FL2k Experiments

Exploring the FL2k USB-to-VGA dongle for signal generation

Similar projects worth following
Since reading about Steve Markgraf's discovery that you can use cheap FL2000-based USB-to-VGA converters as general purpose fast DACs, I've become very interested in what I might do with them. This project chronicles my experiments.

This project is going to happen in the build logs: I'm basically treating this as a blog for ongoing experiments with the FL2k dongles.  This is a spin-off from #AM Band Voice Frequency Marker where I initially used this device to implement a project that had stalled for about a year.

For background information and the code you need to operate these dongles as general-purpose DACs, see the osmocom.org wiki page.  The short story is that there's a way to turn off the horizontal and vertical blanking interval on these inexpensive USB3.0 adapters so they can blast out 8-bit analog values at 100 MSPS or more on three channels.

Feedback or suggestions on these ideas are welcomed, as are collaborators.

For anyone wishing to start experimenting with these dongles, I've designed a breakout board that brings the red, green, and blue channels out to SMA jacks and matches the 75-ohm output of the VGA to 50-ohms.  You can order the PCB from OSH Park.

So far, I've decided I want to explore the following things:

ZOH Limitations

Overcoming the zero-order-hold (ZOH) limitations on higher-order Nyquist zones.  The DACs in the FL2k don't have any explicit filtering, which is ideal for VGA output, and also allows you to generate RF outputs at higher frequencies than would otherwise be implied by the ~100 MSPS data rate.  But, there's an implicit "filter" in the DACs themselves: the zero-order-hold function, in other words, the fact that the DAC maintains a constant value during each sample time. This has the effect of filtering the higher-order Nyquist zones with a sinc-shaped envelope. In the plot below, you can see how the higher-order zones drop off precipitously up to 1.5 GHz.  The yellow curve is the envelope of the FL2k output, and the magenta the noise floor of the analyzer.  If you want to generate 1.5 GHz signals with this device, you are really fighting a lot of loss.

(Aside: to gather this envelope data, I generated a chirp signal from DC to 50 MHz, and output it at 100 MSPS.  I set the analyzer trace to "Max Hold," and let the envelope gradually fill-in while the chirp swept through the frequency range.)

Of course, you can change where the zeros are in this output by changing the sampling frequency, but the envelope is still limiting.  Ideally, instead of a zero-order-hold, the DAC would output infinitely narrow delta functions for each sample - this would produce un-attenuated harmonics for all Nyquist zones. Commercial direct-sampling RF DACs approach this ideal by shaping the DAC's impulse response. For example, Maxim's MAX5879 has four different selectable impulse responses (hint: read the linked page for much more info on the subject) that allow different envelopes to be created.   One of the responses is equal to the ZOH, a second returns the output to zero for half the sample period (more closely approximating a delta function), a third response inverts the DAC output half-way through the sample period, while a fourth combines the two, using true and inverted outputs for one quarter of the period each.  The article describes the resulting envelopes, which show less attenuation than the simple ZOH.

You can see the evidence of the ZOH in the time domain, too.  Here's a 10 MHz sine wave sampled at 100 MSPS through the FL2k:

You can see the 10ns steps clearly.  The settling time for these large steps isn't great, but that could also be from a number of other factors, including the test setup.

How to improve this?  The idea would be to generate a fast sample of the DAC output.  For example, one could use a diode sampling gate, or maybe even just use a diode to shunt the output to ground for some (or most) of each sampling period.  To drive the sampler, you'd create a short pulse based on output from either the green or blue channel (see below...

Read more »

  • DAC Impulse Responses

    Ted Yapo05/15/2018 at 23:26 0 comments

    I wanted to copy these figures from the Maxim application note, but they're copyrighted and whatnot, so I wrote some quick python to calculate Fourier transforms for piecewise-constant functions and drew my own.  I would have paid good money for access to something like this when I took those undergrad courses...

    Along the top are the four DAC impulse responses supported in the MAX5879, and in the bottom plot are the corresponding output envelopes in dB vs frequency (1 = the sampling frequency, so the first Nyquist zone extends from 0 to 0.5). 

    The first response (blue) is the familiar zero-order-hold, which just outputs a constant value during each sample period.  This is the response implemented in the FL2000 chip.  You can see that the output spectrum has zeros at multiples of the sampling frequency.

    The second response (red) drops back to zero (known as return-to-zero) for half the sample period.  This results in an output envelope that has zeros at even multiples of the sampling frequency.  This is beginning to approach the ideal of an infinitely narrow output sample, which would have a flat output spectrum.

    The third response (magenta) inverts the output for half the cycle.  This has a zero at DC, so is only useful for RF generation, not baseband signals, but has a higher envelope in certain Nyquist zones.

    The last response (black) also inverts but returns to zero for half the period.

    You can see how choosing one of these outputs from the DAC could really come in handy when using higher-order Nyquist zones: you can tailor the output envelope for the frequency you want to create.

    One of the goals of this project is to create a simple, cheap add-on to the FL2k dongles to modify this response and allow better generation of higher frequencies.

    Oh, I guess I'll drop the code that generates the figure here.  It's a one-off, so it ain't pretty, but it works:

    #!/usr/bin/env python
    
    import numpy as np
    import matplotlib.pyplot as plt
    
    
    t0 = np.array([-2, -1, -1, 1, 1, 2])*0.5
    h0 = np.array([ 0,  0,  1, 1, 0, 0])
    
    t1 = np.array([-4, -1, -1, 1, 1, 4])*0.25
    h1 = np.array([ 0,  0,  1, 1, 0, 0])
    
    t2 = np.array([-2, -1, -1, 0,  0,  1, 1, 2])*0.5
    h2 = np.array([ 0,  0,  1, 1, -1, -1, 0, 0])
    
    t3 = np.array([-4, -1, -1, 0,  0,  1, 1, 4])*0.25
    h3 = np.array([ 0,  0,  1, 1, -1, -1, 0, 0])
    
    fmax = 5
    n_points = 1000
    
    def plot_pair(t, h, style):
      f = np.linspace(-fmax, fmax, n_points)
      H = np.zeros(n_points, dtype=complex)
    
      # calculate Fourier transform H(f) for piecewise-constant function h(t)
      for i in range(1, len(t)):
        H -= h[i] * (np.exp(1j*2*np.pi*f*t[i])/(1j*2*np.pi*f) -
                     np.exp(1j*2*np.pi*f*t[i-1])/(1j*2*np.pi*f))
    
    
      plt.plot(t, h, style)
      plt.axis([-1, 1, -1.1, 1.1])
      plt.subplot(2, 1, 2)
      plt.plot(f, 20*np.log10(np.abs(H)), style)
      #plt.plot(f, np.square(np.abs(H)), style)
    
    plt.subplot(2, 4, 1)
    plot_pair(t0, h0, 'b')
    plt.subplot(2, 4, 2)
    plot_pair(t1, h1, 'r')
    plt.subplot(2, 4, 3)
    plot_pair(t2, h2, 'm')
    plt.subplot(2, 4, 4)
    plot_pair(t3, h3, 'k')
    plt.axis([0, 5, -50, 0])
    #plt.show()
    plt.savefig('DAC_impulse_response.png', bbox_inches='tight', dpi=200)
    

  • Interpolating with transmission line?

    Ted Yapo05/15/2018 at 04:33 2 comments

    So, I started playing around with transmission line models for generating short sampling pulses, and it occurred to me that you could use a transmission line to interpolate between DAC samples.  It's kind of like doubling the sample rate just using a piece of wire! Here's a circuit I've been playing with:

    The circuit is amazingly simple.  The voltage source and 50-ohm resistor model the FL2k DAC (with impedance-matching network to have 50-ohm output, like on the breakout PCB).  The only other element in the circuit is a 50-ohm transmission line cut to have a 2.5ns delay (the delay must be one quarter of the sample period).  This line is literally just a piece of coax open at one end. The circuit works by taking advantage of the signal reflection from the unterminated end of the transmission line.

    Here are the input and output waveforms from the simulation:

    The bottom (red) trace is the input.  I've simulated a 100 MSPS DAC generating a 10 MHz signal (that's the equation controlling the behavioral voltage source).  The top (green) trace is the output of the circuit, which shows that another sample point has been interpolated between each pair of input values, which could be mistaken for doubling the sample rate.

    How does it work?

    The unterminated end of the transmission line causes a reflection of each step in the input voltage from the DAC.  Since the reflection must travel the line both ways, it takes 5ns for the reflection of a DAC step to get back to the summing point where the output is taken.  This 5ns is half of the sample period, so the DAC by now is half way through the next sample.  Summed with the reflection of the previous sample, this creates an interpolated point which is the average of the two adjacent samples.

    Is it practical?

    I don't know yet.  It's too late tonight to get this up and running in hardware.  I'll have to try it as soon as I get a chance.  In simulation, anyway, it certainly looks interesting.

    Just to be clear, there aren't twice as many "real" samples being generated; the Nyquist rate for this system is still 50 MHz even though there are essentially 200 MSPS being output.

    At this time of night, I'm not even entirely sure what this achieves, but I can figure that out tomorrow.

    EDIT: I can't sleep.

    I just had to try it out.  I used an SMA T-connector to add the unterminated line to the output of the FL2k dongle (the other line goes to the oscilloscope).

    To test it, I generated a 6.4 MHz signal using an 80 MHz sample rate (about the fastest I can do through my USB 3.0 hub).  With no line connected to the T, the output clearly shows the 12.5 ns sample periods:

    After connecting a line of around the right length, you get this waveform:

    it certainly looks like it's doing something.  Hopefully this will be enough to allow me to sleep, and I can look with the spectrum analyzer tomorrow...

  • Updated Breakout PCB (again!)

    Ted Yapo05/15/2018 at 01:36 0 comments

    I modified the breakout PCB to include the +5V line, which I had overlooked before.  The FL2k dongles, at least the ones I have, do supply 5V on this line.  The latest design is in the GitHub repo, and the PCB is shared on OSH Park.

    I think this is the last iteration.  Probably :-)

View all 3 project logs

Enjoy this project?

Share

Discussions

Nikola Stevanovic wrote a day ago point

Any thoughts on making this dongle be used as a FM transmitter, maybe with some extra hardware to be used as a real FM radio simulator ( with bandpass filter, switching different channels etc... ) ?

  Are you sure? yes | no

ArsenioDev wrote 05/14/2018 at 18:44 point

Dang, Ted continually has some of the coolest projects. 

  Are you sure? yes | no

Ted Yapo wrote 05/14/2018 at 20:15 point

Thanks!

The secret is never completing anything ;-)

  Are you sure? yes | no

Adam Vadala-Roth wrote 05/14/2018 at 14:52 point

following!

  Are you sure? yes | no

Ted Yapo wrote 05/14/2018 at 15:51 point

I think that was the quickest like/follow I ever got :-)

Thanks!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates