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.

MSPM0L1306: MSPM0L1306 : ADC channel Configuration

Part Number: MSPM0L1306
Other Parts Discussed in Thread: SYSCONFIG

Hi Team,

I observed that a maximum of up to 16 individually configurable analog input channels can be connected, as mentioned. However, in the sysconfig, I am only able to connect up to 4 channels. What should I do if I want to increase the number of channels to configure. Can any one please help me regarding this ASAP.

  • Hi Santhosh,

    Unlike the MSPM0G, the MSPM0L has only 4 MEMRES registers.  This means you can assign 4 of the 16 channels at a time.  If you want to measure on all 16 channels you will need to reconfigure the channel assignments and MEMRES registers after each group of 4 channels are measured.

    Now one way to work around this would be clone the ADC setup code created by Sysconfig and modify it for the channels you need.  Below I copied the lines that setup each MEMRES and channel so you can see.  It's not optimal but the only way to get this work.

    DL_ADC12_configConversionMem(ADC12_0_INST, ADC12_0_ADCMEM_0,
            DL_ADC12_INPUT_CHAN_0, DL_ADC12_REFERENCE_VOLTAGE_VDDA, DL_ADC12_SAMPLE_TIMER_SOURCE_SCOMP0, DL_ADC12_AVERAGING_MODE_DISABLED,
            DL_ADC12_BURN_OUT_SOURCE_DISABLED, DL_ADC12_TRIGGER_MODE_AUTO_NEXT, DL_ADC12_WINDOWS_COMP_MODE_DISABLED);
        DL_ADC12_configConversionMem(ADC12_0_INST, ADC12_0_ADCMEM_1,
            DL_ADC12_INPUT_CHAN_3, DL_ADC12_REFERENCE_VOLTAGE_VDDA, DL_ADC12_SAMPLE_TIMER_SOURCE_SCOMP0, DL_ADC12_AVERAGING_MODE_DISABLED,
            DL_ADC12_BURN_OUT_SOURCE_DISABLED, DL_ADC12_TRIGGER_MODE_AUTO_NEXT, DL_ADC12_WINDOWS_COMP_MODE_DISABLED);
        DL_ADC12_configConversionMem(ADC12_0_INST, ADC12_0_ADCMEM_2,
            DL_ADC12_INPUT_CHAN_0, DL_ADC12_REFERENCE_VOLTAGE_VDDA, DL_ADC12_SAMPLE_TIMER_SOURCE_SCOMP0, DL_ADC12_AVERAGING_MODE_DISABLED,
            DL_ADC12_BURN_OUT_SOURCE_DISABLED, DL_ADC12_TRIGGER_MODE_AUTO_NEXT, DL_ADC12_WINDOWS_COMP_MODE_DISABLED);
        DL_ADC12_configConversionMem(ADC12_0_INST, ADC12_0_ADCMEM_3,
            DL_ADC12_INPUT_CHAN_0, DL_ADC12_REFERENCE_VOLTAGE_VDDA, DL_ADC12_SAMPLE_TIMER_SOURCE_SCOMP0, DL_ADC12_AVERAGING_MODE_DISABLED,
            DL_ADC12_BURN_OUT_SOURCE_DISABLED, DL_ADC12_TRIGGER_MODE_AUTO_NEXT, DL_ADC12_WINDOWS_COMP_MODE_DISABLED);

  • Hello Dennis,

    Apologies for the late reply. I've been working on this, attempting to retrieve ADC values through interrupts. I'm receiving a value of 4095 (12-bit) in the first switch case, ADC_Count_0, but in ADC_Count_1 and ADC_Count_2, it's coming out as zero. Could you please guide me on anything I might have missed

    static UINT16 ADC_Count_0;
    static UINT16 ADC_Count_1;
    static UINT16 ADC_Count_2;
    
    void ADC12_0_INST_IRQHandler(void)
    {
        switch (DL_ADC12_getPendingInterrupt(ADC12_0_INST)) {
    
        case DL_ADC12_IIDX_MEM0_RESULT_LOADED:
    
            DL_ADC12_configConversionMem(ADC12_0_INST,
            DL_ADC12_MEM_IDX_0,
            DL_ADC12_INPUT_CHAN_5,
            DL_ADC12_REFERENCE_VOLTAGE_VDDA,
            DL_ADC12_SAMPLE_TIMER_SOURCE_SCOMP0,
            DL_ADC12_AVERAGING_MODE_DISABLED,
            DL_ADC12_BURN_OUT_SOURCE_DISABLED,
            DL_ADC12_TRIGGER_MODE_AUTO_NEXT,
            DL_ADC12_WINDOWS_COMP_MODE_DISABLED);
            
            ADC_Count_0 = DL_ADC12_getMemResult(ADC12_0_INST,
            DL_ADC12_MEM_IDX_0);
            
            DL_ADC12_clearInterruptStatus(ADC12_0_INST,
            (DL_ADC12_INTERRUPT_MEM0_RESULT_LOADED));
            
            DL_ADC12_disableInterrupt(ADC12_0_INST,
            (DL_ADC12_INTERRUPT_MEM0_RESULT_LOADED));
            
            DL_ADC12_enableInterrupt(ADC12_0_INST,
            (DL_ADC12_INTERRUPT_MEM1_RESULT_LOADED));
            
            break;
    
        case DL_ADC12_IIDX_MEM1_RESULT_LOADED:
        
            DL_ADC12_configConversionMem(ADC12_0_INST,
            DL_ADC12_MEM_IDX_1,
            DL_ADC12_INPUT_CHAN_3,
            DL_ADC12_REFERENCE_VOLTAGE_VDDA,
            DL_ADC12_SAMPLE_TIMER_SOURCE_SCOMP0,
            DL_ADC12_AVERAGING_MODE_DISABLED,
            DL_ADC12_BURN_OUT_SOURCE_DISABLED,
            DL_ADC12_TRIGGER_MODE_AUTO_NEXT,
            DL_ADC12_WINDOWS_COMP_MODE_DISABLED);
            
            ADC_Count_1 = DL_ADC12_getMemResult(ADC12_0_INST,
            DL_ADC12_MEM_IDX_1);
            
            DL_ADC12_clearInterruptStatus(ADC12_0_INST,
            (DL_ADC12_INTERRUPT_MEM1_RESULT_LOADED));
            
            DL_ADC12_disableInterrupt(ADC12_0_INST,
            (DL_ADC12_INTERRUPT_MEM1_RESULT_LOADED));
            
            DL_ADC12_enableInterrupt(ADC12_0_INST,
            (DL_ADC12_INTERRUPT_MEM2_RESULT_LOADED));
            
            break;
        
        case DL_ADC12_IIDX_MEM2_RESULT_LOADED:
        
            DL_ADC12_configConversionMem(ADC12_0_INST,
            DL_ADC12_MEM_IDX_2,
            DL_ADC12_INPUT_CHAN_4,
            DL_ADC12_REFERENCE_VOLTAGE_VDDA,
            DL_ADC12_SAMPLE_TIMER_SOURCE_SCOMP0,
            DL_ADC12_AVERAGING_MODE_DISABLED,
            DL_ADC12_BURN_OUT_SOURCE_DISABLED,
            DL_ADC12_TRIGGER_MODE_AUTO_NEXT,
            DL_ADC12_WINDOWS_COMP_MODE_DISABLED);
            
            ADC_Count_2 = DL_ADC12_getMemResult(ADC12_0_INST,
            DL_ADC12_MEM_IDX_2);
            
            DL_ADC12_clearInterruptStatus(ADC12_0_INST,
            (DL_ADC12_INTERRUPT_MEM2_RESULT_LOADED));
            
            DL_ADC12_disableInterrupt(ADC12_0_INST,
            (DL_ADC12_INTERRUPT_MEM2_RESULT_LOADED));
            
            DL_ADC12_enableInterrupt(ADC12_0_INST,
            (DL_ADC12_INTERRUPT_MEM0_RESULT_LOADED));
            
            }
            break;
        
        default:
        break;
    }

  • Hi Dennis,

    Can you Please reply for this.we are waiting for for your reply.

  • Hi Santhosh,

    I super apologize for the delay.  Looking at your code, if you are only trying to read 4 channels then use Sysconfig to configure those channels.  If you are attempting to measure all 16 by reassigning another 4 channels, I would wait until you get an interrupt for DL_ADC12_IIDX_MEM3_RESULT_LOADED, then reconfigure the next 4 channels and so on...