Hey I have a small question.
I'm trying to read analog inputs from the pins PE1-4
I can read the data from pins PE2 and PE3 but can't read the data from PE4 (didnt try yet reading from PE1)
Its probably a small thing I did wrong in the initialization, can someone please take a quick look?
Thanks.
This is how I try to read the data:
ADCIntClear(ADC0_BASE, 0);
ADCSequenceDataGet(ADC0_BASE, 0, adc_data);
data_PE4 = adc_data[3];
And this is how I initialize the ADC:
// Configure the ADC sample sequence.
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
while(!(SysCtlPeripheralReady(SYSCTL_PERIPH_ADC0)));
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_1| GPIO_PIN_2| GPIO_PIN_3| GPIO_PIN_4);
GPIOPadConfigSet(GPIO_PORTE_BASE,GPIO_PIN_1,GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_ANALOG);
GPIOPadConfigSet(GPIO_PORTE_BASE,GPIO_PIN_2,GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_ANALOG);
GPIOPadConfigSet(GPIO_PORTE_BASE,GPIO_PIN_3,GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_ANALOG);
GPIOPadConfigSet(GPIO_PORTE_BASE,GPIO_PIN_4,GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_ANALOG);
ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_TIMER, 0);
ADCSequenceStepConfigure(ADC0_BASE, 0, 0, ADC_CTL_CH0);
ADCSequenceStepConfigure(ADC0_BASE, 0, 1, ADC_CTL_CH1);
ADCSequenceStepConfigure(ADC0_BASE, 0, 2, ADC_CTL_CH2);
ADCSequenceStepConfigure(ADC0_BASE, 0, 3, ADC_CTL_CH9 | ADC_CTL_END | ADC_CTL_IE);
ADCSequenceEnable(ADC0_BASE, 0);
// Enable 8x hardware averaging
ADCHardwareOversampleConfigure(ADC0_BASE, 8);
IntEnable(INT_ADC0SS0);
ADCIntEnable(ADC0_BASE, 0);