cancel
Showing results for 
Search instead for 
Did you mean: 

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

RWang.9
Associate II

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.

16 REPLIES 16
RWang.9
Associate II

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
Associate II

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?

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

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.

> 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
Chief II

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 "Accept as Solution".
RWang.9
Associate II

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.