2024-11-11 12:15 AM - edited 2024-11-11 12:24 AM
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) { }
Solved! Go to Solution.
2024-11-11 01:52 AM
Dear,
issue found, we had use an incorrect ADC input
2024-11-11 01:52 AM
Dear,
issue found, we had use an incorrect ADC input