cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F334C8 PA4(DAC_1_OUT_1) buffer issue

Mutlu.Mert
Associate III
Posted on October 30, 2016 at 09:09

I'm using the 32F334C8 Pa4 dac1_out1 channel.However, buffer is not working. Here is my code, 

void DAC_Config(void)

{

  DAC_InitTypeDef  DAC_InitStructure;

  

  /* Configure DAC1 OUT1 ******************************************************/ 

  /* GPIO Periph clock enable */

  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);

  

  /* Configure PA4 (DAC1_OUT1) as analog */

  GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_4;

  GPIO_InitStructure.GPIO_Mode =   GPIO_Mode_AF;

  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;

  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;

  GPIO_Init(GPIOA, &GPIO_InitStructure);

  /* DAC1 Periph clock enable */

  RCC_APB1PeriphClockCmd(RCC_APB1Periph_DAC1, ENABLE);

  

  /* DAC1 deinitialize */

  DAC_DeInit(DAC1);

  

  /* Fill DAC InitStructure */

  DAC_InitStructure.DAC_Trigger = DAC_Trigger_None;

  DAC_InitStructure.DAC_Buffer_Switch = DAC_BufferSwitch_Disable  ; // DAC_BufferSwitch_Enable;

  DAC_InitStructure.DAC_WaveGeneration = DAC_WaveGeneration_None;

  DAC_InitStructure.DAC_LFSRUnmask_TriangleAmplitude = DAC_LFSRUnmask_Bit0;

  /* DAC Channel1 Init */

  DAC_Init(DAC1, DAC_Channel_1, &DAC_InitStructure);

// DAC_Init(DAC2, DAC_Channel_1, &DAC_InitStructure);

  /* Enable DAC Channel1 */

  DAC_Cmd(DAC1, DAC_Channel_1, ENABLE);

  

  /* Set DAC Channel1 DHR register: DAC1_OUT */

 // DAC_SetChannel1Data(DAC1, DAC_Align_12b_R, (uint16_t)CurrentSenseTab[0]);  

}

I think i can't open the buffer because i always see voltage at PA4 out pin. In programming manual i found that:

The DAC1 channel 1 comes with an output buffer that can be used to reduce the outputimpedance on DAC1_OUT1 output, and to drive external loads directly without having toadd an external operational amplifier.

I hope i'll solve that problem. Thanks

#stm32f334
1 REPLY 1
Posted on October 30, 2016 at 11:24

>

  GPIO_InitStructure.GPIO_Mode =   GPIO_Mode_AF;

Not AF, analog.

JW