STM32f100 DAC wrong Behavior
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2014-10-27 11:20 AM
Posted on October 27, 2014 at 19:20
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?
This discussion is locked. Please start a new topic to ask your question.
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2014-10-27 11:27 AM
Posted on October 27, 2014 at 19:27
Anyone knows why am I doing wrong?
Loading the pin too heavily?
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2014-10-28 7:37 AM
Posted on October 28, 2014 at 15:37
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2014-10-28 7:58 AM
Posted on October 28, 2014 at 15:58
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;
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2014-10-28 8:10 AM
Posted on October 28, 2014 at 16:10What does it mean?11.3.2 DAC output buffer enableThe DAC integrates two output buffers that can be used to reduce the output impedance,and to drive external loads directly without having to add an external operational amplifier.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2014-10-28 8:13 AM
Posted on October 28, 2014 at 16:13
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).
