cancel
Showing results for 
Search instead for 
Did you mean: 

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

mehmet.karakaya
Associate III
Posted on March 28, 2013 at 21:34

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 #stm32f4-dac
2 REPLIES 2
Posted on March 28, 2013 at 22:04

Try PA5 too if you've got nothing attached to it. Check also VDDA/VSSA/VREF

  /* DAC channel1 Configuration */

  DAC_InitStructure.DAC_Trigger = DAC_Trigger_None;

  DAC_InitStructure.DAC_WaveGeneration = DAC_WaveGeneration_None;

  DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Enable; // Try with/without

  DAC_Init(DAC_Channel_1, &DAC_InitStructure);

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
frankmeyer9
Associate II
Posted on March 29, 2013 at 10:38

the output of DAC is input to an OPAPM amplifier

 

I mean it is not loaded

 

Are you sure ?

What is the input impedance of your opamp circuitry ?

Do you have the internal buffer amplifier enabled ? Without this buffer, you should not go below 1MOhm load impedance - check the datasheet.

With this buffer enabled, you loose 200mV at the rails in worst case.

Edit: should have been looking closer - the buffer is disabled.

But again, check the load impedance.