Author Topic: Poor man's FPGA DAC  (Read 3373 times)

0 Members and 1 Guest are viewing this topic.

Offline nimishTopic starter

  • Regular Contributor
  • *
  • Posts: 187
  • Country: us
Poor man's FPGA DAC
« on: August 18, 2022, 09:02:04 pm »
Has anyone used a high-speed fpga serdes (xilinx GTX, GTH) as an ad-hoc 1 bit DAC?  I have some wasted serdes that I'd like to use to synthesize < 150MHz sine waves with low jitter

I know xilinx has a an app note that shows how to use them as precision clock cleaners/VCXO: https://support.xilinx.com/s/article/56136?language=en_US so I figure there's some way to hack them to work.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15321
  • Country: fr
Re: Poor man's FPGA DAC
« Reply #1 on: August 18, 2022, 09:22:00 pm »
Nope but that should be doable.
I have implemented sigma-delta DACs on FPGA just using regular IOs, for higher sample rate, yes I guess I could just aggregate the output in wider chunks and pass it to a SERDES.
Thing is, the sigma-delta part would have to run fast enough and would probably need to be written differently.
 

Offline langwadt

  • Super Contributor
  • ***
  • Posts: 4713
  • Country: dk
Re: Poor man's FPGA DAC
« Reply #2 on: August 18, 2022, 09:30:23 pm »
Nope but that should be doable.
I have implemented sigma-delta DACs on FPGA just using regular IOs, for higher sample rate, yes I guess I could just aggregate the output in wider chunks and pass it to a SERDES.
Thing is, the sigma-delta part would have to run fast enough and would probably need to be written differently.

could possible make the sigma-delta with multi bit output and the turn those bits into PWM
 

Offline tom66

  • Super Contributor
  • ***
  • Posts: 7011
  • Country: gb
  • Electronics Hobbyist & FPGA/Embedded Systems EE
Re: Poor man's FPGA DAC
« Reply #3 on: August 18, 2022, 10:01:51 pm »
A friend of mine had an idea similar to this using MASH (noise shaping, essentially) to shift as much of the D-S noise into the high frequency domain.  It doesn't seem to be widely used outside of audio, but I'd be curious how well it works for a DDS. 

A mid-performance FPGA can easily get 1.5Gbit/s on a pin, so a pair of pins driving a 2-bit current source could presumably get ~12 bit resolution at ~20MHz -- approaching a low-end DDS generator.
 

Offline tszaboo

  • Super Contributor
  • ***
  • Posts: 7911
  • Country: nl
  • Current job: ATEX product design
Re: Poor man's FPGA DAC
« Reply #4 on: August 18, 2022, 10:03:20 pm »
Given, that an FPGA usually has more pins than needed, an R-2R DAC makes sense.
We did that with 4 bit R-2R, generating VGA signal for monitors, Spartan 3, so it wasn't even that fast. That's ballpark the same frequency.
 

Online BrianHG

  • Super Contributor
  • ***
  • Posts: 8090
  • Country: ca
Re: Poor man's FPGA DAC
« Reply #5 on: August 18, 2022, 11:08:54 pm »
Given, that an FPGA usually has more pins than needed, an R-2R DAC makes sense.
We did that with 4 bit R-2R, generating VGA signal for monitors, Spartan 3, so it wasn't even that fast. That's ballpark the same frequency.
A simple R2R dac for a 150Mhz sine wave?
Good luck on flatness, overtone, third harmonics, power supply interference adjacent pin cross-talk, ground bounce...

 

Offline Someone

  • Super Contributor
  • ***
  • Posts: 4961
  • Country: au
    • send complaints here
