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.

MSPM0G3107: ADC Configuration

Part Number: MSPM0G3107
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

I am trying to build a data acq using MSPM0G devices for two channel simultaneous sampling for ADC0 and ADC1, and would like to optimize hardware solution and minimize CPU intervention.   I would like to

1) Start a timer that defines the sampling time ( 1msec) for both ADC's

2) Each over flow it starts the ADC sampling through timer event channels for both ADC's.  ( That works for me)

3) MEM interrupt will move the result to external buffer through DMA  for both ADC's sing DMA Channel 0 and DMA Channel 1.  That works great.

4) ADC retrigger and ready for next timer over flow event.  This works for single ADC conversion, but when I enable Single repeated mode , ADC interrupts just keeps interrupting the processor and I could not get to reset interrupt will not exit.  I have tried that in debug mode or even when run mode it still I could reset the interrupt and have the ADC wait for next over flow interrupt.

This the sysconfig file generated for one ADC:

/**
* Write custom configuration values to the imported modules.
*/
ADC121.$name = "ADC12_0";
ADC121.enabledInterrupts = ["DL_ADC12_INTERRUPT_MEM0_RESULT_LOADED"];
ADC121.trigSrc = "DL_ADC12_TRIG_SRC_EVENT";
ADC121.subChanID = 1;
ADC121.adcMem0avgen = true;
ADC121.sampClkSrc = "DL_ADC12_CLOCK_ULPCLK";
ADC121.adcMem0chansel = "DL_ADC12_INPUT_CHAN_3";
ADC121.sampCnt = 1;
ADC121.sampleTime0 = "500 ns";
ADC121.configureDMA = true;
ADC121.enabledDMATriggers = ["DL_ADC12_DMA_MEM0_RESULT_LOADED"];
ADC121.repeatMode = true;
ADC121.peripheral.$assign = "ADC0";
ADC121.adcPin3Config.$name = "ti_driverlib_gpio_GPIOPinGeneric0";
ADC121.DMA_CHANNEL.$name = "DMA_CH0_ADC0";
ADC121.DMA_CHANNEL.transferMode = "FULL_CH_REPEAT_SINGLE";
ADC121.DMA_CHANNEL.srcLength = "HALF_WORD";
ADC121.DMA_CHANNEL.dstLength = "HALF_WORD";
ADC121.DMA_CHANNEL.enableInterrupt = true;
ADC121.DMA_CHANNEL.peripheral.$assign = "DMA_CH0";
  • Based on your description, I suspect you want MEMCTL[0].TRIG=1 [Ref TRM (SLAU846B) Table  12-47].

    (In sysconfig: ADC12_0->Basic->Sampling Mode->Conversion Memory Configuration->Conversion Memory 0->Optional->Trigger Mode->"Valid Trigger will step").

    In the .syscfg file this looks something like: "ADC121.adcMem0trig = "DL_ADC12_TRIGGER_MODE_TRIGGER_NEXT";"

    WIth the default setting ("Trigger will automatically step") it will sample continuously, rather than timer-based.

    [Edit: Added reference; minor re-formatting for clarity.]

  • Thanks for detailed response, that was the problem.  

  • I am having similar problem but now with UART, where I am trying to configure the DMA to push sampled ADC data to the uart.  I have enabled Block or Single Repat with no luck,

    WorkFlow as follows, 

    1) ADC Done converting   -> TRIGGER DMA  CHAN0 to move data from ADC MEM to adc_buffer

    2) DMA CHAN0  -> Trigger the UART DMA automatically.

    Currently I am generating an interrupt after CHAN0 and then starting the DMA CHA1 manually to send data out. 

  • I think I solved the problem by configuring the DMA with internal instead of the external DMA.  Configuration through the DMA Configuration not through UART DMA configuration.