AnsweredAssumed Answered

help ! STM32F4 DAC outputs only half of what I send to DAC

Question asked by karakaya.mehmet on Mar 28, 2013
Latest reply on Mar 29, 2013 by fm
hello dear forum,

I write 2048 to STM32F4 DAC, it gives 0.83V instead of 1.65V
if I write 4095 it gives 1.65 V instead of 3.3V

the output of DAC is input to an OPAPM amplifier
I mean it is not loaded

here is the init routine

void DACinit(void){
      RCC_APB1PeriphClockCmd(RCC_APB1Periph_DAC, ENABLE);
  
  /* Once the DAC channel is enabled, the corresponding GPIO pin is automatically 
     connected to the DAC converter. In order to avoid parasitic consumption, 
     the GPIO pin should be configured in analog */
  GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_4;// | GPIO_Pin_5;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;
  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
  GPIO_Init(GPIOA, &GPIO_InitStructure);
  
  DAC_InitStructure.DAC_Trigger = DAC_Trigger_None ;
  DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Disable;
  DAC_Init(DAC_Channel_1, &DAC_InitStructure);
  /* Enable DAC Channel1: Once the DAC channel1 is enabled, PA.04 is 
     automatically connected to the DAC converter. */
  DAC_Cmd(DAC_Channel_1, ENABLE);
}

and in the main() function

DAC_SetChannel1Data(DAC_Align_12b_R, DACS[4]);

is called every 10 milisecond
I observe with JTAG the DACS[4] value it is correct

what am I doing wrong ?

thank you

Outcomes