I am using the STM32F3 Discovery development board which has an STM32F303VCT6 MCU. I am also using the STM32CubeIDE.
I am trying to set up the DAC to perform one-off digital to analog conversions when I update the DAC output register, however, I have been unable to get anything other than 0 V out of the output pin.
According to the datasheet, the channel 1 DAC output pin is PA4. From my (obviously incorrect) understanding, the only register edits that I had to perform to get the DAC up and running were:
Change the PA4 mode to "Analog": GPIOA -> MODER |= 0x00000300;
Enable the channel 1 DAC: DAC -> CR |= DAC_CR_EN1;
and write the output voltage: DAC -> DHR12R1 = 3000;
(3.3V * 3000/4096 = 2.42V output)
All of these are within the main()
function. I use the STM32CubeIDE device configuration tool to initialize the clocks. However, when I run the program on the MCU, I don't measure any voltage on pin PA4. What else needs to be configured to get an output voltage?