Skip to main content
sunphoenixt
Associate II
March 23, 2018
Question

Strange output of DAC when Buffer_Off and use external OpAmp

  • March 23, 2018
  • 4 replies
  • 6656 views
Posted on March 23, 2018 at 11:10

Hi,

Question: Does DAC buffer enable or disable when use external OpAmp?

Reason

: I want generate high frequency sine wave use DAC,range from 100~100Khz,0.1Vrms~1Vrms.

when generate 100Khz, I want a smoth sine wave,so i set Timer2_trigger speed is 4.5MHz, sample point is 45.

That is the maximum sampling rate of DAC when use STM32F3 which is specified in AN4566(Page8).

0690X0000060ADdQAM.png

And also as ST's ''AN4566-Extending the DAC performance of STM32 microcontrollers'' write,

it's better use external OpAmp to buffer the DAC output due to internal buffer limitation(Page5).

0690X0000060ADFQA2.png

So I buy some LMH6645 accordding the AN4566(Page9),and build an test pcb just as it(Page14).

0690X0000060ADiQAM.png

Here is the output when not use external buffer:(Yellow is DAC output)

0690X00000602VjQAI.bmp

But When I turn off DAC buffer,the external buffer output is not sine,but it's square wave.

(Yellow is DAC output,Blue is external opamp output).

0690X00000604VCQAY.jpg

While if I turn on DAC buffer, the external buffer output is well follow input,

(Yellow is DAC output,Blue is external opamp output).

0690X00000604VHQAY.jpg

but as we use external opamp for high frequency,

so it's should not turn on DAC buffer,otherwise why we use external buffer?

And I test other even better opamp,such as LMH6646,LMH6642,OPA2354,it's the same problem.

So what shoul i do if i want use external opamp to generate high frequency sine wave?

and what's the  reason about strange output of external OpAmp when disable DAC buffer?

-----------------------------------

Hardware

: STM32F3-Discovery,which use STM32F303VC,it's DAC1 has internal buffer,which can be turn off.

Software: Example(DAC_SignalsGenerations ) in ''STM32F3-Discovery_FW_V1.1.0'',

This example provides a short description of how to use the DAC peripheral to

generate several signals using DMA controller.

DMA2 channel3 is configured to transfer continuously, a unit16_t Array[450] buffer to the DAC register DAC_DHR12R1.

DAC channels conversions are configured to be triggered by TIM2 TRGO triggers and

without noise/triangle wave generation.

-------------------------------------

Attatch is the sine wave(0.6Vrms,1Khz) test.

Thanks,and looking forward anybody's reply and discussion.

    This topic has been closed for replies.

    4 replies

    sunphoenixt
    Associate II
    March 23, 2018
    Posted on March 23, 2018 at 14:16

    Hi,

    The question below was solved by myself because I found out the ''stm32f30x_stand_peripheral_library'' of my project are not update,and there are some error in DAC driver,which it is turn off dac buffer in fact when you config the dac to ''DAC_BufferSwitch_Enable'' in software.

    So it's apparently should turn off the dac buffer when use external opamp. and it does improve dac output performance.

    here is the dac output 100KHz when Timer2-trigger set to 4.5Mhz and not use internal buffer:(Ingnore note on osc,beacuase error in stm32-library),set to 1Vrms output,but only 711mV actually output.

    0690X00000604A0QAI.jpg

    here is use internal buffer:(Ingnore note on osc,beacuase error in stm32-library),set 1Vrms output,actual is about1V.

    but it's apparently large distortion of output.

    And , even you increase set value above 1V,it's doesn't change in output,because internal amp is not rail-to-rail.

    0690X00000604VMQAY.jpg

    Next is disable internal buffer and use external opamp:
    henry.dick
    Associate II
    March 23, 2018
    Posted on March 23, 2018 at 14:44

    that opamp drawing is probably incorrect: its inputs should have been swapped.

    sunphoenixt
    Associate II
    March 24, 2018
    Posted on March 24, 2018 at 07:34

    Actually it's correct, the positive +IN set to Vdd/2 which provide negative input -IN range between 0~Vdd and -IN 's offset is Vdd/2, so the output just inverse of -IN and range still is 0~Vdd if you use rail-to-rail opamp.

    Offcourse,you can use positive input as an amplifier or as a voltage follower. but here i just use it as a dac buffer which replace internal buffer because the internal buffer's limited performance.

    -------------------------------------------

    Next two picture show differences DAC output when not use buffer and use an external buffer.

    Not use buffer:(Yellow one is dac output,set to 0.6Vrms, but actual output is just about 200mV,)

    0690X00000604VlQAI.jpg

    Use external buffer:(Blue one is external buffer output,it's same as set voltage).

    0690X00000604VWQAY.jpg

    Sorry for no internal buffer test picture....

    henry.dick
    Associate II
    March 25, 2018
    Posted on March 25, 2018 at 01:33

    '

    so the output just inverse of -IN'

    the circuit is an inverting amplifier, with the gain defined by R1//C1 over the DAC's output impedance (itself undefined). For a perfect voltage source, the gain is infinity -> clipping output.

    If that circuit comes from a ST appnote, ST should have it corrected.

    T J
    Senior III
    March 24, 2018
    Posted on March 24, 2018 at 21:40

    I also think the amplifier circuit is not correct.

    there should be a resistor between the opamp's -ve input and the processor pin. call it R4

    it is the Gain resistor.   Gain is something like (R1+R4)/R4 

    without R4 the unit will rail.. giving a square wave.

    sunphoenixt
    Associate II
    March 26, 2018
    Posted on March 26, 2018 at 09:52

    After think about your reply,i figure out why it's square wave when enable internal buffer and use external opamp at same time.

    it's because like what you said,there are no output resistor which leed to infinity output.

    but the circuit is correct which i find it in ST's application note, and have actual test to prove it's right.

    ----------------------------

    The following is the simulation of use internal buffer and external opamp at same time :

    0690X0000060A9cQAE.png

    here is simulation result:

    0690X00000609HlQAI.png

    Detail at 0~0.2ms:

    0690X0000060A9hQAE.png

    Detail at 2.5ms:

    0690X00000609qvQAA.png

    -----------------------------------------------

    When I add a resistor between DAC out and external opamp,which circuit like the following picture:

    0690X0000060AF5QAM.png

    Then the simulaiton result is right:

    0690X0000060AGDQA2.png

    Detail at 2.5ms:

    0690X0000060AFyQAM.png
    sunphoenixt
    Associate II
    March 26, 2018
    Posted on March 26, 2018 at 10:13

    Attention: the DAC's bug still in standard library,it's in file '' stm32f30x_dac.h''

    0690X0000060AG4QAM.png

    you should change it according RM0316's page428 if you still use stdperiph-lib:

    0690X0000060AG3QAM.png

    Refer info:

    0690X0000060AGwQAM.png

    0690X0000060AG8QAM.png

    AS the STSW-STM32108-''stm32f30x_dsp_stdperiph_lib_V1.2.3.zip'' is suspended and ST use STM32Cube's HAL for further developing.