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.

MSP432P401R: MSP432 ADC14 Multiple Channel only converts one value in the sequence.

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

    }
}

  • Walo91,

    Given its the weekend, I'm not in the office to test this, but i believe your problem is in the way you are setting up your GPIO/Channels for the ADC.

    Configure conversion memory all to respond to A6 channel. However, your A6 is only available on P4.7.

    You would want ADC_INPUT_A8 for P4.5 and ADC_INPUT_A7 for P4.6.

    I'm only assuming you want to measure off of P4.6 though. You aren't initializing it currently though so you would need to add GPIO_PIN6 as i have done below to enable it and use A7 channel.

    MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P4,
    GPIO_PIN7 | GPIO_PIN6 | GPIO_PIN5, GPIO_TERTIARY_MODULE_FUNCTION);

    Reference Table 4-1 Pin Attributes of the datasheet for more information.

    This example is also good. dev.ti.com/.../
  • 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?

  • Section 20.2.6.3 "Sampling Time Considerations" has more on this topic above. Check this out in the TRM.www.ti.com/.../litabsmultiplefilelist.tsp
  • Walo,

    Due to inactivity I'm going to consider this closed for now. Please repost to open this thread for anything related this thread, otherwise for any other questions create a new thread. Thanks!

**Attention** This is a public forum