cancel
Showing results for 
Search instead for 
Did you mean: 

Bad signal when using DAC'S full range and buffer

FLewz.1
Associate III

Hi,

I've been trying to synthesize different waveforms with my F446 DAC. Three things have come to my attention here, which I can't explain.

First, when I am using the full range of the DAC with values from 0 to 4095 the signal gets distorted like this for sine and ramp:

0693W000000W3VBQA0.png0693W000000W3VLQA0.png

whereas using the range from 0 to 2047, the signal looks great like this:

0693W000000W3VQQA0.png

0693W000000W3VVQA0.png

Second, using the smaller range, when I am going to higher audio frequencies the SNR suffers greatly as seen in these spectra:

0693W000000W3VaQAK.png

0693W000000W3VfQAK.png

with frequencies over about 5k or 6k being reduced to white noise.

Third, using the buffer distorts the signal even worse like this:

0693W000000W3VpQAK.png

To synthesize the signals I am using a timer to trigger the dma to push values from a LUT to the DAC.

If anybody has any ideas what could be causing these problems, I'd appreciate comments.

5 REPLIES 5
RMcCa
Senior II

I think you might have both hardware and software issues. First, try a direct digital synthesis algorithm using a fast enough counter to generate a constant sample rate, remembering Nyquist and sin(x)/x dac errors. Also double check the output circuitry. I have had good luck using the 2 dacs in f7s to make audio using a single audio quality opamp per channel ​(with +/-12 v supplies) to shift the signal down by 1/2 Vref and then feeding a pair of balanced line drivers.

FLewz.1
Associate III

Thanks for the pointers. About the hardware, I was thinking my output circuitry might be the problem, thats why I grabbed the signal right from the µC pin with buffers enabled, as I figured this should result in a clean signal. Unfortunately I don't have an oscilloscope here so I used my Computer line in to visualize the signal.

As for software, you might be right. I didn't generate a signal with a constant sample rate and with proper DDS. Although I didnt't think this would affect the problems with using the full range of the DAC?

You did not tell us which STM32 are you using, but generally the STM32 DAC does not cover the whole range well, and with buffer it's even worse. Review the DAC parameters in datasheet.

JW

RMcCa
Senior II

F446, he says.

Definately try DDS. ​are you trying to create variable frequencies by simply changing the timer controlling the dma?

FLewz.1
Associate III

yup, I was trying to change the ARR according to the frequency as a first attempt to get a signal out, but now I see why this wasn't a good solution for higher frequencies.