Hello everyone,
I'm trying to set up ADC1 sequencer 0 to input from 3 analog channels. I assume this is possible, right?
I set up the sequencer and all the 3 steps, however the interrupts are not being generated.
I paste the setup code bellow:
void ADC_Light_sensor_init(void) //Initialize microphone input { SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC1); //The ADC1 peripheral must be enabled for use. SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); //Enable GPIO port E GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3); // Configure PE1, PE2, PE3 as analog input GPIODirModeSet(GPIO_PORTE_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, GPIO_DIR_MODE_IN); //Set direction input for PE1, PE2, PE3 GPIOPadConfigSet(GPIO_PORTE_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_ANALOG); //Configure PUR for PE3 IntDisable(INT_ADC1SS0); ADCIntClear(ADC1_BASE, 0); //Clear interrupt flag for ADC1 sequencer 0 ADCIntDisable(ADC1_BASE, 0); //Disable interrupts from ADC1 sequencer 0 ADCSequenceDisable(ADC1_BASE,0); //Disable ADC1 sequencer 0 //All sensor ADC configuration ADCSequenceConfigure(ADC1_BASE,0, ADC_TRIGGER_PROCESSOR, 1); ADCSequenceStepConfigure(ADC1_BASE,0,0, ADC_CTL_CH0); //Configure step 0 ADCSequenceStepConfigure(ADC1_BASE,0,1, ADC_CTL_CH1); //Configure step 1 ADCSequenceStepConfigure(ADC1_BASE,0,2, ADC_CTL_CH2 | ADC_CTL_IE | ADC_CTL_END); //Configure step 2 ADCSequenceEnable(ADC1_BASE,0); //Enable ADC1 sequencer 0 ADCIntEnable(ADC1_BASE, 0); //Enable interrupts from ADC1 sequencer 0 IntPrioritySet(INT_ADC1SS0,(Int_Prio_Light_Sens)<<5); IntEnable(INT_ADC1SS0); //Enable interrupts from ADC1 sequencer 0 }
And here I have the ISR:
void ADC1Seq0_Handler(void) //ADC0 Seq3 ISR { uint32_t Light; if(ADCIntStatus(ADC1_BASE, 0, false)) { ADCIntClear(ADC1_BASE, 0); //Clear interrupt flag ADCSequenceDataGet(ADC1_BASE, 0, &Light); Mx_LS_Value = (Light&0xFFF); Rx_LS_Value = ((Light&0xFFF000)>>12);; Lx_LS_Value = ((Light&0xFFF000000)>>24);*/ } }
The ADC is triggered by the software every 100ms with ADCProcessorTrigger(ADC1_BASE, 0);
If I eliminate two of the three steps, it works.
Also if I use a different sequencer for different analog input.
However I would like to have all 3 inputs on one sequencer, is this possible?
Thanks & Regards,
Alex