2014-10-27 11:20 AM
Hi guys,
I´m having some difficulties getting the DAC working properly with the STM32F100 LQFP48pins.First of all, Reference Manual says the followingOn 64-pin packages and packages with less pinsThe VREF+ and VREF- pins are not available, they are internally connected to the ADCvoltage supply (VDDA) and ground (VSSA).I´ve in my PCB VDDA connected to 3,3v.11.3.5 DAC output voltageDigital inputs are converted to output voltages on a linear conversion between 0 and VREF+.The analog output voltages on each DAC channel pin are determined by the followingequation:DACoutput=VREF*DOR/4095Mi code is the following; GPIO_InitStruct.GPIO_Pin = GPIO_Pin_4; //GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AIN; GPIO_Init(GPIOA_BASE, &GPIO_InitStruct); // DAC channel1 Configuration DAC_StructInit(&DAC_InitStruct); DAC_InitStruct.DAC_Trigger = DAC_Trigger_None; DAC_InitStruct.DAC_WaveGeneration = DAC_WaveGeneration_None; DAC_InitStruct.DAC_OutputBuffer = DAC_OutputBuffer_Disable; DAC_Init(xDACTable[DAC1].eDAC_Channel, &DAC_InitStruct);DAC_Cmd(DAC_Channel_1, ENABLE);DAC_SetChannel1Data(DAC_Align_12b_R, 0x0FFF);DAC_SoftwareTriggerCmd(DAC_Channel_1, ENABLE);Loading in DAC DOR register the Value =4095 I only get 2,5v instead of 3,3v Anyone knows why am I doing wrong?2014-10-27 11:27 AM
Anyone knows why am I doing wrong?
Loading the pin too heavily?2014-10-28 07:37 AM
If I Remove R112 and I get the measurement of DAC output I get the desired 3,3v.If I relocate R112 and removing R113 then i get 3,3v. Then If I relocate R113 again I get 2,5v. Is correct the definition of GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AIN; for a DAC Output??
2014-10-28 07:58 AM
Is correct the definition of GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AIN; for a DAC Output??
Yes, it disables all the digital logic on the pin including the schmitt trigger input. Might consider DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Enable;2014-10-28 08:10 AM
2014-10-28 08:13 AM
Might consider
DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Enable;
Correct. I'm repeating myself here, but sometimes when writing software, one needs to take the corresponding hardware into consideration.Take a look at the datasheet. The load resistance presented to the DAC output in your circuit is almost two orders of magnitude too small for unbuffered mode (1MOhm vs. 32kOhm, ignoring opamp input and C leakage).