I currently have just Port E Pins 0,1,2,3 enabled for ADC. I plan to use PE1 to PE3 later, but currently I only read with PE0. I noticed the other three pins and all the non-enabled ADC sampling pins are affected by my reading on PE0. For example, I set up PD0 and PD1 as GPIO pins, but they were sampling as ADC pins instead when I read their output on the scope. Am I initializing something wrong? My evaluation board is brand new, I don't see how it could be broken already.
Below is my initialization for the ADC.
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0); GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_3 | GPIO_PIN_2 | GPIO_PIN_1 | GPIO_PIN_0); //must have enabled ADC first TimerDisable(TIMER0_BASE, TIMER_A); TimerControlTrigger(TIMER0_BASE, TIMER_A, true); //enable TIMER0A trigger to ADC TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC); TimerLoadSet(TIMER0_BASE, TIMER_A, SysCtlClockGet()/SAMPLES_PER_SEC); TimerIntDisable(TIMER0_BASE, 0xFFFFFFFF ); //disable all interrupts for this timer TimerEnable(TIMER0_BASE, TIMER_A); ADCClockConfigSet(ADC0_BASE, ADC_CLOCK_RATE_EIGHTH , 1); ADCSequenceDisable(ADC0_BASE, ADC_SEQUENCE2); ADCSequenceConfigure(ADC0_BASE, ADC_SEQUENCE2, ADC_TRIGGER_TIMER, 0); ADCSequenceStepConfigure(ADC0_BASE, ADC_SEQUENCE2, 0, ADC_CTL_CH3 ); ADCSequenceStepConfigure(ADC0_BASE, ADC_SEQUENCE2, 1, ADC_CTL_CH2 ); ADCSequenceStepConfigure(ADC0_BASE, ADC_SEQUENCE2, 2, ADC_CTL_CH1 ); ADCSequenceStepConfigure(ADC0_BASE, ADC_SEQUENCE2, 3, ADC_CTL_CH0 | ADC_CTL_END | ADC_CTL_IE); //adc_base, Sequence Number, Step, set flag and end after first ADCSequenceEnable(ADC0_BASE, ADC_SEQUENCE2); //adc_base, sequence ADCIntEnable(ADC0_BASE, ADC_SEQUENCE2); ADCIntRegister(ADC0_BASE, ADC_SEQUENCE2, &ADC0Seq2_Handler); IntPrioritySet(INT_ADC0SS2, ADC_SEQUENCE2_PRIORITY); IntEnable(INT_ADC0SS2); ADCIntClear(ADC0_BASE, ADC_SEQUENCE2);
//Here is my initialization code for the GPIO
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_0); GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_1); GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2); GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE, GPIO_PIN_2); configureTimer1A();