AnsweredAssumed Answered

DAC output not working properly

Question asked by Peden.Fabrice on Dec 23, 2013
Latest reply on Jan 9, 2014 by John F.
Hi everybody,

I'm using the DAC1 output on my STM32F205. 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.

Outcomes