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: adc12_triggered_by_timer_event example not continuous

Part Number: MSPM0L1306
Other Parts Discussed in Thread: SYSCONFIG

Hi Team,

I'm trying to modify adc12_triggered_by_timer_event example to run continuously and I need help with the sysconfig modifications.

Modfications made thus far to sysconfig:

1) TIMER -> Basic Configuration -> Timer Mode: Periodic Down Counting

2) TIMER -> Interrupt Configuration -> Enable Interrupts: Zero Event

main.c:

#include "ti_msp_dl_config.h"

volatile bool gCheckADC;
volatile uint16_t gADCResult[4];
volatile uint16_t gCount;
int main(void)
{
    SYSCFG_DL_init();

    NVIC_EnableIRQ(ADC12_0_INST_INT_IRQN);
    NVIC_EnableIRQ(TIMER_0_INST_INT_IRQN);

    gCheckADC = false;

    DL_TimerG_startCounter(TIMER_0_INST);

    while (1) {
        __WFE();
    }
}

void ADC12_0_INST_IRQHandler(void)
{
    switch (DL_ADC12_getPendingInterrupt(ADC12_0_INST)) {
        case DL_ADC12_IIDX_MEM3_RESULT_LOADED:
            gCheckADC = true;
            gADCResult[0] = DL_ADC12_getMemResult(ADC12_0_INST, DL_ADC12_MEM_IDX_0);
            gADCResult[1] = DL_ADC12_getMemResult(ADC12_0_INST, DL_ADC12_MEM_IDX_1);
            gADCResult[2] = DL_ADC12_getMemResult(ADC12_0_INST, DL_ADC12_MEM_IDX_2);
            gADCResult[3] = DL_ADC12_getMemResult(ADC12_0_INST, DL_ADC12_MEM_IDX_3);
            break;
        default:
            break;
    }
}

void TIMER_0_INST_IRQHandler(void){
    switch (DL_TimerG_getPendingInterrupt(TIMER_0_INST)) {
            case DL_TIMER_IIDX_ZERO:
                gCount++;
                break;
            default:
                break;
    }
}

When running the code, I can see gCount in the expressions tab, but gADCresult does not update and the code never reenters the ISR after the initial conversion.

Is there another setting I need to enable to have every zero event trigger an ADC SOC?

  • Seems like there might be a function of the ADC disabling conversion after a conversion has completed. Adding, DL_ADC12_enableConversion(ADC12_0_INST); into the ADC ISR fixed the issue. However, this means that the CPU must be used to do continuous ADC triggering using a timer Disappointed

  • Hi Nishka,

    Yes, if using the single conversion mode the CPU must re-enable the conversion.  Have you tried the Repeat mode?

  • Was able to get this working with the help of Brandon and Luke.

    Just enabling repeat mode, causes the sequence conversions to start based on the trigger but continuously run rather than restarting on the next trigger. I.E. the ADC1 conversion will happen 3 times even tho the timer has triggered only 1 time.

    To solve this:

    1) Enable repeat mode

    2) For each ADC Conversion memory configuration, change the rigger mode to "valid trigger will step to next memory conversion register".

    This causes each conversion in the Sequence to only run after the timer has triggered.