cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f4 discovery and dac

fernando239955_st
Associate
Posted on March 05, 2013 at 14:19

hey there,

recently I've started playing with a stm32f4discovery with the final goal of realizing the control of a particular simple device we had in our company. It is my first embedded project so I'm quite new to this world and I'm a bit disoriented. Anyway I managed to run through several code example and build an application that read several analog input (multichannel adc with dma), and using those input to evaluate a pid regulator called using systick. Now I need to write the output on some port and here comes the pain!

I cant quite understand how the example of wave generation works. All I need to do is write the output of the pid function to some port every time the pid is evaluated. So I dont think I need the DMA, and the DAC should be triggered by my piece of software. How do I do that?

Second question: I've seen that for analog input I have potentially a lot of channels and 3 adc, and that is good. But for output just 2 channels and 1 dac? o_O

If I put more than two pid regulator in it I cant pull out the calculated output? that's strange. I hope I've misunderstood something. 

Thank you in advance for your help.

Fernando
2 REPLIES 2
raptorhal2
Lead
Posted on March 05, 2013 at 19:01

The ADCs need DMA because there are multiple channels and one data register per ADC. The two DACs don't need DMA. Look in the peripheral library DAC examples for further guidance.

The DACs have a user selection of output buffer amplifier or not. With no buffer, the full output range is available, but the drive current is very low. That may be why you are having problems driving two devices. With the buffer, output range is limited as defined in the data sheet. You might consider using no buffer and an external amplifier as a driver.

Cheers, Hal

frankmeyer9
Associate II
Posted on March 06, 2013 at 08:34

Briefly looking, only the STM32F10x StdPeripheral Library contains example project that actually uses the software trigger method. I believe you can assume the DAC peripherals to be basically identical in all parts

As Hal mentioned, you have to weight output swing against output impedance, i.e. using the internal buffer amplifier or not. You can take the electrical characteristics from the datasheet.

But generally speaking, you will rarely find a MCU with integrated DAC's, and more than one or two. They are rarely used, occupy a relatively large silicon space, and never reach the quality of a separate unit. Analogue integration in digital circuitry, at least at the involved frequencies, is always a tradeoff.

If you need more DAC channels, you can take a simple and quasi-ratiometric one like the LTC1257.