2013-03-28 01:34 PM
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 routinevoid
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
2013-03-28 02:04 PM
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);2013-03-29 02:38 AM
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.