Author Topic: DAC on STM8L151 - output buffer  (Read 1311 times)

0 Members and 1 Guest are viewing this topic.

Offline SaimounTopic starter

  • Frequent Contributor
  • **
  • Posts: 564
  • Country: dk
DAC on STM8L151 - output buffer
« on: October 27, 2020, 08:26:05 pm »
Hi :)

I 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!

Simon

FYI:
* 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
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3292
  • Country: gb
Re: DAC on STM8L151 - output buffer
« Reply #1 on: October 28, 2020, 11:14:44 am »
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.
 

Offline HB9EVI

  • Frequent Contributor
  • **
  • Posts: 722
  • Country: ch
Re: DAC on STM8L151 - output buffer
« Reply #2 on: October 28, 2020, 11:32:11 am »
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
 

Offline SaimounTopic starter

  • Frequent Contributor
  • **
  • Posts: 564
  • Country: dk
Re: DAC on STM8L151 - output buffer
« Reply #3 on: October 28, 2020, 02:08:24 pm »
Ok thank you both for your replies   :)

My 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?

Thanks
Simon
 

Offline HB9EVI

  • Frequent Contributor
  • **
  • Posts: 722
  • Country: ch
Re: DAC on STM8L151 - output buffer
« Reply #4 on: October 28, 2020, 02:18:33 pm »
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
 

Offline SaimounTopic starter

  • Frequent Contributor
  • **
  • Posts: 564
  • Country: dk
Re: DAC on STM8L151 - output buffer
« Reply #5 on: October 28, 2020, 02:47:31 pm »
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")
« Last Edit: October 28, 2020, 02:56:41 pm by simonlasnier »
 

Offline HB9EVI

  • Frequent Contributor
  • **
  • Posts: 722
  • Country: ch
Re: DAC on STM8L151 - output buffer
« Reply #6 on: October 28, 2020, 03:15:36 pm »
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
 

Offline SaimounTopic starter

  • Frequent Contributor
  • **
  • Posts: 564
  • Country: dk
Re: DAC on STM8L151 - output buffer
« Reply #7 on: October 28, 2020, 04:32:09 pm »
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?
 

Offline HB9EVI

  • Frequent Contributor
  • **
  • Posts: 722
  • Country: ch
Re: DAC on STM8L151 - output buffer
« Reply #8 on: October 28, 2020, 04:36:13 pm »
makes sense... you can simple R-C low pass the output, question is how fast you want to have the voltage settled
 

Offline SaimounTopic starter

  • Frequent Contributor
  • **
  • Posts: 564
  • Country: dk
Re: DAC on STM8L151 - output buffer
« Reply #9 on: October 29, 2020, 03:16:06 pm »
Ok thanks. I got 5 boards yesterday so I will start testing it all :)
 

Offline SaimounTopic starter

  • Frequent Contributor
  • **
  • Posts: 564
  • Country: dk
Re: DAC on STM8L151 - output buffer
« Reply #10 on: November 01, 2020, 06:38:34 pm »
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!!  :palm: 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  ::) ).
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf