Hi,
I'm having problems getting all the results when I modify the example in driverlib to use four random ADC14 channels. My code is below. The problem that I notice in the debugger is that only ADC_MEM0 is being returned in the resultsBuffer. The others get numbers, but they don't change when I change the applied voltage to their respective pins. Any tips on what I'm doing wrong?
I should mention that the call to ADC14_getResultArray(ADC_MEM0, ADC_MEM3, resultsBuffer); causes the processor to go picking daises. There was already a previous post where someone else pointed out that bug and it was duplicated by someone at TI.
Thanks,
Rob
/* DriverLib Includes */ #include "driverlib.h" /* Standard Includes */ #include <stdint.h> #include <string.h> static uint16_t resultsBuffer[4]; int main(void) { /* Halting WDT */ WDT_A_holdTimer(); Interrupt_enableSleepOnIsrExit(); /* Zero-filling buffer */ memset(resultsBuffer, 0x00, 4); /* Setting reference voltage to 2.5 and enabling reference */ //REF_A_setReferenceVoltage(REF_A_VREF2_5V); //REF_A_enableReferenceVoltage(); /* Initializing ADC (MCLK/1/1) */ ADC14_enableModule(); ADC14_initModule(ADC_CLOCKSOURCE_MCLK, ADC_PREDIVIDER_1, ADC_DIVIDER_1, 0); /* Configuring GPIOs for Analog In */ GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P5, GPIO_PIN2 | GPIO_PIN0, GPIO_TERTIARY_MODULE_FUNCTION); GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P4, GPIO_PIN1 | GPIO_PIN3, GPIO_TERTIARY_MODULE_FUNCTION); /* Configuring GPIOs for Analog In * Pin 5.0 is S11_I, A5 resultsBuffer[0] * Pin 5.2 is S11_Q, A3 resultsBuffer[1] * Pin 4.3 is S21_I, A10 resultsBuffer[2] * Pin 4.1 is S21_Q, A12 resultsBuffer[3] */ /* Configuring ADC Memory (ADC_MEM0 - ADC_MEM3 (A5,A3,A10,A12) with no repeat) * with internal 2.5v reference */ ADC14_configureMultiSequenceMode(ADC_MEM0, ADC_MEM3, false); ADC14_configureConversionMemory(ADC_MEM0, ADC_VREFPOS_INTBUF_VREFNEG_VSS, ADC_INPUT_A5, ADC_NONDIFFERENTIAL_INPUTS); ADC14_configureConversionMemory(ADC_MEM1, ADC_VREFPOS_INTBUF_VREFNEG_VSS, ADC_INPUT_A3, ADC_NONDIFFERENTIAL_INPUTS); ADC14_configureConversionMemory(ADC_MEM2, ADC_VREFPOS_INTBUF_VREFNEG_VSS, ADC_INPUT_A10, ADC_NONDIFFERENTIAL_INPUTS); ADC14_configureConversionMemory(ADC_MEM3, ADC_VREFPOS_INTBUF_VREFNEG_VSS, ADC_INPUT_A12, ADC_NONDIFFERENTIAL_INPUTS); ADC14_setSampleHoldTime(ADC_PULSE_WIDTH_192,ADC_PULSE_WIDTH_192); /* Enabling the interrupt when a conversion on channel 3 (end of sequence) * is complete and enabling conversions */ ADC14_enableInterrupt(ADC_INT3); /* Enabling Interrupts */ Interrupt_enableInterrupt(INT_ADC14); Interrupt_enableMaster(); /* Setting up the sample timer to automatically step through the sequence * convert. */ ADC14_enableSampleTimer(ADC_AUTOMATIC_ITERATION); /* Going to sleep */ while (1) { /* Triggering the start of the sample */ ADC14_enableConversion(); ADC14_toggleConversionTrigger(); // PCM_gotoLPM0(); } } /* This interrupt is fired whenever a conversion is completed and placed in * ADC_MEM7. This signals the end of conversion and the results array is * grabbed and placed in resultsBuffer */ void ADC14_IRQHandler(void) { uint64_t status; status = ADC14_getEnabledInterruptStatus(); ADC14_clearInterruptFlag(status); if(status & ADC_INT3) { ADC14_getMultiSequenceResult(resultsBuffer); //ADC14_getResultArray(ADC_MEM0, ADC_MEM3, resultsBuffer); } }