soerenbnoergaard / Pic-Utilities

Vaious utilities and projects for PIC and dsPIC
0 stars 1 forks source link

Noise on DAC output #2

Open SengerM opened 6 years ago

SengerM commented 6 years ago

Hello, I have implemented a simple PCB for testing your code. It works fine but the output is being very noisy, much more of what I would have expected for a 16 bit audio DAC. It makes the dsPIC practically unusable for audio applications. Had you got the same problem? I have tried many things and the noise is always present, and independent of anything I do. Thanks, Matías.

soerenbnoergaard commented 6 years ago

Hi Matías,

I am glad you got it working :-).

As I remember it, the ADC was very noisy, while the DAC was sort of alright. Are you using a DAC only example?

Are you using a differential amplifier on the output of the DAC+ and DAC-, or measuring it single-ended? I would expect more noise single-ended than differentially.

Best regards, Søren

SengerM commented 6 years ago

Hello Søren, thanks for the quick answer.

The circuit I am using is that of this link. It uses a differential amp as recommended by datasheet. I suspect the noise is coming from DAC because if I set a constant output value, e.g. 0, to the output register there is no audio signal (of course) but the noise remains the same. If I connect things like this the noise completely disappears.

I am surprised of the fact that in the past I got better results with an 8 bit R2R homemade DAC than with this 16 bit audio DAC.

Greetings , Matías.

soerenbnoergaard commented 6 years ago

That sound odd. How is you layout? Do you have short routing of DAC+ and - ?

Is the noise audible or only visible on a scope? I cam see, that I added a cap somewhat randomly on my DAC output. Maybe I had some of the same issues. I am pretty du, I ended up with ok results.

Here is my schematic: http://soerenbnoergaard.dk/project_adcdac.html

Best, Søren

SengerM commented 6 years ago

Yes, it is odd. I am about to give up and get other micro plus audio codec.

In this StackExchange question there is more information on my problem, there is the PCB layout and some tests I have made.

The noise is not only visible on a scope but also audible. In the StackExchange question there is an audio sample.

hananabilabd commented 5 years ago

@SengerM hello Did you succeed to figure it out ? um trying to making one myself ! dspic is supposed to be the best micro-controller support this

SengerM commented 5 years ago

@hananabilabd it seems that although these micro controllers include an "audio" DAC, it is not intended to be used in audio applications. If you check the datasheet (see table 30-46 in this link) you'll find in the specs that there is about 60 dB SNR for the "audio" DAC. This is almost completely useless in audio, you can get pretty the same audio quality with an 8 bit R2R and an Arduino board...

hananabilabd commented 5 years ago

aha , but did you try to implement this circuit Capture because i get the lm4811 & I'll implement it , but I'll really be disappointed if the audio quality was bad in fact um running an audio circuit using MEMS microphone ? so do you think it'll work out , or I should switch to another microcontroller like STM32 I'll try to avoid dspic adc as MEMS microphone output digital signal , so do you think this might eliminate the problem ?

SengerM commented 5 years ago

Yes, I did implemented that circuit and many others. The audio quality is not that bad, but you have an annoying noise in the background when you play audio at low volumes. You can test the noise level you'll get with the attached Octave script. It generates an audio file with 60 dB of SNR normalized to 1, and adds a tone to compare.

In my experience the 12 bit ADC is better for audio applications than the 16 bit "audio" DAC. The audio signal degrades more in the "audio" DAC than in the ADC.

test_SNR.txt

hananabilabd commented 5 years ago

May I ask you How did you solder LM4811 ? and can I have your mail Thanks

SengerM commented 5 years ago

I didn't precisely used the LM4811. I implemented an equivalent circuit using other op-amp. It is not a matter of the external circuit you use, the limitation comes from the fact that the DAC has 60 dB of SNR (specified by the manufacturer). You can do nothing to improve that.