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.

EK-TM4C1294XL: Setup ADC for more than 1 input

Part Number: EK-TM4C1294XL

What changes are necessary to single_ended.c to use SS2 instead of SS3?

I see that it is quite easy to set ADCSequenceConfigure( ) to use SS2 instead of SS3.

But do I need to make multiple calls to ADCSequenceStepConfigure( ) - one call for each input?

This is unclear from the datasheet and I have seen no examples for multiple inputs to ADC.

What I think happens is people do a single input on sequencer 3 and do the setup and gather multiple times in a for( )  loop, which seems very inefficient.

  • To elaborate, what steps are necessary to use SS2 for 4 inputs AIN0, AIN1, AIN2, and AIN3? what changes could be made to TivaWare_C_Series-2.x examples/peripherals/adc/single_ended.c to accomplish this?

  • Hi,

      Below is an example snippet of code that set up 3 channels (ADC_CTL_CH0 , ADC_CTL_CH1  and ADC_CTL_CH2 ) using SSI2. You need to associate each channel with a step of SSI2. For example, ADC_CTL_CH0 is associated with step 0 while ADC_CTL_CH2 is associated with step 2 of SSI2. You can add one more channel as step 3 to SSI2 as SSI2 only a maximum of 4 channels. The last step of the sample sequencer is declared as the end of sampling using ADC_CTL_END flag. 

    GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_3 | GPIO_PIN_2 | GPIO_PIN_1);

    ADCSequenceConfigure(ADC0_BASE, 2, ADC_TRIGGER_PROCESSOR, 0);

    ADCSequenceStepConfigure(ADC0_BASE, 2, 0, ADC_CTL_CH0 );

    ADCSequenceStepConfigure(ADC0_BASE, 2, 1, ADC_CTL_CH1 );

    ADCSequenceStepConfigure(ADC0_BASE, 2, 2, ADC_CTL_CH2 | ADC_CTL_IE |
    ADC_CTL_END);

    ADCSequenceEnable(ADC0_BASE, 0);