cancel
Showing results for 
Search instead for 
Did you mean: 

How to determine the channel which has triggered HAL_ADC_LevelOutOfWindowCallback on adc?

Fabster
Associate II

Hello everyone

I am using an STM32F103RB. I would like to do some sound triangulation stuff. Therefore i have 3 microphones which are all connected to ADC1. I installed a watchdog. Everything works fine, and the callback is triggered for all 3 channels. Now i am not sure, how to determine, on which channel, the voltage was out of threshold.

Can anyone help me?

7 REPLIES 7
TDK
Guru

You have to read all the values and see which is out of range. If you enable the out of window interrupt, it should be the last value, or maybe one of the last few depending on your sample rate.

If you feel a post has answered your question, please click "Accept as Solution".

Hey TDK

Thanks for your answer. Isn't there any bit which indicates the last converted rank or anything else? It seems to be weird to read again the values in the interrupt...​

TDK
Guru

I don't see anything like that. Take a look yourself.

If you're transferring to a circular DMA buffer, NDTR could help you figure out that info.

If you feel a post has answered your question, please click "Accept as Solution".

Well, then I see no other option than buying another nucleo containing 3 adc (i.e a STM32F4)...

... rather than writing some software?

Weird... but your mileage obviously differs...

JW

Okay, what I wanted to say was: In order to still achieve a good resolution of the trilateration, it is probably necessary to go this way, because the time needed to detect the sound levels is already at its limit and will of course grow with more software. Therefore i see no other option for me.

That of course makes sense. 🙂

JW