This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C1292NCPDT: Variation in ADC conversion results

Part Number: TM4C1292NCPDT
Other Parts Discussed in Thread: EK-TM4C1294XL

Hi,

I have a question about the variability in ADC acquisition data.
Two ADC pins are used, with the high priority pin set to AIN11 and the low priority pin set to AIN10.
Please refer to the following for ADC initialization code and interrupt processing.

#define ADC_SEQUENCERS0 0
#define ADC_SEQUENCERS1 1
#define ADC_SEQUENCERS2 2
#define ADC_SEQUENCERS3 3

#define ADC_PRIORITY0   0
#define ADC_PRIORITY1   1
#define ADC_PRIORITY2   2
#define ADC_PRIORITY3   3

#define SAMPLE_RATE  25000000u

void ADC_init(void)
{

     SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);

     ADCReferenceSet(ADC0_BASE, ADC_REF_INT);

     ADCSequenceConfigure(ADC0_BASE, ADC_SEQUENCERS0, ADC_TRIGGER_TIMER, ADC_PRIORITY0);
     ADCSequenceStepConfigure(ADC0_BASE, ADC_SEQUENCERS0, 0, ADC_CTL_CH11 | ADC_CTL_IE | ADC_CTL_END);

     ADCSequenceConfigure(ADC0_BASE, ADC_SEQUENCERS1, ADC_TRIGGER_TIMER, ADC_PRIORITY1);
     ADCSequenceStepConfigure(ADC0_BASE, ADC_SEQUENCERS1, 0, ADC_CTL_CH10 | ADC_CTL_IE | ADC_CTL_END);

     ADCSequenceEnable(ADC0_BASE, ADC_SEQUENCERS0);
     ADCIntClear(ADC0_BASE, ADC_SEQUENCERS0);

     ADCSequenceEnable(ADC0_BASE, ADC_SEQUENCERS1);
     ADCIntClear(ADC0_BASE, ADC_SEQUENCERS1);


     MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
     MAP_TimerControlTrigger(TIMER0_BASE, TIMER_A, true);

     MAP_TimerConfigure(TIMER0_BASE, TIMER_CFG_A_PERIODIC);
     MAP_TimerLoadSet(TIMER0_BASE, TIMER_A, SAMPLE_RATE);

     IntMasterEnable();
     ADCIntEnable(ADC0_BASE, ADC_SEQUENCERS0);
     ADCIntEnable(ADC0_BASE, ADC_SEQUENCERS1);

     MAP_TimerEnable(TIMER0_BASE, TIMER_A);

     MAP_IntEnable(INT_TIMER0A);
     MAP_IntEnable(INT_ADC0SS0);
     MAP_IntEnable(INT_ADC0SS1);

}

void ADC0SS0IntHandler(void)
{
    unsigned int adcVal = 0;

    TimerDisable(TIMER0_BASE, TIMER_A);

    ADCIntClear(ADC0_BASE, ADC_SEQUENCERS0);

    ADCSequenceDataGet(ADC0_BASE, ADC_SEQUENCERS0, &adcVal);

    TimerEnable(TIMER0_BASE, TIMER_A);

}

void ADC0SS1IntHandler(void)
{
    unsigned int adcVal = 0;

    TimerDisable(TIMER0_BASE, TIMER_A);

    ADCIntClear(ADC0_BASE, ADC_SEQUENCERS1);

    ADCSequenceDataGet(ADC0_BASE, ADC_SEQUENCERS1, &adcVal);

    TimerEnable(TIMER0_BASE, TIMER_A);
}



The conversion data of the high-priority ADC pin shows little variation, but the conversion data of the low-priority ADC pin shows a large variation and the maximum variation is 144.
The figure below shows the ADC conversion result when the input voltage of AIN10 is fixed and the input voltage of AIN11 is varied.

Also, The figure below shows the ADC conversion result when the input voltage of AIN11 is fixed and the input voltage of AIN10 is varied.

From the results, it seems that low priority ADC pins are affected by high priority ADC input data, Could you advise on this factor and how to counteract it?


Best Regards,
H.U

  • HI,

      I don't really spot any issue with your ADC initialization. To debug the problem, can you do some experiments?

      1. Swap the priority between AIN11 and AIN10. In another word, make the AIN10 the high priority and the AIN11 the low priority? What do you see?

      2. What if you use another AIN instead of AIN10? Let's pick AIN9 or any other channels but AIN10? Do you see any difference? I just wanted to know if it is specific to AIN10. 

      3. Disable sampling on the AIN11. If you only sample AIN10, do you get accurate data?

      4. What if you put both AIN11 and AIN10 in the same sequencer instead of two difference sequencers? Do you see any difference? Again, the experiment is to understand if the problem is specific to AIN10 or related to the low priority sequencer. 

      5. I assume you have your own custom board, correct? Can you replicate the same problem on the EK-TM4C1294XL LaunchPad? If you can't replicate the problem with the launchPad then the problem may be with your board. Check if there is noise injected to AIN10. 

  • It looks to me like your input impedance is too high for your sample time. The charge on the sample capacitor from the previous conversion will affect the current conversion if the sample capacitor does not have enough time to equalize voltage with the source being sampled. Remember that the sample mux switch can have a resistance of up to 2.5K Ohms that must be added to your external source impedance. Try increasing the sample time. From page 1051 and 1052 of the datasheet: