HAL DAC output problem
Hello all,
I need to use DAC on STM32F091 MCU. I have configured it in cubemx - Channel1 - output PIN PA4, output buffer enabled, no trigger.,
in Main.c is next:
static char dac_tmp=200;
set_DAC_output(dac_tmp);
if (HAL_DAC_Start (&hdac, DAC_CHANNEL_1 ) != HAL_OK)
{
HAL_Delay(1000);//TODO ADC CALL ERROR HANDLING
}
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
set_DAC_output(dac_tmp);
}
void set_DAC_output(char DAC_VAL)
{
if (HAL_DAC_SetValue (&hadc, DAC_CHANNEL_1, DAC_ALIGN_8B_R, DAC_VAL) != HAL_OK)
{
HAL_Delay(1000); // TODO ADC CALL ERROR HANDLING
}
}
This is execution code regarding DAC. Currently it is only to check, if it is work good. But on the PA4 pin is no relevant voltage.
Until DAC start function has PA4 pin output voltage 0.00V, after DAC start has 0.06 V appeared. But this value has not been changed after writting anything with HAL_DAC_SetValue function. The same results on two boards.
DAC looks that is pretty simple to use, but not.
PS: on the same boad I use ADC too with no problem (that shares the same reference voltage).
I thank you for any idea.
I use CUBEIDE 1.3.1 with newest HAL library.