Skip to main content
RWang.9
Associate
May 29, 2023
Solved

Why won't my DAC output a voltage larger than 2.56v?

  • May 29, 2023
  • 14 replies
  • 5852 views

Hi there,

I've been having difficulty trying to make the DAC channel 1 output 3.3v. The largest voltage that the DAC outputs is 2.56 volts which I measured with an oscilloscope. I try to set the output voltage to be higher with the following code snippet but the DAC doesn't output anything higher than 2.56 volts.

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

I am using the stm32cube ide and there isn't many much I can configure for the DAC. I don't know if this is a configuration issue or a hardware issue.

This topic has been closed for replies.
Best answer by RWang.9

Hi guys, I've solved the problem.

The issue was with the oscilloscope probe used to measure the DAC voltage. When I switched to using another probe, the oscilloscope measured the max voltage of the DAC to be 3.3V. 

14 replies

RWang.9
RWang.9Author
Associate
May 29, 2023

Do you know where I can find the DAC's internal reference voltage? I can't seem to find its reference voltage from the electrical schematics. Could it perhaps be in the configuration setting?

AScha.3
Super User
May 29, 2023


_legacyfs_online_stmicro_images_0693W00000bl3srQAA.png

"If you feel a post has answered your question, please click ""Accept as Solution""."
RWang.9
RWang.9Author
Associate
May 29, 2023

After looking at the schematics again I find VDDA and VREF+ are both connected to a 3.3V source. So why is the max output voltage for the DAC stuck at 2.56V?


_legacyfs_online_stmicro_images_0693W00000bl3v7QAA.png
_legacyfs_online_stmicro_images_0693W00000bl3uxQAA.png 

Does it have something to do with pin PB1?


_legacyfs_online_stmicro_images_0693W00000bl3vRQAQ.png

AScha.3
Super User
May 29, 2023

it would be less guesswork, if you give the cpu type...

"If you feel a post has answered your question, please click ""Accept as Solution""."
RWang.9
RWang.9Author
Associate
May 29, 2023

I'm using the stm32 Nucleo-F302R8 MCU.

AScha.3
Super User
May 29, 2023

is any load on dac output? and try with buffer on/off .

what you get with 2048 as data ?

"If you feel a post has answered your question, please click ""Accept as Solution""."
RWang.9
RWang.9Author
Associate
May 29, 2023

I don't have any load attached to the output. Turning the buffer off makes the DAC output very small voltages in the 100-200mv range.

When the data is set as 2048, I get an output of 1.8320 V. At 4096, the output is 2.61V.

Do these numbers seem reasonable?

RWang.9
RWang.9Author
Associate
May 29, 2023

*4095 actually not 4096

waclawek.jan
Super User
May 29, 2023

> Turning the buffer off makes the DAC output very small voltages in the 100-200mv range.

That sounds much like you do have a load on the given pin.

Which pin is it, btw? Is it set to Analog (read out and check/post content of GPIOA registers).

JW

RWang.9
RWang.9Author
Associate
May 29, 2023

The DAC output is connected to the PA4 pin and is set to analog.


_legacyfs_online_stmicro_images_0693W00000bl4L0QAI.pngDo you have any recommended content on GPIOA registers?

RWang.9
RWang.9Author
Associate
May 29, 2023

The DAC output is connected to the PA4 pin and the pin is in Analog mode.
_legacyfs_online_stmicro_images_0693W00000bl4MXQAY.pngDo you have any recommended content about GPIOA registers for me to read about?