cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7B0 ADC watchdog cannot stop interrupt

OGhis
Senior

Dear,

We using an ADC in our application at 1Msps
The ADC is always running in a circular DMA mode.
To start the buffering of the samples we use the Analog watchdog 1. 
So when the input signal goes outside the analog watchdog thresholds the function "HAL_ADC_LevelOutOfWindowCallback()" is called.
This works fine, but now in this callback we give a signal to other code that the buffering of the samples starts and we would disable the analog watchdog 1.
Stopping the analog watchdog 1 interrupts does not work for us and he keeps going into callback "HAL_ADC_LevelOutOfWindowCallback".

What are we doing wrong to stop the analog watchdog interrupt?
btw the ADC and DMA should never stop while disabling the analog watchdog

First method: (preferred for us, must be very fast)

 

 

  ADC_HandleTypeDef *pAdc = pHdlr->pHdlr_adc;

  LL_ADC_DisableIT_AWD1(pAdc->Instance);
  CLEAR_BIT(pAdc->State, HAL_ADC_STATE_AWD1);
  LL_ADC_ClearFlag_AWD1(pAdc->Instance);
  LL_ADC_DisableIT_AWD

 

 


second method:

 

 

  ADC_AnalogWDGConfTypeDef AnalogWDGConfig = {0};

  AnalogWDGConfig.WatchdogNumber = ADC_ANALOGWATCHDOG_1;
  AnalogWDGConfig.WatchdogMode = ADC_ANALOGWATCHDOG_SINGLE_REG;
  AnalogWDGConfig.Channel = ADC_CHANNEL_3;
  AnalogWDGConfig.ITMode = DISABLE;
  AnalogWDGConfig.HighThreshold = 65535;
  AnalogWDGConfig.LowThreshold = 0;
  if (HAL_ADC_AnalogWDGConfig(pAdc, &AnalogWDGConfig) != HAL_OK) { }

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
OGhis
Senior

Dear,

issue found, we had use an incorrect ADC input

View solution in original post

1 REPLY 1
OGhis
Senior

Dear,

issue found, we had use an incorrect ADC input