Part Number: MSP432P401R
Hi,
I am running into the an issue where the ADC is set for multi sequence mode, but only performs a reading for ADC_MEM0 and leaves the other ones unchanged. I am checking the issue by setting up ADC_MEM0 , ADC_MEM1 and ADC_MEM2 to the same analog input to see if i get the same results. the analog input has a 3.3V input connected to it and I am using the 14 bit conversion for the ADC. I send the results to a terminal over serial and I see the following:
ADC_MEM0 = 16383
ADC_MEM1 = 3488
ADC_MEM2 = 5576
However, they should be the same. Also, if I change the voltage, ADC_MEM1 and ADC_MEM2 do not change their respective value. My code is below. I use a main loop to call the MAP_ADC14_toggleConversionTrigger function. Do you have any suggestions?
void init_ADC_no_temp(void) { /* Setting reference voltage to 2.5 and enabling temperature sensor */ MAP_REF_A_setReferenceVoltage(REF_A_VREF2_5V); MAP_REF_A_enableReferenceVoltage(); /* Initializing ADC (MCLK/1/1) with temperature sensor routed */ MAP_ADC14_enableModule(); MAP_ADC14_initModule(ADC_CLOCKSOURCE_MCLK, ADC_PREDIVIDER_1, ADC_DIVIDER_1, 0); /* Setting up GPIO pins as analog inputs (and references) */ MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P4, GPIO_PIN7 | GPIO_PIN5, GPIO_TERTIARY_MODULE_FUNCTION); /* Configuring ADC Memory */ MAP_ADC14_configureMultiSequenceMode(ADC_MEM0, ADC_MEM2, false); MAP_ADC14_configureConversionMemory(ADC_MEM0, ADC_VREFPOS_INTBUF_VREFNEG_VSS, , ADC_INPUT_A6, ADC_NONDIFFERENTIAL_INPUTS); MAP_ADC14_configureConversionMemory(ADC_MEM1, ADC_VREFPOS_INTBUF_VREFNEG_VSS, ADC_INPUT_A6, ADC_NONDIFFERENTIAL_INPUTS); MAP_ADC14_configureConversionMemory(ADC_MEM2, ADC_VREFPOS_INTBUF_VREFNEG_VSS, ADC_INPUT_A6, ADC_NONDIFFERENTIAL_INPUTS); /* Configuring the sample/hold time for 192 */ MAP_ADC14_setSampleHoldTime(ADC_PULSE_WIDTH_192,ADC_PULSE_WIDTH_192); MAP_ADC14_enableInterrupt(ADC_INT2); /* Enabling Interrupts */ MAP_Interrupt_enableInterrupt(INT_ADC14); MAP_Interrupt_enableMaster(); MAP_ADC14_enableSampleTimer(ADC_AUTOMATIC_ITERATION); /* Triggering the start of the sample */ MAP_ADC14_enableConversion(); MAP_ADC14_toggleConversionTrigger(); } void ADC14_IRQHandler(void) { uint64_t status; char strToSendLocal[200]= ""; uint16_t resultsBuffer[3]; status = MAP_ADC14_getEnabledInterruptStatus(); MAP_ADC14_clearInterruptFlag(status); if(status & ADC_INT2) { MAP_ADC14_getMultiSequenceResult(resultsBuffer); //MAP_ADC14_getResultArray(ADC_MEM0, ADC_MEM2, resultsBuffer); sprintf(strToSendLocal, "All raw values: %i, %i, %i",resultsBuffer[0],resultsBuffer[1], resultsBuffer[2]); sendStringToUART_A2(strToSendLocal, sizeof(strToSendLocal)); //Send message to UART2 } }