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.

EK-TM4C123GXL: Tivaware ADC API Comparator Interrupt with TIRTOS

Part Number: EK-TM4C123GXL

I wonder if the interrupts triggered by the ADC digital comparator work on TIRTOS or there any incompatibility?

If so? There is any example?


I ve been reading other subject related threads and trying code but without success. Actually there are lots of people with the same problem as me. To trigger an interrupt if the voltage of the channel goes out of the region set by the comparator. But I didnt see anything TIRTOS related..

COuld someone help me on this matter?

Thank you so much in advance,

NTC

  • Hi,

      TI-RTOS for TM4C does not have drivers for ADC and comparator. Please refer to the supported TI-RTOS drivers for Tiva in this link. https://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/tirtos/2_14_04_31/exports/tirtos_full_2_14_04_31/docs/doxygen/html/index.html. You will need to use the native TivaWare ADC API in TI-RTOS. 

      We don't have examples for ADC running in TI-RTOS environments. The bare-metal ADC examples can be found C:\ti\TivaWare_C_Series-2.2.0.295\examples\peripherals\adc. 

      Below is an example code for using Timer2 module. As you can see, it uses Hwi_create() to manage the interrupt for Timer2 module where Timer2 is mapped to interrupt vector 39. You will do something similar for ADC where it is mapped to 30 for ADC0 Sample Sequencer 0. Refer to the datasheet for details on where each interrupt vector is associated with. 

    myHwi = Hwi_create(39, (Hwi_FuncPtr)ledToggle, &hwiParams, &eb);
    if (myHwi == NULL) {
    System_abort("Hwi create failed");
    }
    Hwi_enableInterrupt(39);


    //----------------------------------------
    // BIOS header files
    //----------------------------------------
    #include <xdc/std.h>  						//mandatory - have to include first, for BIOS types
    #include <ti/sysbios/BIOS.h> 				//mandatory - if you call APIs like BIOS_start()
    #include <xdc/runtime/Log.h>				//needed for any Log_info() call
    #include <xdc/cfg/global.h> 				//header file for statically defined objects/handles
    #include <xdc/runtime/System.h>
    #include <xdc/runtime/Error.h>
    #include <ti/sysbios/hal/Hwi.h>
    
    
    //------------------------------------------
    // TivaWare Header Files
    //------------------------------------------
    #include <stdint.h>
    #include <stdbool.h>
    
    #include "inc/hw_types.h"
    #include "inc/hw_memmap.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/gpio.h"
    #include "inc/hw_ints.h"
    #include "driverlib/interrupt.h"
    #include "driverlib/timer.h"
    
    
    //----------------------------------------
    // Prototypes
    //----------------------------------------
    void hardware_init(void);
    void ledToggle(void);
    
    
    //---------------------------------------
    // Globals
    //---------------------------------------
    volatile int16_t i16ToggleCount = 0;
    
    
    //---------------------------------------------------------------------------
    // main()
    //---------------------------------------------------------------------------
    void main(void)
    {
    
        hardware_init();                         // init hardware via Xware
    
        Hwi_Params hwiParams;
        Hwi_Handle myHwi;
        Error_Block eb;
        /* Initialize error block and hwiParams to default values */
        Error_init(&eb);
        Hwi_Params_init(&hwiParams);
        hwiParams.enableInt = FALSE;
        myHwi = Hwi_create(39, (Hwi_FuncPtr)ledToggle, &hwiParams, &eb);
        if (myHwi == NULL) {
        System_abort("Hwi create failed");
        }
        Hwi_enableInterrupt(39);
    
    
       BIOS_start();
    
    }
    
    
    //---------------------------------------------------------------------------
    // hardware_init()
    //
    // inits GPIO pins for toggling the LED
    //---------------------------------------------------------------------------
    void hardware_init(void)
    {
    	uint32_t ui32Period;
    
    	//Set CPU Clock to 40MHz. 400MHz PLL/2 = 200 DIV 5 = 40MHz
    	SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
    
    	// ADD Tiva-C GPIO setup - enables port, sets pins 1-3 (RGB) pins for output
    	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
    	GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);
    
    	// Turn on the LED
    	GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, 4);
    
    	// Timer 2 setup code
    	SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER2);			// enable Timer 2 periph clks
    	TimerConfigure(TIMER2_BASE, TIMER_CFG_PERIODIC);		// cfg Timer 2 mode - periodic
    
    	ui32Period = (SysCtlClockGet() /2);						// period = CPU clk div 2 (500ms)
    	TimerLoadSet(TIMER2_BASE, TIMER_A, ui32Period);			// set Timer 2 period
    
    	TimerIntEnable(TIMER2_BASE, TIMER_TIMA_TIMEOUT);		// enables Timer 2 to interrupt CPU
    
    	TimerEnable(TIMER2_BASE, TIMER_A);						// enable Timer 2
    
    }
    
    
    //---------------------------------------------------------------------------
    // ledToggle()
    //
    // toggles LED on Tiva-C LaunchPad
    //---------------------------------------------------------------------------
    void ledToggle(void)
    {
        TimerIntClear(TIMER2_BASE, TIMER_TIMA_TIMEOUT);			// must clear timer flag FROM timer
    
    	// LED values - 2=RED, 4=BLUE, 8=GREEN
    	if(GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_2))
    	{
    		GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, 0);
    	}
    	else
    	{
    		GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 4);
    	}
    
    	i16ToggleCount += 1;									// keep track of #toggles
    
    	Log_info1("LED TOGGLED [%u] TIMES",i16ToggleCount);		// send toggle count to UIA
    
    }

  • Thank you .

    I manage to blink the LED with your code.
    I ve searching the datasheet from TIVAWARE but did not find the "details on where each interrupt vector is associated with".

    Although I managed to find it in file hw_ints.h  :



    But I am confused.

    When you set up TIMER2A, interrupt nº 39 runs because it is associated with it.

    I seen some other threads where I got some ideas and tried but without success generating the interrupt. LINK

    Setup :

    void ADC0Seq0IntHandler(void){
        //
        // Read the digital comparator interrupt status register.  This global
        // variable will keep track of which digital comparator triggered the
        // interrupt.
        //
        UART_SEND("ADC INTERRUPT",0);
        GPIO_toggle(Board_LED1);  //just for debug
        g_ulDCIntStatus = ADCComparatorIntStatus(ADC0_BASE);
    
        //
        // Clear all of the digital comparator interrupt bits.  We do this because
        // more than one digital comparator interrupt may have been triggered this
        // interrupt.
        //
        ADCComparatorIntClear(ADC0_BASE, 0x0F);
        TimerIntClear(TIMER2_BASE, TIMER_TIMA_TIMEOUT);         // must clear timer flag FROM timer
    
    
    }
    void ADC_Config(void){
    
        UART_SEND("ADC CONFIG Start",0);
        //Peripheral CONFIGS
        SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
    
        while(!SysCtlPeripheralReady(SYSCTL_PERIPH_ADC0))
        {
        }
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
        GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_3);
    
    
    
    
    
    
        //ADC CONFIGS
        ADCClockConfigSet(ADC0_BASE, ADC_CLOCK_SRC_PIOSC | ADC_CLOCK_RATE_HALF, 2);
        ADCReferenceSet(ADC0_BASE, ADC_REF_EXT_3V);
    
        ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_TIMER, 0);
    
    
        ADCSequenceStepConfigure(ADC0_BASE, 0, 0, ADC_CTL_CH0 | ADC_CTL_CMP0);
        ADCSequenceStepConfigure(ADC0_BASE, 0, 0,ADC_CTL_IE | ADC_CTL_END | ADC_CTL_CH1 | ADC_CTL_CMP0);
        ADCSequenceEnable(ADC0_BASE, 0);
    
        // Reset the ADC comparator
    
        ADCComparatorReset(ADC0_BASE, ADC_CTL_CMP0, true, true);
        //ADCComparatorIntClear(ADC0_BASE, 0);
    
            // Configure the ADC comparator
        ADCComparatorConfigure(ADC0_BASE, 0, ADC_COMP_INT_HIGH_ALWAYS);
        ADCComparatorRegionSet(ADC0_BASE, 0, 1024, 2000); // High threshold = 1.6V
    
    
    
        // Register the interrupt handler
    
        ADCIntRegister(ADC0_BASE, 0, ADC0Seq0IntHandler);
        ADCIntEnable(ADC0_BASE, 0);
        ADCComparatorIntEnable(ADC0_BASE, 0);
        //NVIC CONFIGS
        IntEnable(INT_ADC0SS0);
    
        IntMasterEnable();
    
        UART_SEND("ADC CONFIG END",0);
    }
    
    
    void hardware_init(void)
    {
        uint32_t ui32Period;
     //SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN); // tasks wont start if uncommented
        // Timer 2 setup code
        SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER2);           // enable Timer 2 periph clks
        TimerConfigure(TIMER2_BASE, TIMER_CFG_PERIODIC);        // cfg Timer 2 mode - periodic
    
        ui32Period = (SysCtlClockGet()/4);                     // period = CPU clk div 2 (500ms)
        TimerLoadSet(TIMER2_BASE, TIMER_B, ui32Period);         // set Timer 2 period
    
        TimerIntEnable(TIMER2_BASE, TIMER_TIMB_TIMEOUT);        // enables Timer 2 to interrupt CPU
    
        TimerEnable(TIMER2_BASE, TIMER_B);                      // enable Timer 2
    
    }


  • I tested by changing the voltage from 1.3V to 1.8V, and I expected to see the interrupt print or the LED toggle but something is wrong.

  • ADCIntRegister(ADC0_BASE, 0, ADC0Seq0IntHandler);
    ADCIntEnable(ADC0_BASE, 0);
    ADCComparatorIntEnable(ADC0_BASE, 0);
    //NVIC CONFIGS
    IntEnable(INT_ADC0SS0);
    IntMasterEnable();

    Are these calls the same as ??

        Hwi_Params hwiParams;
        Hwi_Handle myHwi;
        Error_Block eb;
        /* Initialize error block and hwiParams to default values */
        Error_init(&eb);
        Hwi_Params_init(&hwiParams);
        hwiParams.enableInt = FALSE;
        myHwi = Hwi_create(39, (Hwi_FuncPtr)ledToggle1, &hwiParams, &eb);
        if (myHwi == NULL) {
        System_abort("Hwi create failed");
        }
        Hwi_enableInterrupt(39);

  • But I am confused.

    When you set up TIMER2A, interrupt nº 39 runs because it is associated with it.

    This is documented in the device datasheet in the table titled 'Interrupts'. See below. Timer2A is mapped to vector 39. If you want to use ADC0 Sequencer 0 then it is mapped to vector 30. 

  • OK, but then how can I make a timer to trigger the ADCComparator? Calling 

    ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_TIMER, 0);

    ADCSequenceStepConfigure(ADC0_BASE, 0, 0, ADC_CTL_CH0 | ADC_CTL_CMP0);
    ADCSequenceStepConfigure(ADC0_BASE, 0, 0,ADC_CTL_IE | ADC_CTL_END | ADC_CTL_CH1 | ADC_CTL_CMP0);
    ADCSequenceEnable(ADC0_BASE, 0);

    I setup the sequence to with the comparator and to be triggered by the timer.
    In TIVAWARE datasheet they even reffer calling TimerControlTrigger(TIMER2_BASE,TIMER_B,true); which I did. But it still doesnt work..

    Also, I call the ADC_Config inside of one of the TIRTOS tasks. Could that be a problem?

  • ADCSequenceStepConfigure(ADC0_BASE, 0, 0, ADC_CTL_CH0 | ADC_CTL_CMP0);
    ADCSequenceStepConfigure(ADC0_BASE, 0, 0,ADC_CTL_IE | ADC_CTL_END | ADC_CTL_CH1 | ADC_CTL_CMP0);

    I'm not clear why you are sending both ADC_CTL_CH0  and ADC_CTL_CH1 to the comparator ADC_CTL_CMP0? You can specify each comparator (e.g.  ADC_CTL_CMP0) with its lower and upper bound thresholds. In another word, if you only have only one input channel like ADC_CTL_CH0 and you want to check if it is within the bound then you just need to use one comparator like ADC_CTL_CMP0. Use ADCComparatorRegionSet() to specify the lower and upper bounds for ADC_CTL_CMP0. 

    You also have a very basic mistake with the below line. In the below line you specify step 0 again which is the same as the line above. 

    ADCSequenceStepConfigure(ADC0_BASE, 0, 0,ADC_CTL_IE | ADC_CTL_END | ADC_CTL_CH1 | ADC_CTL_CMP0); 

    If you really have two channels to sample then the second sample would have looked something like below. 

    ADCSequenceStepConfigure(ADC0_BASE, 0, 1, ADC_CTL_IE | ADC_CTL_END | ADC_CTL_CH1 ); // Excluding the comparator for simplification. 

    I strongly suggest you start with a simple ADC sampling for one channel and generate interrupt within TI-RTOS before you include additional features like the comparator and the Timer trigger. Get the most basic to work will lead you to the success much quicker. Once you get the basic ADC interrupt mode to work then add the timer trigger. After that it is working, then add the comparator. When you begin with all the features, it is hard to diagnose what the problem is. 

  • "I'm not clear why you are sending both ADC_CTL_CH0  and ADC_CTL_CH1 to the comparator ADC_CTL_CMP0? You can specify each comparator (e.g.  ADC_CTL_CMP0) with its lower and upper bound thresholds. In another word, if you only have only one input channel like ADC_CTL_CH0 and you want to check if it is within the bound then you just need to use one comparator like ADC_CTL_CMP0. Use ADCComparatorRegionSet() to specify the lower and upper bounds for ADC_CTL_CMP0. "


    This is because in this Discussion --> LINK it they say we must have a dummy sequence step.

  • "I strongly suggest you start with a simple ADC sampling for one channel and generate interrupt within TI-RTOS before you include additional features like the comparator and the Timer trigger. Get the most basic to work will lead you to the success much quicker. Once you get the basic ADC interrupt mode to work then add the timer trigger. After that it is working, then add the comparator. When you begin with all the features, it is hard to diagnose what the problem is. "

    Read the ADC values I already managed to do that. Because, when I configure the ADC with ADC_TRIGGER_PROCESSOR, it works by calling the following code. When I configure it with the ADC_TRIGGER_TIMER that where is the problem.



  • "You also have a very basic mistake with the below line. In the below line you specify step 0 again which is the same as the line above. "

    Yes!! thank you!

  • Revisioned code. I see the LED toggle once. And then i guess the program goes to some sort of error exception.
    I guess it has to do with the interrupt clearing..

    void ADC0Seq0IntHandler(void){
        //
        // Read the digital comparator interrupt status register.  This global
        // variable will keep track of which digital comparator triggered the
        // interrupt.
        //
        // UART_SEND("ADC INTERRUPT",0);
        GPIO_toggle(Board_LED1);  //just for debug
        //g_ulDCIntStatus = ADCComparatorIntStatus(ADC0_BASE);
    
        //
        // Clear all of the digital comparator interrupt bits.  We do this because
        // more than one digital comparator interrupt may have been triggered this
        // interrupt.
        //
        ADCComparatorIntClear(ADC0_BASE, 0x00010001);
       TimerIntClear(TIMER2_BASE, TIMER_TIMA_TIMEOUT);         // must clear timer flag FROM timer
        ADCIntClear(ADC0_BASE,0x00010001);
    
    }

    void ADC_Config(void){
    
        UART_SEND("ADC CONFIG Start",0);
        //Peripheral CONFIGS
        SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
    
        while(!SysCtlPeripheralReady(SYSCTL_PERIPH_ADC0))
        {
        }
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
        GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_3);
    
    
    
    
    
    
        //ADC CONFIGS
        ADCClockConfigSet(ADC0_BASE, ADC_CLOCK_SRC_PIOSC | ADC_CLOCK_RATE_HALF, 2);
        ADCReferenceSet(ADC0_BASE, ADC_REF_EXT_3V);
    
        ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_TIMER, 0);
    
    
        ADCSequenceStepConfigure(ADC0_BASE, 0, 0, ADC_CTL_IE | ADC_CTL_CH0 | ADC_CTL_CMP0);
        ADCSequenceStepConfigure(ADC0_BASE, 0, 1, ADC_CTL_IE | ADC_CTL_END | ADC_CTL_CH1 | ADC_CTL_CMP0);
        ADCSequenceEnable(ADC0_BASE, 0); //ADCBASE , SquenceNO
    
        // Reset the ADC comparator
    
        ADCComparatorReset(ADC0_BASE, 0, true, true);
        //ADCComparatorIntClear(ADC0_BASE, 0);
    
            // Configure the ADC comparator
        ADCComparatorConfigure(ADC0_BASE, 0, ADC_COMP_INT_HIGH_ALWAYS);
        ADCComparatorRegionSet(ADC0_BASE, 0, 1024, 2000); // High threshold = 1.6V
    
        uint32_t status;
        status = ADCIntStatusEx(ADC0_BASE,true);
    
        UART_SEND("ADC STATUS ",status);
    
        // Register the interrupt handler
        //ADC_INT_DCON_SS0
        //ADCIntEnableEx(ADC0_BASE,ADC_INT_DCON_SS0);
        ADCIntRegister(ADC0_BASE, 0, ADC0Seq0IntHandler);
        ADCIntEnable(ADC0_BASE, 0);
        ADCComparatorIntEnable(ADC0_BASE, 0);
        //NVIC CONFIGS
        IntEnable(INT_ADC0SS0_TM4C123);
    
        IntMasterEnable();
    
        UART_SEND("ADC CONFIG END",0);
    }

  • Apparently after going trough the debug, the interrupt occurs repeatedly. So it clearly something to do with the clearing.

    Or region config...

  • Ok sorry for the SPAM.

    UPDATE : The ADC interrupt is triggered and occurs in the expected time set by the TIMER.

    But I only want it to occur when the comparator tells it to. I tryied to use ADCIntDisableEx(ADC0_BASE,ADC_INT_SS0); So it disables the interrupt associated to the sequencer. But no success.

    Here is the code :

    void ADC0Seq0IntHandler(void){
        //
        // Read the digital comparator interrupt status register.  This global
        // variable will keep track of which digital comparator triggered the
        // interrupt.
        //
        // UART_SEND("ADC INTERRUPT",0);
        GPIO_toggle(Board_LED1);  //just for debug
        //g_ulDCIntStatus = ADCComparatorIntStatus(ADC0_BASE);
    
        //
        // Clear all of the digital comparator interrupt bits.  We do this because
        // more than one digital comparator interrupt may have been triggered this
        // interrupt.
        //
        ADCComparatorIntClear(ADC0_BASE, 0xffff);
       TimerIntClear(TIMER2_BASE, TIMER_TIMA_TIMEOUT);         // must clear timer flag FROM timer
        ADCIntClear(ADC0_BASE,0);
    
    }
    void ADC_Config(void){
    
        UART_SEND("ADC CONFIG Start",0);
        //Peripheral CONFIGS
        SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
    
        while(!SysCtlPeripheralReady(SYSCTL_PERIPH_ADC0))
        {
        }
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
        GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_3);
    
    
    
    
    
    
        //ADC CONFIGS
        ADCClockConfigSet(ADC0_BASE, ADC_CLOCK_SRC_PIOSC | ADC_CLOCK_RATE_HALF, 2);
        ADCReferenceSet(ADC0_BASE, ADC_REF_EXT_3V);
    
        ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_TIMER, 0);
    
    
        ADCSequenceStepConfigure(ADC0_BASE, 0, 0, ADC_CTL_IE | ADC_CTL_CH0 | ADC_CTL_CMP0);
        ADCSequenceStepConfigure(ADC0_BASE, 0, 1, ADC_CTL_END | ADC_CTL_CH1 );
        ADCSequenceEnable(ADC0_BASE, 0); //ADCBASE , SquenceNO
    
        // Reset the ADC comparator
    
    //    ADCComparatorReset(ADC0_BASE, 0, true, true);
    //    //ADCComparatorIntClear(ADC0_BASE, 0);
    //
    //        // Configure the ADC comparator
        ADCComparatorConfigure(ADC0_BASE, 0, ADC_COMP_TRIG_NONE | ADC_COMP_INT_HIGH_ALWAYS);
        ADCComparatorRegionSet(ADC0_BASE, 0, 1024, 2000); // High threshold = 1.6V
    
    //    uint32_t status;
    //    status = ADCIntStatusEx(ADC0_BASE,true);
    //
    //    UART_SEND("ADC STATUS ",status);
    
        // Register the interrupt handler
        //ADC_INT_DCON_SS0
        ADCIntDisableEx(ADC0_BASE,ADC_INT_SS0);
        ADCIntRegister(ADC0_BASE, 0, ADC0Seq0IntHandler);
        ADCIntEnable(ADC0_BASE, 0);
    //    ADCComparatorIntEnable(ADC0_BASE, 0);
        //NVIC CONFIGS
        IntEnable(INT_ADC0SS0_TM4C123);
    
        IntMasterEnable();
    
        UART_SEND("ADC CONFIG END",0);
    }
    
    
    void hardware_init(void)
    {
        uint32_t ui32Period;
    
        //Set CPU Clock to 40MHz. 400MHz PLL/2 = 200 DIV 5 = 40MHz
        //SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
    
        // ADD Tiva-C GPIO setup - enables port, sets pins 1-3 (RGB) pins for output
    
    
    
    
        // Timer 2 setup code
        SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER2);           // enable Timer 2 periph clks
        TimerConfigure(TIMER2_BASE, TIMER_CFG_PERIODIC);        // cfg Timer 2 mode - periodic
    
        ui32Period = (SysCtlClockGet());                     // period = CPU clk div 2 (500ms)
        TimerLoadSet(TIMER2_BASE, TIMER_A, ui32Period);         // set Timer 2 period
    
        TimerControlTrigger(TIMER2_BASE,TIMER_A,true);            //enable HW timer to trigger ADC
    //    TimerIntEnable(TIMER2_BASE, TIMER_TIMA_TIMEOUT);        // enables Timer 2 to interrupt CPU
    
        TimerEnable(TIMER2_BASE, TIMER_A);                      // enable Timer 2
    
    }

  • I see some issues. Your updated code has the below two lines:

    ADCSequenceStepConfigure(ADC0_BASE, 0, 0, ADC_CTL_IE | ADC_CTL_CH0 | ADC_CTL_CMP0);
    ADCSequenceStepConfigure(ADC0_BASE, 0, 1, ADC_CTL_IE | ADC_CTL_END | ADC_CTL_CH1 | ADC_CTL_CMP0);

    You enable each step with an interrupt. Normally, you would only enable interrupt on the last step in the group, not on every sample. 

    But I only want it to occur when the comparator tells it to. I

    The above two lines of code will generate an interrupt on each sample conversion no matter if the conversion value is within the comparator range or not. Why don't you remove ADC_CTL_IE if you only want the interrupt to generate when it is out of bound. 

    I will suggest you also look at the registers in CCS Register Browser window when you enter ADC0Seq0IntHandler() and find out which flags are set and if you clear them correctly. 

  • void ADC0_Config(void){
    
        UART_Debug("ADC1 CONFIG Start",0);
        //Peripheral CONFIGS
    
        SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
    
        while(!SysCtlPeripheralReady(SYSCTL_PERIPH_ADC0))
        {
        }
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
        GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_3);
        GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_2);
    
    //ADC CONFIGS
        ADCClockConfigSet(ADC0_BASE, ADC_CLOCK_SRC_PIOSC | ADC_CLOCK_RATE_HALF, 2);
        ADCReferenceSet(ADC0_BASE, ADC_REF_EXT_3V);
        ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_TIMER, 0);
    
        ADCSequenceStepConfigure(ADC0_BASE, 0, 0, ADC_CTL_CH1 |ADC_CTL_SHOLD_8 );
        ADCSequenceStepConfigure(ADC0_BASE, 0, 1,  ADC_CTL_CH1 |ADC_CTL_CMP0 | ADC_CTL_SHOLD_8); // needs these 2 extra steps
        ADCSequenceStepConfigure(ADC0_BASE, 0, 2,  ADC_CTL_END | ADC_CTL_CH1 | ADC_CTL_IE );
        ADCSequenceEnable(ADC0_BASE, 0); //ADCBASE , SquenceNO
    
    // Configure the ADC comparator
        ADCComparatorConfigure(ADC0_BASE, 0, ADC_COMP_TRIG_NONE | ADC_COMP_INT_LOW_ONCE );  //ADC_COMP_INT_HIGH_ONCE
        ADCComparatorRegionSet(ADC0_BASE, 0, 1700, 2000); //LOW = 1.36V  High threshold = 1.6V
        ADCComparatorReset(ADC0_BASE, 0, true, true);
    // Interrupt enables
        ADCComparatorIntEnable(ADC0_BASE, 0);
        ADCIntRegister(ADC0_BASE, 0, ADC0Seq0IntHandler);
        //ADCIntEnable(ADC0_BASE, 0);
    
    //NVIC CONFIGS
        IntEnable(INT_ADC0SS0_TM4C123);
        IntMasterEnable();
    
        UART_Debug("ADC CONFIG END",0);
    }
    
    
    void ADC0Seq0IntHandler(void){
    
        GPIO_toggle(Board_LED1);  //just for debug
        // Clear all of the digital comparator interrupt bits.  We do this because
        // more than one digital comparator interrupt may have been triggered this
        // interrupt.
    
    
        ADCComparatorIntClear(ADC0_BASE, 0x000f000f);
        //TimerIntClear(TIMER2_BASE, TIMER_TIMA_TIMEOUT);         // must clear timer flag FROM timer
        ADCIntClear(ADC0_BASE,0);
        //ADCComparatorReset(ADC0_BASE,0,false,true);           //TODO: use after sending the flag to main
        ADC_FLAG_1=0x01;
    
    
    
    //    ADCSequenceDataGet(ADC0_BASE, 0, ui32Value2);
    //    ADC_Convert_Values();
    
    }

    This worked for me. Thank you  for your time and help. Here is the final code for others that may find it helpful.
    Thank you