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.
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 } }
Hi Evan,
Thanks for the reply. You are correct, I am directing the same channel (A6) to memories 0, 1 , 2. I am doing this to compare the values that each memory receives after a multi channel reading. My problem is that memory 0 reads the voltage correctly, however, mem1 and mem2 do not. In fact, mem1 and mem2 never change their value. The values I get are:
ADC_MEM0 = 16383
ADC_MEM1 = 3488
ADC_MEM2 = 5576
I am expecting the values to be the same on each memory location since they are looking at the same analog pin, but that is not the case. Is there any setup I am missing?
Washo
Walo,
Sorry I think i misunderstood your original question. What is your impedance of the input? Are you plugging from VCC on the LaunchPad or from somewhere else?
If you have a high impedance, you will need to slow down the rate at which you are sampling. What I think is happening is you are taking a sample, but then the overall impedance causes a dip in the effective voltage on the pin. So the next two samples you will sample in the middle of that voltage dip.
What happens when you slow your sampling frequency down?
**Attention** This is a public forum