Part Number: MSP432P401R
Tool/software: TI C/C++ Compiler
I am trying to read in 2 signals through the ADC pins. Whenever I run the code, only the first ADC pin value is stored. During debugging, I found out that the registers ADC14MEM0 and ADC14MEM1 change values but the change is only reflected in the variable that stores the value of ADC14MEM0.
Also I dont know if this is useful or not but the voltage values being read in are from a pair of analog proximity sensors that are powered with 3.3V from the Microcontroller.
Below is my code setup;
/* DriverLib Includes */ #include <ti/devices/msp432p4xx/driverlib/driverlib.h> /* Standard Includes */ #include <stdint.h> #include <string.h> static uint16_t resultsBuffer[2]; int main(void) { /* Halting WDT */ MAP_WDT_A_holdTimer(); MAP_Interrupt_enableSleepOnIsrExit(); /* Zero-filling buffer */ memset(resultsBuffer, 0x00, 2); //![Simple REF Example] /* Setting reference voltage to 2.5 and enabling reference */ // MAP_REF_A_setReferenceVoltage(REF_A_VREF2_5V); MAP_REF_A_enableReferenceVoltage(); //![Simple REF Example] /* Initializing ADC (MCLK/1/1) */ MAP_ADC14_enableModule(); MAP_ADC14_initModule(ADC_CLOCKSOURCE_MCLK, ADC_PREDIVIDER_1, ADC_DIVIDER_1, 0); /* Configuring GPIOs for Analog In */ MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P5, GPIO_PIN5 | GPIO_PIN4, GPIO_TERTIARY_MODULE_FUNCTION); /* Configuring ADC Memory (ADC_MEM0 - ADC_MEM7 (A0 - A7) with no repeat) * with internal 2.5v reference */ MAP_ADC14_configureMultiSequenceMode(ADC_MEM0, ADC_MEM1, true); MAP_ADC14_configureConversionMemory(ADC_MEM0, ADC_VREFPOS_AVCC_VREFNEG_VSS, ADC_INPUT_A0, false); MAP_ADC14_configureConversionMemory(ADC_MEM1, ADC_VREFPOS_AVCC_VREFNEG_VSS, ADC_INPUT_A1, false); /* Enabling the interrupt when a conversion on channel 7 (end of sequence) * is complete and enabling conversions */ MAP_ADC14_enableInterrupt(ADC_INT1); /* Enabling Interrupts */ MAP_Interrupt_enableInterrupt(INT_ADC14); MAP_Interrupt_enableMaster(); /* Setting up the sample timer to automatically step through the sequence * convert. */ MAP_ADC14_enableSampleTimer(ADC_AUTOMATIC_ITERATION); //ADC14_setSampleHoldTime(ADC_PULSE_WIDTH_64, ADC_PULSE_WIDTH_64); /* Triggering the start of the sample */ MAP_ADC14_enableConversion(); MAP_ADC14_toggleConversionTrigger(); /* Going to sleep */ while (1) { MAP_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 = MAP_ADC14_getEnabledInterruptStatus(); MAP_ADC14_clearInterruptFlag(status); if(status & ADC_INT1) { MAP_ADC14_getMultiSequenceResult(resultsBuffer); } }