Skip to main content
VMuni.1
Associate
February 22, 2021
Question

STM32F302R8 - Not giving DAC output.

  • February 22, 2021
  • 1 reply
  • 534 views

I am using the STM32F302R8 for motor control application. Need to do pulse-by-pulse current limiting.

I have a BLDC drive board that has a comparator that can be used to give shutdown signal to the PWM. For this purpose, I need to give the comparator a reference signal from DAC of microcontroller.

Using STMCubeIDE to configure the peripherals.

DAC Mode - OUT1 Configuration

Parameter Settings - Output Buffer Enabled

Trigger - Software Trigger

Wave Generation - Disabled

Then, I use

HAL_DAC_Start(&hdac, DAC_CHANNEL_1);

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

in the main() to start and set the values of the DAC. But the output is showing 0V instead of 3.3V.

I have set the DAC value to 4096 to check output only. I know that I can use the internal reference voltage from microcontroller for Vref, 3/4 Vref, 1/2 Vref etc..

I need a very specific voltage reference for the comparator, I cannot use standard values.

If any has found a solution to the DAC output problem, I'd be grateful for the help.

Thanks =)

This topic has been closed for replies.

1 reply

Vangelis Fortounas
Associate II
February 22, 2021

Hello

fill first the data register and then , start the conversion

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

HAL_DAC_Start(&hdac, DAC_CHANNEL_1);