Context: I am working on an STM32 project and am now trying to add audio output to the project.
I am planning on using the PAM8302A Class-D audio amplifier to drive the speaker, which has a differential audio input.
Converting the 250 kHz PWM from the MCU to analog audio is simple- just an RC filter, differential PWM requires two filters - to provide a differential audio signal.
Now the tricky part: I need to control the output volume from a DC Control voltage.
I sketched up an idea that seems workable- but always I seek the perspective of others.
Using two small signal MOSFETs, I convert the PWM to open-drain, with matched pullups. The pullup resistors are tied to a variable DC voltage- the voltage on the drains are now a variable-amplitude square waves.
An RC low-pass removes the carrier, leaving a differential analog signal, this gets AC coupled into the two inputs of the class-D amp.
I was trying to imagine if this could be done simpler with some switching diodes, need to ponder this...
The diodes are fast- I am concerned that the 20-50 nS propagation delay of the MOSFET might introduce some nasty distortion, especially near the ends of the duty cycle range?
I don't need great control linearity, and the volume does not need to go all the way to zero.
Clicks and pops when switching this on-and-off are not wanted, it needs to be low power when OFF as well.
Comments invited!


I am planning on using the PAM8302A Class-D audio amplifier to drive the speaker, which has a differential audio input.
Converting the 250 kHz PWM from the MCU to analog audio is simple- just an RC filter, differential PWM requires two filters - to provide a differential audio signal.
Now the tricky part: I need to control the output volume from a DC Control voltage.
I sketched up an idea that seems workable- but always I seek the perspective of others.
Using two small signal MOSFETs, I convert the PWM to open-drain, with matched pullups. The pullup resistors are tied to a variable DC voltage- the voltage on the drains are now a variable-amplitude square waves.
An RC low-pass removes the carrier, leaving a differential analog signal, this gets AC coupled into the two inputs of the class-D amp.
I was trying to imagine if this could be done simpler with some switching diodes, need to ponder this...
The diodes are fast- I am concerned that the 20-50 nS propagation delay of the MOSFET might introduce some nasty distortion, especially near the ends of the duty cycle range?
I don't need great control linearity, and the volume does not need to go all the way to zero.
Clicks and pops when switching this on-and-off are not wanted, it needs to be low power when OFF as well.
Comments invited!


Attachments
-
529.7 KB Views: 1
Last edited: