cancel
Showing results for 
Search instead for 
Did you mean: 

DAC output not working properly

fabricepeden
Associate II
Posted on December 23, 2013 at 17:09

Hi everybody,

I'm using the DAC1 output on my STM32F Up to a 12 bits values of around 1000, it works correctly, but after, the output voltage still be at 1.8V (whatever my value to be converted : 3000, 4000..). I have already checked VDDA, VREF+ and VSSA (3.3V and 0V). This output is connected on one input of my four AOPs (LMV358). Please find my code below :

/* Preconfiguration before using DAC----------------------------------------*/
GPIO_InitTypeDef GPIO_InitStructure;
DAC_InitTypeDef DAC_InitStructure;
/* DAC Periph clock enable */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_DAC, ENABLE);
/* GPIOA clock enable (to be used with DAC) */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
/* DAC channel 1 (DAC_OUT1 = PA.4) configuration */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 ;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;
//GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure); 
DAC_InitStructure.DAC_Trigger = DAC_Trigger_None;
DAC_InitStructure.DAC_WaveGeneration = DAC_WaveGeneration_None;
DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Enable;
DAC_Init(DAC_Channel_1, &DAC_InitStructure);
/* Enable DAC Channel1 */
DAC_Cmd(DAC_Channel_1, ENABLE);
and then :
DAC_SetChannel1Data(DAC_Align_12b_R,DISCOVERY_DAC0_35mA_BOUCLE);
If you have any idea or suggestion, thank you in advance.

14 REPLIES 14
John F.
Senior
Posted on January 09, 2014 at 12:41

You have not provided a schematic. However, note that the LMV358 is rail to rail output but not rail to rail input. If powered from +3.3V, you are probably exceeding the amplifier's common mode input voltage range.

Rail to rail I/O amplifiers are available. For example, ''The ADA4500-2 is a dual 10 MHz, 14.5 nV/√Hz, low power amplifier featuring rail-to-rail input and output swings while operating from a 2.7 V to 5.5 V single power supply. Compatible with industry-standard nominal voltages of +3.0 V, +3.3 V, +5.0 V, and ±2.5 V.''

fabricepeden
Associate II
Posted on December 30, 2013 at 10:46

Thank you for answer.

Effectively, my DAC is feed on the - input of each AOP.

Im' looking for in the datasheet of the LMV358, the value of this resistor. But for me, input resistor of an AOP is very high, so it's very strange that cause troubles with my DAC.

raptorhal2
Lead
Posted on December 30, 2013 at 15:56

You seem to be looking in the wrong place.

The F205 datasheet will identify the DAC drive current capability or lowest value resistance the DAC will drive. The minus opamp input will have zero input resistance. Between the DAC and the four minus inputs, you need resisters each at least four times the DAC drive capability.

Cheers, Hal

fabricepeden
Associate II
Posted on December 30, 2013 at 16:48

thank you for your reply.

In the ST205 datasheet, I have found that the minimum load resistor is 5kohms.

If I understand what you mean, I need to put a 20kohms resistor between DAC output and each minus input ?

raptorhal2
Lead
Posted on December 30, 2013 at 19:31

Yes, because four 20K resisters in parallel have an effective 5K resistance.

I suspect you have offset and scaling issues with the opamps. But that is another problem.

Cheers, Hal