Retrieve position in buffer in ADC error callback function

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

Moderators: RoccoMarco, barthess

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

Retrieve position in buffer in ADC error callback function

Postby maxpav » Tue Mar 08, 2022 10:35 am

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: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: Retrieve position in buffer in ADC error callback function

Postby Giovanni » Tue Mar 08, 2022 12:36 pm

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


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 21 guests