Retrieve position in buffer in ADC error callback function

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

Moderator: RoccoMarco

Post Reply
maxpav
Posts: 3
Joined: Tue Oct 19, 2021 8:24 am
Has thanked: 1 time

Retrieve position in buffer in ADC error callback function

Post by maxpav »

Hello,

I am running an ADC in circular mode, and I am using the analog watchdog interrupt. Is it possible to retrieve the position of the last filled sample in the buffer from within the adcerrorcallback function (interrupt routine), when the voltage has fallen outside of the specified range? If yes - how?
My project runs on a NucleoF411Re board.

Thank you,
Maxim
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Retrieve position in buffer in ADC error callback function

Post by Giovanni »

Hi,

Look at examples, you need to verify the driver state, if the state is ADC_COMPLETE then the 2nd half of the buffer has been filled, else it is the 1st half.

Giovanni
Post Reply