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.

Need some help with ADC sequencer 0 with 3 analog inputs

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

  • hello Alex,

    A quick note to let you we have received your question and are reviewing it. We will get back to you after we have had some opportunity to investigate.
  • Hello Alex,

    My apologies for the delays in getting back with you. Can you have a quick look at this thread to see if the information presented in it will help you solve your issue. Of note are the verification that your interrupt handler is located at the proper vector table location and to double check to see if the interrupt flags in the ADC module are getting set indicating that the conversions are happening. In addition, it may be worth while to simply put a while loop after your trigger function call in main to read the FIFO to insure the ADC and sequencer are working as intended. If this is confirmed, then get back to the interrupt issue. i.e., simplify and work one issue at a time.