I am designing a custom STM32F303-based PCB and need to get several analog outputs from the microcontroller. STM32 has two DAC channels which I suppose I can use for this purpose to avoid getting PWM pseudo-analog signals, but rather the analog ones. If I need more of those outputs, should I also include external DACs between MCU and the final outputs?
\$\begingroup\$ What you should do depends on what are your requirements for the analog outputs so it's impossible to say how the requirements could be met. \$\endgroup\$– JustmeOct 20, 2022 at 7:13
1\$\begingroup\$ Are these analog outputs static? Or are they dynamic? If static you can use digital pots. \$\endgroup\$– DKNguyenOct 20, 2022 at 13:10
Yes, you should add external chips via SPI or I2C as you stated yourself; you don't want a pseudo-analog PWM signal and you want more than two outputs.
I've found one at Adafruit which has four channels.
\$\begingroup\$ Thanks! And as for the digital outputs, it is not really necessary to add ADC between the STM32 and the outputs, right? \$\endgroup\$– ValeriyaOct 20, 2022 at 8:46
\$\begingroup\$ I don't understand your question. If you want an analog output created from a digital signal you'll need to pass this "pattern" via the I2C layer to the external IC. You might choose the option to feed back the signal to the controller (ADC ) in order to check and correct it. But this depends on the application. \$\endgroup\$– Whois_meOct 20, 2022 at 9:08
\$\begingroup\$ What about other solutions than adding DACs? Why do you suggest adding DACs if you don't know why they are needed? \$\endgroup\$– JustmeOct 20, 2022 at 9:54
\$\begingroup\$ I answered a question with a limited scope. I presume the OP knows what a DAC is and why he wants them, because this would yielded a different question otherwise. \$\endgroup\$– Whois_meOct 20, 2022 at 10:32
Contrary to another answer, you don't necessarily need to add more DAC chips.
Depending on your needs, you can simply demultiplex the MCU DAC outputs into sample/hold circuits to have more analog outputs.