I'm having a hard time trying to get some data from ADC1 - Sample Sequencer 3 - AI2, of TM4C1294NCPDT.
I followed every step in the datasheet.
But no data is get. I made the code bllow:
#include <TM4C129.h>
uint32_t valor = 0;
void ADC1SS3_Handler(void){
valor = ADC1->SSFIFO3;
ADC1->ISC |= (1UL << 3);
}
int main(){
//ADC1 - SS3
//PE1 - AIN2 - Analog-to-digital converter input 2
SYSCTL->RCGCGPIO |= (1UL << 5) | (1UL << 4); /* enable clock to PORT F, E */
GPIOF_AHB->DIR |= (1UL << 4); /* make PORTF4 input for switch */
GPIOF_AHB->DEN |= (1UL << 4); /* make PORTF4-0 digital pins */
SYSCTL->RCGCADC |= (1UL << 1); //Enable clock to ADC 1
GPIOE_AHB->AFSEL |= (1UL << 1); //Enable alternate function for this pin
GPIOE_AHB->DEN &= ~(1UL << 1); //Make this pin an analog input
GPIOE_AHB->AMSEL |= (1UL << 1); //Disable the analog isolation circuit
ADC1->ACTSS &= ~(1UL << 3); //Ensure that the sample sequencer is disable
ADC1->EMUX = (0xF <<12); //Selects the event (trigger)
ADC1->SSEMUX3 = 0; // Clear to SSMUX3 select AI[15:0]
ADC1->SSMUX3 = 2;
ADC1->SSCTL3 = 0x6;
ADC1->IM |= (1UL << 3);
ADC1->ACTSS = (1UL << 3);
ADC1->ISC |= (1UL << 3);
NVIC_EnableIRQ(ADC1SS3_IRQn);
while(1){
}
}
I don't see where it's wrong.