cancel
Showing results for 
Search instead for 
Did you mean: 

ADC AWD INterrupt not triggering

puneethj
Associate II
Posted on September 19, 2015 at 19:25

Hi Every one, I am trying to establish AWD Interrupt when the voltage value exceedsADC_ITConfig(ADC1, ADC_IT_AWD, ENABLE); I dont know for what reason Is my interrupt not triggering, I try to turn on LED if the interrupt occurs but it is not, Kindly help me out.

ADC_Init(ADC1, &ADC_InitStructure);
ADC_RegularChannelConfig(ADC1, ADC_Channel_11, 1, ADC_SampleTime_480Cycles);
ADC_AnalogWatchdogSingleChannelConfig(ADC1, ADC_Channel_11);//PC1
ADC_AnalogWatchdogThresholdsConfig(ADC1, 100, 5);
ADC_ClearFlag(ADC1, ADC_FLAG_AWD);
ADC_AnalogWatchdogCmd(ADC1, ADC_AnalogWatchdog_SingleInjecEnable);
ADC_ITConfig(ADC1, ADC_IT_AWD, ENABLE);
// ADC IS working fine, I can read values exceeding this threshold.
// Interrupt
NVIC_InitTypeDef NVIC_InitStructure;
NVIC_InitStructure.NVIC_IRQChannel = ADC_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 7;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
// Interrupt Handler
void ADC_IRQHandler(void)
{
STM_EVAL_LEDOn(LED3);
if (ADC_GetITStatus(ADC1, ADC_IT_AWD))
{
ADC_ClearITPendingBit(ADC1, ADC_IT_AWD);
// ADC_ITConfig(adc, ADC_IT_AWD, DISABLE);
STM_EVAL_LEDOn(LED4);
}
}

2 REPLIES 2
raptorhal2
Lead
Posted on September 19, 2015 at 22:06

The analog channel is configured as regular, but the watchdog command is injected.

Cheers, Hal

puneethj
Associate II
Posted on September 20, 2015 at 01:19

Perfect Perfect Perfect 🙂 Thanks thanks thanks