DAC on STM8L151 - output buffer - Page 1
Forum section: electronics / general

author: Saimoun
author_rank: Frequent Contributor
timestamp: October 27, 2020, 08:26:05 pm
content: HiI am using an STM8L151G6, and reading the datasheet it seems that for the the 28-pin or 32-pin packages ("STM8L151Gx" or "STM8L151Kx") it is not possible to use the DAC output buffer.Section 9.3.13 "12-bit DAC characteristics" (datasheet pages 105 & 106) shows the following: (attached)My questions:Did I understand it right, i.e. I am not allowed to enable the output buffer?What does "no load" mean? I somehow do need to send the DAC output somewhere and that will have a load.Can I for example drive a 5k load anyways, and just take into account the output impedance which will reduce the signal amplitude?And regarding the output impedance, should I then add the values from Table 51 (internal resistance between DAC output and PB4/5/6 pins) to the DAC output impedance of 8-10k?Thank you!SimonFYI:* Datasheet:https://www.st.com/resource/en/datasheet/stm8l151g6.pdf* Programming manual:https://www.st.com/resource/en/reference_manual/cd00218714-stm8l050j3-stm8l051f3-stm8l052c6-stm8l052r8-mcus-and-stm8l151l152-stm8l162-stm8al31-stm8al3l-lines-stmicroelectronics.pdf

author: mikerj
author_rank: Super Contributor
timestamp: October 28, 2020, 11:14:44 am
content: It's not 100% clear, but I'd say that you have to add the mux resistance (which is supply voltage dependant) to the DAC output impedance (unbuffered). Seems like you'll need to provide an external buffer for any kind of reasonable load.Trying to drive a 5k load with no buffer is going to give you about 1/3 of the full scale voltage, but it may also affect other DAC parameters such as linearity.

author: HB9EVI
author_rank: Frequent Contributor
timestamp: October 28, 2020, 11:32:11 am
content: how I understand the datasheet it is clear, that no buffer can be used on the chips with 28/32 pins, so the way is to use a voltage follower, depending on the needed accuracy one with a small Vos

author: Saimoun
author_rank: Frequent Contributor
timestamp: October 28, 2020, 02:08:24 pm
content: Ok thank you both for your repliesMy plan was to use an inverting 2nd order filter at the output, I am changing that to a non-inverting one (sallen-key type) to get a high-impedance input. I am discussing it here:https://www.eevblog.com/forum/beginners/audio-filter-non-inverting-sallen-key-with-bias-is-it-possible/Regarding the datasheet's "capacitive load" of max 50pF, what does this mean? I think I have read before that this limitation is only with buffer active (this datasheet does not say so though :/ ), is it because of the in-rush current?In my case if I want to (low-pass) filter the output I need to add a cap to GND of a few nanofarads at least. Will that be a problem?ThanksSimon

author: HB9EVI
author_rank: Frequent Contributor
timestamp: October 28, 2020, 02:18:33 pm
content: capacitive loading of such outputs is dangerous, since it can easily lead to unwanted oscillations due the limited phase margin.the way to lp filter is to use a resistor between output and capacitor to decouple

author: Saimoun
author_rank: Frequent Contributor
timestamp: October 28, 2020, 02:47:31 pm
content: Ok nice to know! But do you think it applies to the unbuffered output, since it has an output impedance already?Just to compare, this is from the STM32F446 datasheet:(the note (2) says "guaranteed by design")

author: HB9EVI
author_rank: Frequent Contributor
timestamp: October 28, 2020, 03:15:36 pm
content: likely not; if it's good practice is another question. looks for me like the DAC is internally a current output DAC with a load resistor to get a voltage output; a buffer amp is certainly not wrong, as it eliminiates further speculations about the electronic nature of the DAC

author: Saimoun
author_rank: Frequent Contributor
timestamp: October 28, 2020, 04:32:09 pm
content: I think the DAC is an R-2R ladder based on the attached picture (reference manual RM0031 page 128) - not sure if that tells a lot about capacitive loading or not.But in any case, if you are saying I should add an output resistor then I can simply add one in the filter, let's call it R1, and consider R1+Zout as my input resistor in my filter, correct?

author: HB9EVI
author_rank: Frequent Contributor
timestamp: October 28, 2020, 04:36:13 pm
content: makes sense... you can simple R-C low pass the output, question is how fast you want to have the voltage settled

author: Saimoun
author_rank: Frequent Contributor
timestamp: October 29, 2020, 03:16:06 pm
content: Ok thanks. I got 5 boards yesterday so I will start testing it all

author: Saimoun
author_rank: Frequent Contributor
timestamp: November 01, 2020, 06:38:34 pm
content: So today I made some measurements with the MCU:* I get a Zout (output impedance) of around 15k-16k - which is strange since according to the datasheet the maximum value should be 11.4k!!The way I measured it was by measuring the voltage drop when I put a resistor at the output. I tried a few different resistors (going from 1k to 100k) and the results were quite consistent.* By mistake, the internal output buffer was on - and it actually works perfectly fine... I got an output impedance of 700 ohms, which will work fine with my setup. But I guess I gotta trust the datasheet and turn it off (ON is the default setting though).