Page 1 of 1

Exit Analog Watchdog Interrupt

Posted: Sun Mar 06, 2022 1:49 pm
by maxpav
Hello,

My question is a newbie question, but I don't know where to look for an answer anymore.
I want to use the analog watchdog of the ADC on my NucleoF411RE board. I set the desired values in HTR and LTR, and enabled the watchdog to generate interupts for regular channels by setting CR1 to ADC_CR1_AWDIE | ADC_CR1_AWDEN in the ADCConversionGroup.
When the voltage drops below LTR, the interrupt indeed gets caught (in the adcerrorcallback function), but then it never returns to normal program execution! What I understand from the STM32F411RE RM (p. 228) I need to reset the AWD bit of the ADC_SR register back to 0 manually (in my adcerrorcallback function, using the ADC_SR_AWD bit definition, right?), but how do I access the ADC_SR register in ChibiOS?

Best,
Maxim

Re: Exit Analog Watchdog Interrupt

Posted: Sun Mar 06, 2022 5:13 pm
by Giovanni
Hi,

The SR register is cleared by the driver itself, there is no need to clear it from the callback.

Is the program continuously re-triggering the callback? it is possible if the conversion is continuous and the voltage stays out of limits. Try to break the program after exiting the callback and see if/where it is stuck somewhere.

Giovanni