Part Number: TM4C129ENCPDT
Tool/software:
I am trying to receive five values—ADC channels CH0 to CH3 and the temperature sensor—in a single sequence.
I have configured it with the following code and receive data using:
ADCSequenceDataGet(ADC0_BASE, 0, gs_pui32ADCBuffer);However, when I apply a 1V voltage to AIN3 (ADC CH3), the temperature sensor value also changes slightly (the value written by the ADCSequenceDataGet function increases by about 100).Do you have any idea why the temperature sensor value might be changing?The Timer interrupt is enabled in an other function.
//
// Enable the peripherals used by this application.
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
//
// Enable the GPIO pin for ADC0 Channel 0-4 (PE3 PE2 PE1 PE0) which configures it for
// analog functionality.
//
GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_0);
GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_1);
GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_2);
GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_3);
ADCClockConfigSet(ADC0_BASE, ADC_CLOCK_SRC_PIOSC | ADC_CLOCK_RATE_HALF, 1);
//
// Wait for the clock configuration to set.
//
SysCtlDelay(10);
//
// Disable the ADC0 sequence 0 interrupt on the processor (NVIC).
//
IntDisable(INT_ADC0SS0);
//
// Disable interrupts for ADC0 sample sequence 0 to configure it.
//
ADCIntDisable(ADC0_BASE, 0);
//
// Disable ADC0 sample sequence 0. With the sequence disabled, it is now
// safe to load the new configuration parameters.
//
ADCSequenceDisable(ADC0_BASE, 0);
//
// Enable sample sequence 0 with a processor signal trigger. Sequence 0
// will do a single sample when the processor sends a signal to start the
// conversion.
//
ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_TIMER, 0);
ADCReferenceSet(ADC0_BASE,ADC_REF_EXT_3V);
//アナログ入力0-4Ch,温度センサの値を取得する設定
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_CH3);
ADCSequenceStepConfigure(ADC0_BASE, 0, 4,
ADC_CTL_TS | ADC_CTL_END | ADC_CTL_IE);
//
// Since sample sequence 0 is now configured, it must be enabled.
//
ADCSequenceEnable(ADC0_BASE, 0);
//
// Clear the interrupt status
ADCIntClear(ADC0_BASE, 0);
//
// Enables the DMA channel for the ADC0 sample sequence 0.
//
//ADCSequenceDMAEnable(ADC0_BASE, 0);
//
// Enable the ADC 0 sample sequence 0 interrupt.
//
ADCIntEnable(ADC0_BASE, 0);
//
// Enable the interrupt for ADC0 sequence 0 on the processor (NVIC).
//
IntEnable(INT_ADC0SS0);
//
// Enable the ADC trigger output for Timer A.
//
TimerControlTrigger(TIMER0_BASE, TIMER_A, true);
//
// Enable processor interrupts.
//
IntMasterEnable();