2020-11-04 05:41 AM
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.
2020-11-04 07:09 AM
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?
2020-11-04 06:22 PM
> 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.
2020-11-05 01:20 AM
Hello @Dennis Gröning
It will be internally checked, I'll give you an update as soon as possible.
Best Regards,
Nesrine