2023-05-29 07:30 AM
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.
Solved! Go to Solution.
2023-05-29 12:26 PM - edited 2023-11-20 04:26 AM
The DAC output is connected to the PA4 pin and is set to analog.
Do you have any recommended content on GPIOA registers?
2023-05-29 12:35 PM - edited 2023-11-20 04:26 AM
The DAC output is connected to the PA4 pin and the pin is in Analog mode. Do you have any recommended content about GPIOA registers for me to read about?
2023-05-29 01:03 PM
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
2023-05-30 08:04 AM
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.
2023-05-30 11:29 AM
> 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.
2023-05-30 11:59 AM
Really 9 ohm ?
Then remove the resistor or buy new board.
Here is useless to talk about.
2023-06-16 10:40 AM
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.