Noisy ADC + DC bias introduced when I pluck a string

Started by gabrielgcma, March 15, 2025, 08:10:27 PM

Previous topic - Next topic

FiveseveN

Quote from: gabrielgcma on April 13, 2025, 06:23:41 PMthe audio interface CLIP led blinks all the time
Hold right up!
That means the input of the interface is clipping (signal amplitude is too high for the current gain setting), not that it's detecting a clipped signal (how would it do that?!).
Quote from: R.G. on July 31, 2018, 10:34:30 PMDoes the circuit sound better when oriented to magnetic north under a pyramid?

free electron

The ADC data plots suggest that random bits in the data stream are flipped causing the interface to detect a clip. The 1st plot has a low amplitude (silent?) 1st part, even there there are random dots close to the positive max range.
I'd say it's the wiring and poor breadboard grounding causing all sorts of signal integrity issues, esp. with 512Fs master clock.

ElectricDruid

I doubt it's the hardware. Although it's "not advisable" from a noise point of view I've had stuff like this running on the breadboard lots of times without serious issues. So it can be done like you have it.

The sine wave from the input looks good now, so you've got decent data coming in from the ADC. That's a good start.

One test I always do with a DAC is to use a variable as an incrementing count and feed that to the DAC. So every sample, you increment the count, send the count to the DAC. The DAC should then produce a rising ramp that goes through every value. If that isn't working, you've still got something setup wrong, or the data is getting corrupted on its way to the DAC or something.
It's a good test because it doesn't depend on anything else at all - it's purely a test of getting data out of the DAC.

gabrielgcma

#23
Quote from: FiveseveN on April 14, 2025, 03:42:13 AM
Quote from: gabrielgcma on April 13, 2025, 06:23:41 PMthe audio interface CLIP led blinks all the time
Hold right up!
That means the input of the interface is clipping (signal amplitude is too high for the current gain setting), not that it's detecting a clipped signal (how would it do that?!).

On the scope it really shows that the DAC is trying its best to output that mess of a signal coming from the ADC. Now I get the clipping, thanks.

Quote from: free electron on April 14, 2025, 05:08:21 AMThe ADC data plots suggest that random bits in the data stream are flipped causing the interface to detect a clip. The 1st plot has a low amplitude (silent?) 1st part, even there there are random dots close to the positive max range.
I'd say it's the wiring and poor breadboard grounding causing all sorts of signal integrity issues, esp. with 512Fs master clock.

Even if it's not the culprit I'll lay the circuit on a perf board soon, I can't stand all these wires and the "I'll stop working if you slightly touch me".  :P Any recommendations on how to do that without messing up? I'm concerned more about power rails/points of connection. How can I do them on perf boards without introducing more noise?

Quote from: ElectricDruid on April 14, 2025, 06:21:13 AMI doubt it's the hardware. Although it's "not advisable" from a noise point of view I've had stuff like this running on the breadboard lots of times without serious issues. So it can be done like you have it.

The sine wave from the input looks good now, so you've got decent data coming in from the ADC. That's a good start.

One test I always do with a DAC is to use a variable as an incrementing count and feed that to the DAC. So every sample, you increment the count, send the count to the DAC. The DAC should then produce a rising ramp that goes through every value. If that isn't working, you've still got something setup wrong, or the data is getting corrupted on its way to the DAC or something.
It's a good test because it doesn't depend on anything else at all - it's purely a test of getting data out of the DAC.

That's a great idea, I'll try that, thanks!

I realized that I'm only able to provide clock to the ADC (to have it as master) using HSI, which only now I understand is very noisy and jittery. Maybe it's the clock source after all. I'll try to get the HSE working, setup the STM32 as master instead of the ADC using HSE.

free electron

Quote from: gabrielgcma on April 14, 2025, 10:10:39 PMEven if it's not the culprit I'll lay the circuit on a perf board soon, I can't stand all these wires and the "I'll stop working if you slightly touch me".  :P Any recommendations on how to do that without messing up? I'm concerned more about power rails/points of connection. How can I do them on perf boards without introducing more noise?

For a perfboard, i think this is a good approach: LINK
A pin header sockets for the modules (dev board, adc, dac etc) and perhaps for the components that might need a change, like the gain setting resistor, wire everything on the other side with a magnet wire (signals) and thicker wires for power and GND.
Optional - a small series termination resistors (47-100R, ideally SMT 0805 - they fit nicely between the 0.1" pads on  a perfboard) placed directly at the driving pin for the I2S bus might also help to reduce the crosstalk and reflections. Ideally, if you have a piece of the sticky copper tape, you could run a copper stripe connected to GND and place the I2S bus over it, securing the wires with kapton tape. This would be close to what is on an actual PCB, signal traces ontop of a ground reference plane.



I don't think the output buffer is needed. The PCM5102A DAC has a built in charge pump for internal bipolar supply, it's outputs are GND referenced, not VCC/2. Your buffer is not biased properly if connected as in the schematic - directly to the DAC output.