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.

MSPM0-SDK: ADC is working ok on launch pad but not on custom board.

Part Number: MSPM0-SDK

We are trying to configure ADC ,code is working on Launch pad board with 20 pin IC  but not on the board for 8pin Ic.

  • Hi Seema,

    Please clarify the part number of the IC (include the package), and the schematic for your own custom board.

    For generic suggestions, please check the IC pin voltage and make sure no hardware issues. Then you need check your pin functions and whether it supports ADC or not. Finally, check  the ADC conversion result in MEMRESx and see what difference compared to expected value.

    B.R.

    Sal

  • Hi Sal,

    Thanks AC issue resolved ,it was related to the configuration settings.

  • Is there any limitaion on watch window,! we can not see the ADC updated values in watch window while code is running.Please guide

  • Hi Seema,

    Use global variables if you want to observe it in watch window.

    If this does not take effect, add volatile to the variables to prevent compiler do optimization on the variables.

    Example: 

    volatile uint32_t gData32 = 0x12345678;

    B.R.

    Sal

  • #include "ti_msp_dl_config.h"

    volatile bool gCheckADC;
    volatile uint16_t gAdcResult;
    volatile int16_t gADCOffset;
    bool LED = false;

    Hi please check following code for ADC watch window issue

    int main(void)
    {  
        SYSCFG_DL_init();

        /* Get calibrated ADC offset - workaround for ADC_ERR_09 */
        gADCOffset =
            DL_ADC12_getADCOffsetCalibration(ADC12_0_ADCMEM_0_REF_VOLTAGE_V);

        NVIC_EnableIRQ(ADC12_0_INST_INT_IRQN);
        gCheckADC = false;

        while (1) {
            DL_ADC12_startConversion(ADC12_0_INST);

            while (false == gCheckADC) {
                __WFE();
            }

            gAdcResult = DL_ADC12_getMemResult(ADC12_0_INST, DL_ADC12_MEM_IDX_0);

            /* Apply calibrated ADC offset - workaround for ADC_ERR_09 */
            int16_t adcRaw = (int16_t) gAdcResult + gADCOffset;
            if (adcRaw < 0) {
                adcRaw = 0;
            }
            if (adcRaw > 4095) {
                adcRaw = 4095;
            }
            gAdcResult = (uint16_t) adcRaw;

            if (!LED)
            {
                if (gAdcResult > 0x36)
            {
                LED= true;
                DL_GPIO_clearPins(GPIO_GRP_0_PORT, GPIO_GRP_0_PIN_0_PIN);
                delay_cycles(120000000);
               
            }
            }
            else
            {
                if (gAdcResult < 0x25)
              {
                LED=  false;
                DL_GPIO_setPins(GPIO_GRP_0_PORT, GPIO_GRP_0_PIN_0_PIN);
                delay_cycles(12000000);
              }
            }
            gCheckADC = false;
            DL_ADC12_enableConversions(ADC12_0_INST);
        }
    }
  • Hi Seema,

    The device you used is M0C110X, this device is not supported by my team.

    For the code you shared, I do not see any issues. I think the variable should be observed in watch window.

    B.R.

    Sal