Showing results for 
Search instead for 
Did you mean: 

DAC output in STM32L151RCT6 MCU is not constant.

Associate III


I am using STM32L151RCT6 MCU and creating the project in STM32cube IDE .

i implemented DAC peripheral and kept 1.52 As input and did calculation like:

float value = 1.52; // Dac output

uint32_t var;

 var = (value * 4096)/3.3 ; // From datasheet

 HAL_DAC_SetValue(&hdac, DAC_CHANNEL_1, DAC_ALIGN_12B_R, var);

i am getting output voltage as 1.55V to 1.56V ..

here my requirement is 1.55V but i am getting output varying from 1.55V to 1.56V...why that variation in output of DAC?

How can i make it constant ??

or it will like that or what??

Please help me to clear this


What hardware are you using? How is DAC loaded? Are there ADC conversions running? Our any other code influencing the analog part of the mcu, or introducing significant supply/ground current? Isn't it the measurement which is imprecise/noisy?

DAC stability among other things depends on VREF+ stability.


And - 10mV of a 1500mV signal is about 0.5%.

About what measurement device tolerance we are speaking here ?


I am using NUCLEO- L152RE - Evaluation board..

used DAC 1 out:

i am not using any ADC..

just DAC1 out pin probing and checking the waveform along with output voltage.

this is configuration image


What is the tolerance of the device you are measuring the signal with ?

Your expectations sound unrealistic to me.

The DAC output is high-impedance (1 Mohm/15kOhm), the measurement device must have an appropriately high input inpedance.