How to stop ADC from interrupt?

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
User avatar
kreyl
Posts: 59
Joined: Sun Jan 13, 2013 11:46 pm
Been thanked: 4 times

How to stop ADC from interrupt?

Post 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!
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: How to stop ADC from interrupt?

Post 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
Post Reply