Skip to main content
Visitor II
May 10, 2020
Question

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

  • May 10, 2020
  • 4 replies
  • 1459 views

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.

    4 replies

    Super User
    May 10, 2020

    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.

    FabsterAuthor
    Visitor II
    May 10, 2020

    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...​

    Super User
    May 10, 2020

    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.

    FabsterAuthor
    Visitor II
    May 10, 2020

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

    Super User
    May 10, 2020

    ... rather than writing some software?

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

    JW

    FabsterAuthor
    Visitor II
    May 12, 2020

    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.

    Super User
    May 12, 2020

    That of course makes sense. :)

    JW