STM32L4 -Analog WatchDog with Interrupt in HAL library
- September 14, 2018
- 4 replies
- 1663 views
I am using STM32L432 with HAL library. I am programming ADC1 Channel 16 (i.e. PB1) as analog input signal. I have initialized ADC as Analog WatchDog-1 with Interrupt and without DMA, so that I dont have to continuously monitor my input voltage, if my input voltage goes out of certain threshold values, my AWD1 interrupt flag is set. Please find my initialization attached below.
Now my problem is as soon as I start my ADC using "HAL_ADC_Start_IT(&adcHandle);"(WHICH DOCUMENTATION SAY "ADC Conversion by Interruption"), my EOC-End of conversion flag,ESMP-End of Sampling Flag is also set (almost immediately--I am not concerned about this flags) and My ISR is executed. And Never leaves ISR (As at the start of ISR I stop my conversion in ADC channel and before returning to main program, I again start my ADC conversion using HAL_ADC_Start_IT(&adcHandle)) otherwise my analog watchdog does not take new value
How can I make my ADC to execute ISR only when AWD1 Interrupt Flag is set? (I guess this is bug in HAL library or I am missing something)
Please find screenshot of my debugger window after executing HAL_ADC_START_IT (DR is within limits)
Any Help will be highly appreciated