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

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

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.
RWang.9
RWang.9Best answer
Associate
June 16, 2023

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. 

16 replies

waclawek.jan
Super User
May 29, 2023

Well, just check if MODER is 0b11 for this bit, and PUPDR is 0b00 (i.e. there's no pulldown switched on).

Looking at the Nucleo-64 schematics, there should be no load on board. You might try to measure resistance of given pin against ground, with powered-down board.

Try measuring using some other method - a multimeter perhaps?

JW

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

Do you know where I can check the MODER and PUPDR for the pin PA4 in stm32 cube ide? Also, if there's a syntax that could set the MODER and PUPDR could you tell me?

When I measured the resistance of unpowered board through the PA4 pin to the ground, it showed a resistance of 9ohms but I don't know if that contributes to a capped output voltage.

waclawek.jan
Super User
May 30, 2023

> When I measured the resistance of unpowered board through the PA4 pin to the ground, it showed a resistance of 9ohms

That's certainly unexpected. If there's nothing connected to PA4 on board or externally, it may be also a damaged pin on the mcu.

JW

PS.

> Do you know where I can check the MODER and PUPDR for the pin PA4 in stm32 cube ide?

I don't use the CubeIDE, but there should be a window with peripheral registers somewhere. Maybe go through the CubeIDE manual. I am talking about GPIOA_MODER and GPIOA_PUPDR.

AScha.3
Super User
May 30, 2023

Really 9 ohm ?​

Then remove the resistor or buy new board.

​

Here is useless to talk about.

​

​

​

​

​

If you feel a post has answered your question, please click on " Best Answer ".
RWang.9
RWang.9AuthorBest answer
Associate
June 16, 2023

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.