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

