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

Race condition in starting the ADC following calibration

Race condition in starting the ADC following calibration. I am trying to start the ADC in the interrupt routine when the end calibration is reported, however I have unreliable results when converting several channels with a buffer. I see the first channel converted and then I see it is converted a second time followed by the remaining channels that are placed in the buffer and in the first location of the second buffer. On next conversion sample, two samples are placed in what is now the first buffer and the final sample is placed in the second buffer.

As a workaround I calibrate separately and sometime later start the conversion.

Parents Reply Children
  • I have multiple channels working in SCAN mode, that is not my problem, rather I wanted to make a different differential measurement on each channel in the scan (see code), and this appears not to work. Instead it appears each channel works as single ended measurement and PSELN is not used in SCAN mode.

    I have workaround by using single ended for AIN2, AIN4 and sampling AIN1 and then subtracting.

Related