This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

ADC input selection change time

I am using internal ADC to sample 2 (sometimes 3) channels on about 333Hz frequency. What I do is:

  • set channel 1 as input (always two-thirds prescaling, VBG reference)

  • start 3ms repeated timer

  • when timer triggers, sampling at chan1 starts and app goes to sleep

  • wakeup when adc finishes - check one more time if it really is not busy - store result

  • change ADC input to channel 2 and start sampling - then go to sleep

  • wait for wakeup again, check if not busy, store result - change input to chan 1 - go to sleep

  • wait for another 3ms timer trigger...

My problem is that sometimes (very rarely, but regularly!) my readings seems to be connected, ex. Chan1 should read value about 0, Chan2 should read value about 1000. In most cases it is ok, but sometimes chan1 reads value about 1000 (just like CONFIG.INPSEL mux react too slowly). It is possible that my code is buggy, but I am wondering if it is possible that ADC reacts REALLY slowly for its input changes when sampling really fast.

Related