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.

TM4C1233H6PGE: ADC setup for 2MHz automatic sampling, cannot be returned to single sampling without uC reset

Part Number: TM4C1233H6PGE

2MHz setup:

     ADCSequenceDisable(ADC1_BASE, 1);
     ADCSequenceDisable(ADC0_BASE, 1);
     IntDisable(INT_ADC1SS1);
     IntDisable(INT_ADC0SS1);
     uDMAChannelDisable(UDMA_CH15_ADC0_1);
     uDMAChannelDisable(UDMA_CH25_ADC1_1);
     uint32_t dummyStorage[4];
     SysCtlPeripheralDisable(SYSCTL_PERIPH_UDMA);  // clear previous ADC setup
     ADCIntClear(ADC0_BASE, 1);
     ADCIntClear(ADC1_BASE, 1);
     ADCSequenceStepConfigure(ADC0_BASE, 1, 3, ADC_CTL_CH0);
     ADCSequenceStepConfigure(ADC1_BASE, 1, 3, ADC_CTL_CH0);
     ADCProcessorTrigger(ADC0_BASE, 1);
     ADCProcessorTrigger(ADC1_BASE, 1);
     ADCSequenceConfigure(ADC0_BASE, 1, ADC_TRIGGER_PROCESSOR, 0);
     ADCSequenceConfigure(ADC1_BASE, 1, ADC_TRIGGER_PROCESSOR, 0);
     ADCPhaseDelaySet(ADC1_BASE, ADC_PHASE_0);
     ADCSequenceDataGet(ADC0_BASE, 1, dummyStorage);
     ADCSequenceDataGet(ADC1_BASE, 1, dummyStorage);
Afterwards I try to change setup to:
ADCSequenceStepConfigure(ADC1_BASE, 0, 0, ainPort | ADC_CTL_END | ADC_CTL_IE);
ADCSequenceEnable(ADC1_BASE, 0);                                                                  // enable ADC sequencer
ADCIntClear(ADC1_BASE, 0);
ADCSequenceConfigure(ADC1_BASE, 0, ADC_TRIGGER_PROCESSOR, 0);
ADCProcessorTrigger(ADC1_BASE, 0);
while (!ADCIntStatus(ADC1_BASE, 0, false)) { }
ADCSequenceDataGet(ADC1_BASE, 0, &adcVoltage);
return adcVoltage;

but this hangs up in the while loop.

  • Hello Anthony

    Can you please attach the full code?
  • Anthony Levine1 said:

    2MHz setup:

         ADCSequenceDisable(ADC1_BASE, 1);
         ADCSequenceDisable(ADC0_BASE, 1);
         IntDisable(INT_ADC1SS1);
         IntDisable(INT_ADC0SS1);
         uDMAChannelDisable(UDMA_CH15_ADC0_1);
         uDMAChannelDisable(UDMA_CH25_ADC1_1);
         uint32_t dummyStorage[4];
         SysCtlPeripheralDisable(SYSCTL_PERIPH_UDMA);  // clear previous ADC setup
         ADCIntClear(ADC0_BASE, 1);
         ADCIntClear(ADC1_BASE, 1);
         ADCSequenceStepConfigure(ADC0_BASE, 1, 3, ADC_CTL_CH0);
         ADCSequenceStepConfigure(ADC1_BASE, 1, 3, ADC_CTL_CH0);
         ADCProcessorTrigger(ADC0_BASE, 1);
         ADCProcessorTrigger(ADC1_BASE, 1);
         ADCSequenceConfigure(ADC0_BASE, 1, ADC_TRIGGER_PROCESSOR, 0);
         ADCSequenceConfigure(ADC1_BASE, 1, ADC_TRIGGER_PROCESSOR, 0);
         ADCPhaseDelaySet(ADC1_BASE, ADC_PHASE_0);
         ADCSequenceDataGet(ADC0_BASE, 1, dummyStorage);
         ADCSequenceDataGet(ADC1_BASE, 1, dummyStorage);

    Kindly note the top 2 lines (in highlight.)

    Does your "2MHz, Automatic Sampling" code block function properly (i.e. w/out (ever) calling, "ADCSequenceEnable()?")      (no such call(s) appear - your (top) presented code block!)

    As to Part Deux (your "hanging w/in while") your code function sequences are different than my firm's (and vendor code examples) - is that wise?

    Note too - as Amit has asked - never do you present your, "GPIOPinConfig() nor GPIOPinType()" yet both are required.   (we are thus forced to believe/hope - that you got them right.)

    Presented (below) an ADC sequence - in compliance w/vendor code examples - which "works for us" - when deployed to our LX4F231 MCU board.

    ADCSequenceDisable()    // Note you (properly) employed this atop your "upper" code block - then ignored its use w/in the bottom (hanging) one.   ALWAYS wise to "disable" prior to "Config!"

    ADCSequenceConfigure()

    ADCSequenceStepConfigure()

    ADCSequenceEnable()

    ADCIntClear()

    now arrives a program loop - intended to provide continuous ADC conversions:

    ADCProcessorTrigger()

    while (!ADCIntStatus(ADC1_BASE, 0, false)) { }    // exactly as you had it!

    ADCIntClear()

    ADCSequenceDataGet()

    Again - we note NO Hang!