cancel
Showing results for 
Search instead for 
Did you mean: 

In STM32CubeMX version 6.0.0, STM32H753IITx, DAC1, NVIC settings there is the option 'Timebase: TIM6 global interrupt, DAC1CH1 and DAC1CH2 underrun error interrupts' that cannot be disabled. I am not using DMA for DAC. Bug?

DGrön.1
Associate II

What has TIM6 to do with this? I do use it for System Core, SYS, Timebase Source.

Why can I not disable the global underrrun interrupt?

I use DMA for ADC1 and 2 and BDMA for ADC3.

At startup HAL_DAC_IRQHandler gets called, DAC_FLAG_DMAUDR1 is set and hdac->State is assigned HAL_DAC_STATE_ERROR which in turn prohibits proper initialization in HAL_DAC_Init and HAL_DAC_SetValue will not work.

3 REPLIES 3
DGrön.1
Associate II

On further examination the global interrupt option is OK like it is.

The flag DAC_FLAG_DMAUDR1 is not set as I wrote but the code acts like it is.

void HAL_DAC_IRQHandler(DAC_HandleTypeDef *hdac)

{

 if (__HAL_DAC_GET_IT_SOURCE(hdac, DAC_IT_DMAUDR1))

 {

  /* Check underrun flag of DAC channel 1 */

  if (__HAL_DAC_GET_FLAG(hdac, DAC_FLAG_DMAUDR1))

  {

   /* Change DAC state to error state */

   hdac->State = HAL_DAC_STATE_ERROR;  

   // This line is reached before HAL_DAC_Init, 'if (hdac->State == HAL_DAC_STATE_RESET)' line 

   // even though DAC.CR == 0 and DAC.SR == 0.

Optimization error or bad macros?

TDK
Guru

> The flag DAC_FLAG_DMAUDR1 is not set

> if (__HAL_DAC_GET_FLAG(hdac, DAC_FLAG_DMAUDR1))

Not sure how the second statement evaluates to true if the first statement is correct.

> Optimization error or bad macros?

The macros are easy to inspect. Very possible there's a bug.

If you feel a post has answered your question, please click "Accept as Solution".

Hello @Dennis Gröning​ 

It will be internally checked, I'll give you an update as soon as possible.

Best Regards,

Nesrine