Re: Poor man's FPGA DAC
« Reply #6 on: August 19, 2022, 12:32:10 am »
Given, that an FPGA usually has more pins than needed, an R-2R DAC makes sense.
We did that with 4 bit R-2R, generating VGA signal for monitors, Spartan 3, so it wasn't even that fast. That's ballpark the same frequency.
A simple R2R dac for a 150Mhz sine wave?
Good luck on flatness, overtone, third harmonics, power supply interference adjacent pin cross-talk, ground bounce...
But at the same time, the serdes is optimized for eye opening (usually with rounded/slewed edges) so is going to be hard to treat as a perfect output for a modulator. I tested some Xilinx OSERDES for DAC use and they were already worse than ODDR for lower frequency (128x oversampling) content.

As in previous threads....
https://www.eevblog.com/forum/projects/generating-a-clean-10khz-sine-wave-from-pwm/?all
If its only a single (or narrow) frequency sine, get out the textbooks and design a bandpass filter, together with modulation. They are multiplicative effects.
 

Offline nimishTopic starter

  • Regular Contributor
  • *
  • Posts: 187
  • Country: us
Re: Poor man's FPGA DAC
« Reply #7 on: August 19, 2022, 02:20:56 am »
They are 12.5Gbps (maybe 16 ish) SERDES. Bandwidth is 1Hz -- just need the pure tone or a very narrow approximation thereof.

PDM seems fine. I don't think the transmitter would like PWM, doesn't it need transitions for DC balance?

Seems wasteful to not use the very powerful PLLs and such baked into the chip.
 

Offline betocool

  • Regular Contributor
  • *
  • Posts: 119
  • Country: au
Re: Poor man's FPGA DAC
« Reply #8 on: August 20, 2022, 03:49:08 am »
I just finished about a week ago a PDM DAC running at 49 MHz on a Cyclone IV. The input is 48 KHz. Mind you, I have not yet filtered the incoming 48KHz, instead just squarely extended it.

It works, that's all about I can say without going into the possibly woeful performance of a first pass try. I will get a FIR filter running in some time, and lower the output frequency to 6.144 MHz (48KHz x128) to try a few things out.

Here's the code if you're interested (based on a 0x0 - 0xFFFF 16 bit value).

Code: [Select]
  PDM_process: process(dac_clk_i, dac_enable, data_fifo_out, err)
  begin
    if(dac_enable = '0') then
      dac_pdm_o <= '0';
      err <= X"0000";
      y_out <= X"0000";
    else
      if(rising_edge(dac_clk_i)) then
        if (unsigned(data_fifo_out) >= unsigned(err)) then
          dac_pdm_o <= '1';
          y_out <= X"FFFF";
        else
          dac_pdm_o <= '0';
          y_out <= X"0000";
        end if;
        err <= std_ulogic_vector(unsigned(err) + unsigned(y_out) - unsigned(data_fifo_out));
      end if;
    end if;   
  end process;

I got an image somewhere from a scope... nothing to boast though...
1569829-0

Cheers,

Alberto


 
The following users thanked this post: tom66

Offline tszaboo

  • Super Contributor
  • ***
  • Posts: 7911
  • Country: nl
  • Current job: ATEX product design
Re: Poor man's FPGA DAC
« Reply #9 on: August 21, 2022, 08:52:55 pm »
Given, that an FPGA usually has more pins than needed, an R-2R DAC makes sense.
We did that with 4 bit R-2R, generating VGA signal for monitors, Spartan 3, so it wasn't even that fast. That's ballpark the same frequency.
A simple R2R dac for a 150Mhz sine wave?
Good luck on flatness, overtone, third harmonics, power supply interference adjacent pin cross-talk, ground bounce...
The same issues arise using one pin, or similar issues. Plus jitter, eye diagram cleanness, difference for rise and fall times, etc.
 

Offline colorado.rob

  • Frequent Contributor
  • **
  • Posts: 420
  • Country: us
Re: Poor man's FPGA DAC
« Reply #10 on: August 25, 2022, 08:26:16 pm »
This topic was discussed here a while back: https://www.eevblog.com/forum/fpga/artix-7-gtp-transceiver-as-delta-sigma-dac/

