AnsweredAssumed Answered

A question about DAC output voltage on STM32F429 Discovery board

Question asked by naughty_mark on May 4, 2014
Latest reply on May 5, 2014 by naughty_mark
Hi everyone,
I am using stm32F429 discovery boad to learn STM32 MCU. I tried to ask MCU read a voltage from ADC port(with DMA) and transfer that value to a DAC output(without DMA), just for me to familiar with these basic feature in STM32.
The problem I got is when the ADC value is 0xFFF, it transfered the value to DAC_DHR12R2_ADDRESS and the value in DOR2 is 0xFFF as well(I am using debug mode to watch those regs), however, the LED connected on the DAC is not really light as it should be, and I measure the voltage on it, it is just 1.031V, the value in DOR2 is correct as 0xFFF, but the realastic voltage is just 1/3 of the system voltage(3V I suppose), could anyone give me a help on this issue or met this kind of problem as well?

Part of my code about DAC setting:
/* DAC channel 2 (DAC_OUT2 = PA.5) configuration */
 GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_5;
 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;
 GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
 GPIO_Init(GPIOA, &GPIO_InitStructure);
  
DAC_DeInit()
  
  /* DAC channel2 Configuration */
 DAC_InitStructure.DAC_Trigger = DAC_Trigger_Software;
 DAC_InitStructure.DAC_WaveGeneration = DAC_WaveGeneration_None;
 DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Enable;
 DAC_Init(DAC_Channel_2, &DAC_InitStructure);
  
DAC_Cmd(DAC_Channel_2, ENABLE);

And in the main function, my code about DAC is:
DAC_SetChannel2Data(DAC_Align_12b_R, uhADC3ConvertedValue);//uhADC3ConvertedValue is the ADC reading value in 12-bit
 /*Enable software trigger to conversion*/
 DAC_SoftwareTriggerCmd(DAC_Channel_2, ENABLE);
Thanks for your help~
Mark

Outcomes