I'm testing the ADC channels on this MCU, and being thorough. Sampling all 16 channels about 50x per second, everything is giving the expected results, except AN14.
AN14 is internally connected to IVref, which is an internal 1.2V precision voltage reference. However, with a sample and hold (S/H) time of 250ns, I'm only measuring IVref as 0.687V. Boosting the S/H time to 750ns, I get closer to the expected result.
According to the main datasheet, S/H of 200ns is sufficient for a signal impedance of up to 5.0K. I've checked all related datasheets and can't find IVref's impedance listed, nor do I know what might be a typical impedance. But I suspect it must be rather high. And if the ADC's S/H capacitor is capable of momentarily pulling down the IVref voltage, then one should never sample it at all; else it may cause false triggering of other things using it (comparators, CTMU).
Does this seem like a valid assessment? Or is there another explanation? Code follows, in case I've made some error.
void DAQ_Scan() {
UNATIVE i1;
AD1CON1 = 0;
AD1CON1bits.SSRC = 0b111; // internal counter ends sampling and starts conversion (auto convert)
AD1CON1bits.CLRASAM = 1; // stop conversions when interrupt occurs
AD1CON2 = 0;
AD1CON2bits.CSCNA = 1; // scan inputs
AD1CON3 = 0;
AD1CON3bits.ADCS = 1; // Tad=4*Tpb, pb=48Mhz, Tpb=20.833ns, so Tad=83.333ns
AD1CON3bits.SAMC = 3; // S&H=3*Tad, so 250ns
AD1CHS = 0;
AD1CON1bits.ON = 1; // turn ADC module on
AD1CON2bits.SMPI = 15; // interrupt after 16 samples
AD1CSSL = 0xFFFF; // scan 16 channels
IFS0bits.AD1IF = 0; // clear interrupt
AD1CON1bits.ASAM = 1; // start sampling
while (!IFS0bits.AD1IF) {}; // wait for sample complete
UI32* ptr = (UI32*)&ADC1BUF0;
for (i1=0; i1<16; i1++) {
AdcResults[i1] = *ptr;
ptr+=4;
};
}