Page 1 of 1

How to stop ADC from interrupt?

Posted: Fri Apr 26, 2013 5:47 pm
by kreyl
stm32f205ve, Chibios v.2.5.1

I want to measure battery once per second. To save power, I want to start ADC, wait for conversion end, and then stop ADC.
Currently all works ok, but I want to stop ADC in End Conversion callback function; and, since it is called from interrupt, I have SV#4 and SV#5 when calling adcStop.
What can I do?
Thank you!

Re: How to stop ADC from interrupt?

Posted: Fri Apr 26, 2013 5:54 pm
by Giovanni
Hi,

You could do the following (without any callback):

adcStart()
adcConvert()
adcStop()

You need to do this from thread context, it is not possible to stop a device driver from an ISR.

Giovanni