At that frequency you might want to consider doing what a lot of RF equipment does. Take the square wave and filter the odd harmonics.
 

Online dmendesf

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: br
Re: Poor man's FPGA DAC
« Reply #11 on: August 25, 2022, 11:18:01 pm »
If you want a single frequency output then SHE (selective harmonic elimination) is a better idea. You can see a dumbed down version by looking for "Magic Sines" from Don Lancaster.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15321
  • Country: fr
Re: Poor man's FPGA DAC
« Reply #12 on: August 25, 2022, 11:25:45 pm »
For a fixed frequency output, you can also (better because more flexible) just generate the 1-bit sequence for one whole period of sine outside of the FPGA, store it in EBR and replay the sequence in loop through a SERDES. That eliminates the issue of running a sigma-delta DAC in real-time @several GHz.
 
The following users thanked this post: colorado.rob

Online dmendesf

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: br
Re: Poor man's FPGA DAC
« Reply #13 on: August 25, 2022, 11:59:37 pm »
That's the idea with SHE (generate a bitstream offline, play It endlessy). SHE is just a way to generate the bitstream minimizing the low order harmonics.
 

Offline colorado.rob

  • Frequent Contributor
  • **
  • Posts: 420
  • Country: us
Re: Poor man's FPGA DAC
« Reply #14 on: August 26, 2022, 03:45:49 pm »
For a fixed frequency output, you can also (better because more flexible) just generate the 1-bit sequence for one whole period of sine outside of the FPGA, store it in EBR and replay the sequence in loop through a SERDES. That eliminates the issue of running a sigma-delta DAC in real-time @several GHz.

I like this. Then just adjust the clock driving the output to get the output frequency you want.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15321
  • Country: fr
Re: Poor man's FPGA DAC
« Reply #15 on: August 26, 2022, 06:25:42 pm »
That's the idea with SHE (generate a bitstream offline, play It endlessy). SHE is just a way to generate the bitstream minimizing the low order harmonics.

Oh, OK. I don't know much about SHE, so I'm not sure about the benefit here, for generating bitstreams offline. If you have any reference material...

I would personally just implement a sigma-delta modulator (that then can be made as good as required) in C (use your preferred language) and generate bitstreams for a specific frequency (and possibly amplitude too) for single periods. The nice thing with this approach is that it can be used for actually any periodic signal, as long as the required number of samples for a period is within what's available on your FPGA in terms of EBR.
 

Online dmendesf

  • Frequent Contributor
  • **
  • Posts: 336
  • Country: br
Re: Poor man's FPGA DAC
« Reply #16 on: August 26, 2022, 11:25:53 pm »
The fundamental Idea is as follows: Sigma-delta is a simple enough algorithm that can be used in real time to compute a bitstream with the same low order harmonics than the input waveform, shifting the imperfections to higher harmonics that will be filtered with a low pass filter. Assuming the input waveform is a sinewave, SHE is a way to compute a better bitstream but it's very computationally intensive so usually done offline. A good reference:

https://vtechworks.lib.vt.edu/bitstream/handle/10919/35333/Chapter4.pdf%3Fsequence%3D5&ved=2ahUKEwj9p7bVzOX5AhWMGbkGHZlmDSYQFnoECDQQAQ&usg=AOvVaw2oHwFneCGJRmEQEH-YQgwK
 

Offline SMB784

  • Frequent Contributor
  • **
  • Posts: 421
  • Country: us
    • Tequity Surplus
Re: Poor man's FPGA DAC
« Reply #17 on: August 27, 2022, 12:34:10 am »
A ways back I implemented my own second order Sigma-Delta DAC (with CIC low pass filter for test benching) in verilog.  All of the code is provided in the link below, and some performance verifications are provided in the subsequent posts:

https://www.eevblog.com/forum/fpga/2nd-sigma-delta-digital-to-analogue-converter-(sd-dac)-in-verilog/msg3119924/#msg3119924
 
The following users thanked this post: nimish


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf