Skip to main content
Fabster
Associate
May 10, 2020 10:56 AM UTC
Question

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

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?

This topic has been closed for replies.

7 replies

TDK
May 10, 2020 12:55 PM UTC

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""."
Fabster
FabsterAuthor
Associate
May 10, 2020 1:14 PM UTC

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
May 10, 2020 1:23 PM UTC

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""."
Fabster
FabsterAuthor
Associate
May 10, 2020 3:25 PM UTC

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

waclawek.jan
Super User
May 10, 2020 9:15 PM UTC

... rather than writing some software?

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

JW

Fabster
FabsterAuthor
Associate
May 12, 2020 12:16 PM UTC

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.

waclawek.jan
Super User
May 12, 2020 4:20 PM UTC

That of course makes sense. :)

JW