Author Topic: STM32 interrupt causing noise on DAC output  (Read 2011 times)

0 Members and 1 Guest are viewing this topic.

Offline ratataxTopic starter

  • Regular Contributor
  • *
  • Posts: 134
  • Country: fr
STM32 interrupt causing noise on DAC output
« on: December 03, 2020, 01:29:11 pm »
Hi,
I'm using an STM32F7 with its internal DAC for an audio project.
It works but my VDD (3.3V) is fluctuating due to current draw from the MCU at fixed intervals (each time my 250Hz interrupt happens), which causes the DAC to output a "pulse-like" waveform, not very loud but clearly hearable.
I can reduce the fluctuations by putting a large (1000uF) capacitor between VDD and GND, but it doesn't removes it completely.
Power comes from +5V regulated to 3.3V by an LDO.

Adding even more capacitance sounds like a bad brute-force method, do you think of solutions to make VDD immune to load fluctuations from the MCU ? On the STM32 there is a VDDA pin which I connect directly to VDD. Maybe an LC filter between them to prevent ripple on digital supply to get over the analog supply ? But it's 250Hz noise with a pulse-shape (many harmonics), how could I filter that ?
 

Online Siwastaja

  • Super Contributor
  • ***
  • Posts: 8760
  • Country: fi
Re: STM32 interrupt causing noise on DAC output
« Reply #1 on: December 03, 2020, 01:49:30 pm »
At high frequencies (>10MHz), LC out of "actual" inductor, or at >50MHz, a ferrite bead. Be careful not to create more problems than you solve (i.e., resonance)
At low frequencies (<1MHz), any linear regulator. Seems this is your case.
Between these, certain specific linear regulators rated for good PSRR at high frequency. Shop around.

Trying to filter low such low frequency disturbances means large values of L and C, not practical. You would be storing quite a bit of energy. Instead, you have power available at the input; regulate it!

In other words, copy-pasta your existing 3V3 regulator so that VDDA has its own, this is easy because no extra BOM lines to order. If high-frequency noise (outside the PSRR of the regulator) is a problem, add LC (or ferrite bead) to the input side of that regulator.
« Last Edit: December 03, 2020, 01:52:11 pm by Siwastaja »
 

Offline AndyC_772

  • Super Contributor
  • ***
  • Posts: 4278
  • Country: gb
  • Professional design engineer
    • Cawte Engineering | Reliable Electronics
Re: STM32 interrupt causing noise on DAC output
« Reply #2 on: December 03, 2020, 01:59:46 pm »
Bear in mind, what you really need is for VDD to be smooth at the DAC, which is physically located on the die. It's separated from any filtering you apply externally by a bond wire, copper lead frame and on-die routing, all of which have inductance and resistance that you can't do anything about.

Since the problem is at audio frequencies, the root cause is probably related more to resistance than inductance. I'd start by looking to see what might be changing the static current draw of the CPU each time the interrupt is triggered; if the current draw of the CPU changes, then even with perfect filtering right by the pins, the IR voltage drop across the die and packaging can still mean that the exact value of VDD changes where it matters most.

Does your CPU have any I/O pins which are sinking or sourcing non-trivial amounts of current?

What does your 250 Hz interrupt actually do?

Offline ratataxTopic starter

  • Regular Contributor
  • *
  • Posts: 134
  • Country: fr
Re: STM32 interrupt causing noise on DAC output
« Reply #3 on: December 03, 2020, 02:23:01 pm »
Quote
Does your CPU have any I/O pins which are sinking or sourcing non-trivial amounts of current?
No

Quote
What does your 250 Hz interrupt actually do?
It fills an audio buffer in memory, which is automatically transferred to the DAC via DMA. Outside the interrupt, the main thread is an empty while loop. Maybe I should try doing some stuff in it, just to prevent any optimization from putting the MCU is some sort of low-power mode each time an interrupt finishes


Quote
In other words, copy-pasta your existing 3V3 regulator so that VDDA has its own, this is easy because no extra BOM lines to order. If high-frequency noise (outside the PSRR of the regulator) is a problem, add LC (or ferrite bead) to the input side of that regulator.
That seems to be a really good idea, i'll try it for sure !
My regulator is a fairly standard AMS1117-3.3
 

Offline aheid

  • Regular Contributor
  • *
  • Posts: 245
  • Country: no
Re: STM32 interrupt causing noise on DAC output
« Reply #4 on: December 04, 2020, 05:57:23 am »
I seem to recall some timing and relative voltage requirements of VDDA vs VDD on the STM32s, but then again I've seen some designs which seem to pretty much ignore this so I don't know how much is theoretical datasheet talk or not.
 

Offline radar_macgyver

  • Frequent Contributor
  • **
  • Posts: 724
  • Country: us
Re: STM32 interrupt causing noise on DAC output
« Reply #5 on: December 04, 2020, 06:57:45 am »
Filtering VDDA may still help if what's coupling in is a harmonic of your ISR frequency and not the fundamental.

Also double check that you don't have an off-by-one error in your ISR when transferring a block of audio, dropping a sample can cause a click.
 

Online Siwastaja

  • Super Contributor
  • ***
  • Posts: 8760
  • Country: fi
Re: STM32 interrupt causing noise on DAC output
« Reply #6 on: December 05, 2020, 09:22:50 am »
I seem to recall some timing and relative voltage requirements of VDDA vs VDD on the STM32s, but then again I've seen some designs which seem to pretty much ignore this so I don't know how much is theoretical datasheet talk or not.

Yes, a diode between VDDA and VDD is needed to satisfy the power sequencing requirements. It likely seems to work without just fine though given the same regulator IC with same amount of output capacitance.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf