cancel
Showing results for 
Search instead for 
Did you mean: 

DAC can't output 0V

hariprasad
Associate III
Posted on February 19, 2015 at 07:41

I'm using stm32f429 discovery board. I have configured DAC Channel 1 (PA4) for DAC ouput.

When I try to configure ouput in the range of 0.15v - Vref(2.97v) I'm getting the ouput properly, but when trying to output 0v it's still showing 0.12 (measured using multimeter)

In fact I cant get a voltage below 0.12 V, is this behaviour expected ..

I dont think this is an issue with my code any way I'm posting code alongwith

What might be causing this offset voltage?

GPIO_InitTypeDef GPIO_InitStructure;

DAC_InitTypeDef DAC_InitStructure;

RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);

RCC_APB1PeriphClockCmd(RCC_APB1Periph_DAC, ENABLE);

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;

GPIO_Init(GPIOA, &GPIO_InitStructure);

DAC_InitStructure.DAC_Trigger=DAC_Trigger_None;

DAC_InitStructure.DAC_WaveGeneration=DAC_WaveGeneration_None;

DAC_InitStructure.DAC_LFSRUnmask_TriangleAmplitude=DAC_LFSRUnmask_Bit0;

DAC_InitStructure.DAC_OutputBuffer=DAC_OutputBuffer_Enable;

DAC_Init(DAC_Channel_1,&DAC_InitStructure);

DAC_Cmd(DAC_Channel_1, ENABLE);

while(1)

{

DAC_SetChannel1Data(DAC_Align_12b_R, 868); //ouput .7v ((2.97 * 868) / 4095)= 0.7v

delay_milliseconds(5000); // MY custom API for delay 5seconds

DAC_SetChannel1Data(DAC_Align_12b_R, 0); //expects output of 0v but gets 0.12v

delay_milliseconds(5000); // MY custom API for delay 5seconds

}

#dac #stm32 #!stm32f4-disco

6 REPLIES 6
Posted on February 19, 2015 at 09:15

And what does the datasheet say (hint: under DAC electrical characteristics)?

JW
AvaTar
Lead
Posted on February 19, 2015 at 09:23

And what does the datasheet say (hint: under DAC electrical characteristics)?

 

Second hint: look at your load conditions. A multimeter might not be appropriate, especially in unbuffered mode.

hariprasad
Associate III
Posted on February 20, 2015 at 07:50

Thanks for the reply,

Ok , now I understood why I got that output voltage .

So I'm checking about do I really need to use the Buffered mode?

According to my custom board DAC ouput is given to 290Kohm resistor, but as per data sheet I have to use 1.5Mohm resistor if i do not want to use buffered mode.

So I still have to use the buffered mode right?

AvaTar
Lead
Posted on February 20, 2015 at 09:53

So I still have to use the buffered mode right?

 

Depends on your application.

But for most cases, an external buffer amplifier (voltage follower opamp) will be useful, instead of the internal buffer.

hariprasad
Associate III
Posted on February 20, 2015 at 11:37

Hi , one more doubt..

When I try disabling OutputBuffer , by

DAC_InitStructure.DAC_OutputBuffer=DAC_OutputBuffer_Disable;

and on configuring for 0.15 gives me 2.09V , why is this so ? or am i missing something again?
raptorhal2
Lead
Posted on February 20, 2015 at 16:31

Here is another hint. Check the Discovery User Manual for dedicated PA4 board assignment, and combine that with your analysis of current drive capability if the load has to be as high as specified in the data sheet.

Cheers, Hal

Cheers, Hal