AnsweredAssumed Answered

STM32f100 DAC wrong Behavior

Question asked by GDC on Oct 27, 2014
Latest reply on Oct 28, 2014 by fm
Hi guys,

I´m having some difficulties getting the DAC working properly with the STM32F100 LQFP48pins.

First of all, Reference Manual says the following

On 64-pin packages and packages with less pins
The VREF+ and VREF- pins are not available, they are internally connected to the ADC
voltage supply (VDDA) and ground (VSSA).

I´ve in my PCB VDDA connected to 3,3v.

11.3.5 DAC output voltage
Digital inputs are converted to output voltages on a linear conversion between 0 and VREF+.
The analog output voltages on each DAC channel pin are determined by the following
equation:

DACoutput=VREF*DOR/4095


Mi code is the following;



    GPIO_InitStruct.GPIO_Pin   = GPIO_Pin_4;
    //GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_InitStruct.GPIO_Mode  = GPIO_Mode_AIN;
    GPIO_Init(GPIOA_BASE, &GPIO_InitStruct);


    // DAC channel1 Configuration
    DAC_StructInit(&DAC_InitStruct);
    DAC_InitStruct.DAC_Trigger = DAC_Trigger_None;
    DAC_InitStruct.DAC_WaveGeneration = DAC_WaveGeneration_None;
    DAC_InitStruct.DAC_OutputBuffer = DAC_OutputBuffer_Disable;
    
DAC_Init(xDACTable[DAC1].eDAC_Channel, &DAC_InitStruct);

DAC_Cmd(DAC_Channel_1, ENABLE);

DAC_SetChannel1Data(DAC_Align_12b_R, 0x0FFF);

DAC_SoftwareTriggerCmd(DAC_Channel_1, ENABLE);



Loading in DAC DOR register the Value =4095 I only get 2,5v instead of 3,3v 

Anyone knows why am I doing wrong?

Outcomes