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.

TM4C123G Launchpad - second ADC never interrupts

Other Parts Discussed in Thread: EK-TM4C123GXL

Since I've had excellent support from the forum in the past I thought I would try again. Kind thanks, all. 

I am working with the above launchpad board initially and am trying to set up two sequencers to do identical work however I want to use the second ADC (ie ADC1) to convert the last pair of four channels. I realise on the Launchpad board, ADC Ch3 is not brought out to a pin but that's not important to me in developing code. 

// Enable the ADCs internally 
    SysCtlPeripheralEnable( SYSCTL_PERIPH_ADC0 );        
    SysCtlPeripheralEnable( SYSCTL_PERIPH_ADC1 );
    
    #ifdef LAUNCHPAD
    //Enable Pin inputs
    SysCtlPeripheralEnable( SYSCTL_PERIPH_GPIOE );
    GPIOPinTypeADC( GPIO_PORTE_BASE, GPIO_PIN_3 | GPIO_PIN_2 | GPIO_PIN_1 | GPIO_PIN_0 );
    #else
    // for our board
    #endif
    
    // Enable the first sample sequencer to capture the value of channel 0 when
    // the processor trigger occurs.
    ADCSequenceDisable( ADC0_BASE, SEQ1 );
    ADCSequenceConfigure( ADC0_BASE, SEQ1, ADC_TRIGGER_ALWAYS, PRIORITY1 );
    ADCSequenceStepConfigure( ADC0_BASE, SEQ1, STEP0, ADC_CTL_CH0 );
    ADCSequenceStepConfigure( ADC0_BASE, SEQ1, STEP1, ADC_CTL_CH1 | ADC_CTL_IE | ADC_CTL_END );

    // And do the same for the second sequencer
    ADCSequenceDisable( ADC1_BASE, SEQ2 );
    ADCSequenceConfigure( ADC1_BASE, SEQ2, ADC_TRIGGER_ALWAYS, PRIORITY0 );
    ADCSequenceStepConfigure( ADC1_BASE, SEQ2, STEP0, ADC_CTL_CH2 );
    ADCSequenceStepConfigure( ADC1_BASE, SEQ2, STEP1, ADC_CTL_CH3 | ADC_CTL_IE | ADC_CTL_END );

    //setup interrupts
    ADCIntRegister(ADC0_BASE, SEQ1, ADCinterruptSequencer1);
    ADCIntRegister(ADC1_BASE, SEQ2, ADCinterruptSequencer2);
    
    ADCIntClear(ADC0_BASE, SEQ1);
    ADCIntClear(ADC1_BASE, SEQ2);
    
    ADCIntEnable(ADC0_BASE, SEQ1);
    ADCIntEnable(ADC1_BASE, SEQ2);
}

What I have done is a complete carbon copy of the working code seen above for ADC0. However, the interrupt is never called (ie the interrupt routine is never entered, so I have not bothered to include it here). 

Perhaps someone has some initial thoughts where I may be going wrong or if ADC1 requires special configuration that ADC0 does not. 

Thanks in advance

  • Hi,

    One frequent mistake is not updating/modifying the interrupt vector in startup_xxx.c file to contain the exact name of ADC1 interrupt routine instead of IntDefaultHandler. Can you verify?

    Petrei

  • Hello Andrew,

    The IntMasterEnable function call needs to be called. Also it is not clear what the value of SEQ1 and SEQ2 are. Can you please specify the value of the defines

    Regards

    Amit

  • Morning all,

    Thanks for the comments. Just to clarify that SEQ1 and SEQ2 define as 1 and 2 (they just remove the magic numbers from the functions with many arguments). The same goes for STEP0 and above.

    Also to be clear, ADC0 (and also a UART0 configured separately) are working fine. Its just ADC1 which never interrupts. 

    I have already tried IntMasterEnable() but it has no effect on ADC1 (or UART0 and ADC0) interrupts. 

    The line used to start the conversion is:

    // begin ADCs after they have been configured
    void StartConversions ( void )
    {
        ADCSequenceEnable( ADC0_BASE, SEQ1 );
        ADCSequenceEnable( ADC1_BASE, SEQ2 );
        //initialise the index into the store buffer
        g_Sequ1WriteIdx = 0;
        g_Sequ2WriteIdx = 0;
    }

    Thanks for all your comments so far however. 

     

  • Hello Andrew,

    Did you try ADC1 in standalone just the way for ADC0 and UART0?

    Regards

    Amit

  • Hello, 

    Trying the ADC using a manual processor trigger, the sequencer still returns zero for each configured channel unfortunately.

  • Hello Andrew,

    This looks a bit serious. Can you send the TM4C device part number on which you are doing the same, and I will reconstruct a code for you to be able to use ADC-1 Interrupts

    Regards

    Amit

  • Kind thanks,

    I am currently working on an EK-TM4C123GXL board (Lot No. HD1311003) which has a TM4C123GH6PMI part on board. 

    I'm working in Keil with the version of Tivaware currently on the website. 

  • Hello Andrew

    What I did was take the existing code example and modify it for your case. The first thing to do is to put a break point on the while loop for ADCIntStatus and run the code.

    //*****************************************************************************
    //
    // single_ended.c - Example demonstrating how to configure the ADC for
    //                  single ended operation.
    //
    // Copyright (c) 2010-2014 Texas Instruments Incorporated.  All rights reserved.
    // Software License Agreement
    // 
    //   Redistribution and use in source and binary forms, with or without
    //   modification, are permitted provided that the following conditions
    //   are met:
    // 
    //   Redistributions of source code must retain the above copyright
    //   notice, this list of conditions and the following disclaimer.
    // 
    //   Redistributions in binary form must reproduce the above copyright
    //   notice, this list of conditions and the following disclaimer in the
    //   documentation and/or other materials provided with the  
    //   distribution.
    // 
    //   Neither the name of Texas Instruments Incorporated nor the names of
    //   its contributors may be used to endorse or promote products derived
    //   from this software without specific prior written permission.
    // 
    // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    // 
    // This is part of revision 2.1.0.12573 of the Tiva Firmware Development Package.
    //
    //*****************************************************************************
    
    #include <stdbool.h>
    #include <stdint.h>
    #include "inc/hw_memmap.h"
    #include "driverlib/adc.h"
    #include "driverlib/gpio.h"
    #include "driverlib/pin_map.h"
    #include "driverlib/sysctl.h"
    
    //*****************************************************************************
    //
    //! \addtogroup adc_examples_list
    //! <h1>Single Ended ADC (single_ended)</h1>
    //!
    //
    //*****************************************************************************
    
    //*****************************************************************************
    //
    // Configure ADC1 for a single-ended input and a single sample.  Once the
    // sample is ready, an interrupt flag will be set.  Using a polling method,
    // the data will be read then displayed on the console via UART0.
    //
    //*****************************************************************************
    int
    main(void)
    {
        //
        // This array is used for storing the data read from the ADC FIFO. It
        // must be as large as the FIFO for the sequencer in use.  This example
        // uses sequence 3 which has a FIFO depth of 1.  If another sequence
        // was used with a deeper FIFO, then the array size must be changed.
        //
        uint32_t pui32ADC1Value[1];
    
        //
        // Set the clocking to run at 20 MHz (200 MHz / 10) using the PLL.  When
        // using the ADC, you must either use the PLL or supply a 16 MHz clock
        // source.
        // TODO: The SYSCTL_XTAL_ value must be changed to match the value of the
        // crystal on your board.
        //
        SysCtlClockSet(SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
                       SYSCTL_XTAL_16MHZ);
    
        //
        // The ADC1 peripheral must be enabled for use.
        //
        SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC1);
    
        //
        // For this example ADC1 is used with AIN0 on port E0 and E1.
        // The actual port and pins used may be different on your part, consult
        // the data sheet for more information.  GPIO port E needs to be enabled
        // so these pins can be used.
        // TODO: change this to whichever GPIO port you are using.
        //
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
    	SysCtlDelay(10);
    
        //
        // Select the analog ADC function for these pins.
        // Consult the data sheet to see which functions are allocated per pin.
        // TODO: change this to select the port/pin you are using.
        //
        GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_0|GPIO_PIN_1);
    
        //
        // Enable sample sequence 3 with a processor signal trigger.  Sequence 3
        // will do a single sample when the processor sends a signal to start the
        // conversion.  Each ADC module has 4 programmable sequences, sequence 0
        // to sequence 3.  This example is arbitrarily using sequence 3.
        //
        ADCSequenceConfigure(ADC1_BASE, 2, ADC_TRIGGER_PROCESSOR, 0);
    
        //
        // Configure step 0 on sequence 3.  Sample channel 0 (ADC_CTL_CH0) in
        // single-ended mode (default) and configure the interrupt flag
        // (ADC_CTL_IE) to be set when the sample is done.  Tell the ADC logic
        // that this is the last conversion on sequence 3 (ADC_CTL_END).  Sequence
        // 3 has only one programmable step.  Sequence 1 and 2 have 4 steps, and
        // sequence 0 has 8 programmable steps.  Since we are only doing a single
        // conversion using sequence 3 we will only configure step 0.  For more
        // information on the ADC sequences and steps, reference the datasheet.
        //
        ADCSequenceStepConfigure(ADC1_BASE, 2, 0, ADC_CTL_CH0);
        ADCSequenceStepConfigure(ADC1_BASE, 2, 1, ADC_CTL_CH0 | ADC_CTL_IE |
                                 ADC_CTL_END);
    
        //
        // Since sample sequence 3 is now configured, it must be enabled.
        //
        ADCSequenceEnable(ADC1_BASE, 2);
    
        //
        // Clear the interrupt status flag.  This is done to make sure the
        // interrupt flag is cleared before we sample.
        //
        ADCIntClear(ADC1_BASE, 2);
    
        //
        // Sample AIN0 forever.  Display the value on the console.
        //
        while(1)
        {
            //
            // Trigger the ADC conversion.
            //
            ADCProcessorTrigger(ADC1_BASE, 2);
    
            //
            // Wait for conversion to be completed.
            //
            while(!ADCIntStatus(ADC1_BASE, 2, false))
            {
            }
    
            //
            // Clear the ADC interrupt flag.
            //
            ADCIntClear(ADC1_BASE, 2);
    
            //
            // Read ADC Value.
            //
            ADCSequenceDataGet(ADC1_BASE, 2, pui32ADC1Value);
    
            //
            // This function provides a means of generating a constant length
            // delay.  The function delay (in cycles) = 3 * parameter.  Delay
            // 250ms arbitrarily.
            //
            SysCtlDelay(SysCtlClockGet() / 12);
        }
    }
    

    This is to establish that ADC1 is working in the first place.

    Once this is done, I would send the code with the ADC1 Interrupt Handler.

    Regards

    Amit

  • Kind thanks for the code. Using that, I do now see conversions on ADC1. I have even tried this at top speed of 80 MHz. 
    I can't actually see any differences in the way I initialise the ADC so far which is interesting. I'll take a closer look now I have a basis to work from in the meantime. 

  • Hello Andrew,

    One thing I was thinking is that ADC1 Interrupt have a lower priority than ADC0 interrupts. In continuous mode it may be a problem, that ADC0 gets serviced all the time, But you can now use the same test as the building block for the main code.

    If required I will send a ADC0 and ADC1 clubbed test with Interrupt to see if the issue is as what I just mentioned above.

    Regards

    Amit

  • Hello,

    I thought that two about the hardware priorities of the interrupts. However, disabling ADC0's interrupts (never starting the sequencer) has no effect so I have still done something wrong somewhere.

    Incidentally, I even tried putting the interrupt (all of them in the end) into the vector table in the startup code but this did not help. I have also tried using different channels (ADC0-3) on ADC1 with the code you have provided to ensure no clashes or unusual behaviour. 

  • Hello Andrew

    So for now the code I provided seems to be working for you. You can use it while I start looking at a dual ADC code, that you can use

    Regards

    Amit

  • Good morning,

    Have you managed to make any progress on this second ADC interrupt yet? I would like to start a new project with this same device where I will absolutely need the second ADC to make simultaneous samples alongside the first. Needless to say I will spend some time looking at this myself also but since neither of us could spot anything wrong in my previous code I am really interested in anything you found. 

    Kindest thanks

    Andrew

  • Hi,

    Did you tried the errata 8.5? maybe it's the case here.

    Also i do not see any justification for trigger always (if sampling a real signal, this could break the concept of uniform sampling…) - try trigger by timer instead.

    Petrei

  • Hello All,

    Forum Post may hold the answer.

    http://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/t/355586.aspx

    Regards

    Amit

  • I'm having the same issue, despite making the fix I mentioned in the linked post. I also found another error in the setting of ADC_TSSEL in the function ADCSequenceConfigure, in which when trying to set it to trigger off any of the PWM1 generators it would instead always configure the sequence to use the PWM0 generators. I still can't get ADC1 to generate any interrupts though.

  • Hello Matthew,

    Did you recompile the driverlib and use the new driverlib.lib as CCS will copy it?

    For the second issue you mentioned for TSSEL what was full Function call?

    Regards

    Amit

  • Hello Matthew

    Attached are the Test and Startup files. I can get both ADC to go to their interrupt handlers.

    //*****************************************************************************
    //
    // single_ended.c - Example demonstrating how to configure the ADC for
    //                  single ended operation.
    //
    // Copyright (c) 2010-2014 Texas Instruments Incorporated.  All rights reserved.
    // Software License Agreement
    //
    //   Redistribution and use in source and binary forms, with or without
    //   modification, are permitted provided that the following conditions
    //   are met:
    //
    //   Redistributions of source code must retain the above copyright
    //   notice, this list of conditions and the following disclaimer.
    //
    //   Redistributions in binary form must reproduce the above copyright
    //   notice, this list of conditions and the following disclaimer in the
    //   documentation and/or other materials provided with the
    //   distribution.
    //
    //   Neither the name of Texas Instruments Incorporated nor the names of
    //   its contributors may be used to endorse or promote products derived
    //   from this software without specific prior written permission.
    //
    // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    //
    // This is part of revision 2.1.0.12573 of the Tiva Firmware Development Package.
    //
    //*****************************************************************************
    
    #include <stdbool.h>
    #include <stdint.h>
    #include "inc/hw_memmap.h"
    #include "driverlib/adc.h"
    #include "driverlib/interrupt.h"
    #include "driverlib/gpio.h"
    #include "driverlib/pin_map.h"
    #include "driverlib/sysctl.h"
    
    uint32_t gui32ADC0Value[2];
    uint32_t gui32ADC1Value[2];
    volatile uint32_t gui32ADCIntDone[2];
    
    //*****************************************************************************
    //
    //! \addtogroup adc_examples_list
    //! <h1>Single Ended ADC (single_ended)</h1>
    //!
    //
    //*****************************************************************************
    void ADC0SS0IntHandler(void)
    {
        ADCIntClear(ADC0_BASE, 0);
    
        //
        // Read ADC Value.
        //
        ADCSequenceDataGet(ADC0_BASE, 0, gui32ADC0Value);
        gui32ADCIntDone[0] = 1;
    
    }
    
    void ADC1SS0IntHandler(void)
    {
        ADCIntClear(ADC1_BASE, 0);
    
        //
        // Read ADC Value.
        //
        ADCSequenceDataGet(ADC1_BASE, 0, gui32ADC1Value);
        gui32ADCIntDone[1] = 1;
    
    }
    //*****************************************************************************
    //
    // Configure ADC1 for a single-ended input and a single sample.  Once the
    // sample is ready, an interrupt flag will be set.  Using a polling method,
    // the data will be read then displayed on the console via UART0.
    //
    //*****************************************************************************
    int
    main(void)
    {
        //
        // Set the clocking to run at 20 MHz (200 MHz / 10) using the PLL.  When
        // using the ADC, you must either use the PLL or supply a 16 MHz clock
        // source.
        // TODO: The SYSCTL_XTAL_ value must be changed to match the value of the
        // crystal on your board.
        //
        SysCtlClockSet(SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
                       SYSCTL_XTAL_16MHZ);
    
        //
        // Clear the Flags
        //
        gui32ADCIntDone[0] = 0;
        gui32ADCIntDone[1] = 0;
    
        //
        // The ADC1 peripheral must be enabled for use.
        //
        SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC1);
    
        //
        // For this example ADC1 is used with AIN0 on port E0 and E1.
        // The actual port and pins used may be different on your part, consult
        // the data sheet for more information.  GPIO port E needs to be enabled
        // so these pins can be used.
        // TODO: change this to whichever GPIO port you are using.
        //
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
    	SysCtlDelay(10);
    
        //
        // Select the analog ADC function for these pins.
        // Consult the data sheet to see which functions are allocated per pin.
        // TODO: change this to select the port/pin you are using.
        //
        GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);
    
        //
        // Enable sample sequence 3 with a processor signal trigger.  Sequence 3
        // will do a single sample when the processor sends a signal to start the
        // conversion.  Each ADC module has 4 programmable sequences, sequence 0
        // to sequence 3.  This example is arbitrarily using sequence 3.
        //
        ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR, 0);
        ADCSequenceConfigure(ADC1_BASE, 0, ADC_TRIGGER_PROCESSOR, 0);
    
        //
        // Configure step 0 on sequence 3.  Sample channel 0 (ADC_CTL_CH0) in
        // single-ended mode (default) and configure the interrupt flag
        // (ADC_CTL_IE) to be set when the sample is done.  Tell the ADC logic
        // that this is the last conversion on sequence 3 (ADC_CTL_END).  Sequence
        // 3 has only one programmable step.  Sequence 1 and 2 have 4 steps, and
        // sequence 0 has 8 programmable steps.  Since we are only doing a single
        // conversion using sequence 3 we will only configure step 0.  For more
        // information on the ADC sequences and steps, reference the datasheet.
        //
        ADCSequenceStepConfigure(ADC0_BASE, 0, 0, ADC_CTL_CH0);
        ADCSequenceStepConfigure(ADC0_BASE, 0, 1, ADC_CTL_CH1 | ADC_CTL_IE |
                                 ADC_CTL_END);
        ADCSequenceStepConfigure(ADC1_BASE, 0, 0, ADC_CTL_CH2);
        ADCSequenceStepConfigure(ADC1_BASE, 0, 1, ADC_CTL_CH3 | ADC_CTL_IE |
                                 ADC_CTL_END);
    
        //
        // Since sample sequence 3 is now configured, it must be enabled.
        //
        ADCSequenceEnable(ADC0_BASE, 0);
        ADCSequenceEnable(ADC1_BASE, 0);
    
        //
        // Clear the interrupt status flag.  This is done to make sure the
        // interrupt flag is cleared before we sample.
        //
        ADCIntClear(ADC0_BASE, 0);
        ADCIntClear(ADC1_BASE, 0);
        ADCIntEnable(ADC0_BASE, 0);
        ADCIntEnable(ADC1_BASE, 0);
    
        //
        // Enable the Interrupt
        //
        IntEnable(30);
        IntEnable(64);
        IntMasterEnable();
    
        //
        // Sample AIN0 forever.  Display the value on the console.
        //
        while(1)
        {
            //
            // Trigger the ADC conversion.
            //
            ADCProcessorTrigger(ADC0_BASE, 0);
            ADCProcessorTrigger(ADC1_BASE, 0);
    
            //
            // Wait for conversion to be completed.
            //
            while((gui32ADCIntDone[0] != 1) && (gui32ADCIntDone[1] != 1))
            {
            }
    
            //
            // Clear the Flags
            //
            gui32ADCIntDone[0] = 0;
            gui32ADCIntDone[1] = 0;
    
            //
            // This function provides a means of generating a constant length
            // delay.  The function delay (in cycles) = 3 * parameter.  Delay
            // 250ms arbitrarily.
            //
            SysCtlDelay(SysCtlClockGet() / 12);
        }
    }
    

    //*****************************************************************************
    //
    // startup_ccs.c - Startup code for use with TI's Code Composer Studio.
    //
    // Copyright (c) 2013-2014 Texas Instruments Incorporated.  All rights reserved.
    // Software License Agreement
    // 
    // Texas Instruments (TI) is supplying this software for use solely and
    // exclusively on TI's microcontroller products. The software is owned by
    // TI and/or its suppliers, and is protected under applicable copyright
    // laws. You may not combine this software with "viral" open-source
    // software in order to form a larger program.
    // 
    // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
    // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
    // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
    // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
    // DAMAGES, FOR ANY REASON WHATSOEVER.
    // 
    // This is part of revision 2.1.0.12573 of the DK-TM4C129X Firmware Package.
    //
    //*****************************************************************************
    
    #include <stdint.h>
    #include "inc/hw_nvic.h"
    #include "inc/hw_types.h"
    
    //*****************************************************************************
    //
    // Forward declaration of the default fault handlers.
    //
    //*****************************************************************************
    void ResetISR(void);
    static void NmiSR(void);
    static void FaultISR(void);
    static void IntDefaultHandler(void);
    
    //*****************************************************************************
    //
    // External declaration for the reset handler that is to be called when the
    // processor is started
    //
    //*****************************************************************************
    extern void _c_int00(void);
    extern void ADC0SS0IntHandler(void);
    extern void ADC1SS0IntHandler(void);
    
    //*****************************************************************************
    //
    // Linker variable that marks the top of the stack.
    //
    //*****************************************************************************
    extern uint32_t __STACK_TOP;
    
    //*****************************************************************************
    //
    // The vector table.  Note that the proper constructs must be placed on this to
    // ensure that it ends up at physical address 0x0000.0000 or at the start of
    // the program if located at a start address other than 0.
    //
    //*****************************************************************************
    #pragma DATA_SECTION(g_pfnVectors, ".intvecs")
    void (* const g_pfnVectors[])(void) =
    {
        (void (*)(void))((uint32_t)&__STACK_TOP),
                                                // The initial stack pointer
        ResetISR,                               // The reset handler
        NmiSR,                                  // The NMI handler
        FaultISR,                               // The hard fault handler
        IntDefaultHandler,                      // The MPU fault handler
        IntDefaultHandler,                      // The bus fault handler
        IntDefaultHandler,                      // The usage fault handler
        0,                                      // Reserved
        0,                                      // Reserved
        0,                                      // Reserved
        0,                                      // Reserved
        IntDefaultHandler,                      // SVCall handler
        IntDefaultHandler,                      // Debug monitor handler
        0,                                      // Reserved
        IntDefaultHandler,                      // The PendSV handler
        IntDefaultHandler,                      // The SysTick handler
        IntDefaultHandler,                      // GPIO Port A
        IntDefaultHandler,                      // GPIO Port B
        IntDefaultHandler,                      // GPIO Port C
        IntDefaultHandler,                      // GPIO Port D
        IntDefaultHandler,                      // GPIO Port E
        IntDefaultHandler,                      // UART0 Rx and Tx
        IntDefaultHandler,                      // UART1 Rx and Tx
        IntDefaultHandler,                      // SSI0 Rx and Tx
        IntDefaultHandler,                      // I2C0 Master and Slave
        IntDefaultHandler,                      // PWM Fault
        IntDefaultHandler,                      // PWM Generator 0
        IntDefaultHandler,                      // PWM Generator 1
        IntDefaultHandler,                      // PWM Generator 2
        IntDefaultHandler,                      // Quadrature Encoder 0
        ADC0SS0IntHandler,                      // ADC Sequence 0
        IntDefaultHandler,                      // ADC Sequence 1
        IntDefaultHandler,                      // ADC Sequence 2
        IntDefaultHandler,                      // ADC Sequence 3
        IntDefaultHandler,                      // Watchdog timer
        IntDefaultHandler,                      // Timer 0 subtimer A
        IntDefaultHandler,                      // Timer 0 subtimer B
        IntDefaultHandler,                      // Timer 1 subtimer A
        IntDefaultHandler,                      // Timer 1 subtimer B
        IntDefaultHandler,                      // Timer 2 subtimer A
        IntDefaultHandler,                      // Timer 2 subtimer B
        IntDefaultHandler,                      // Analog Comparator 0
        IntDefaultHandler,                      // Analog Comparator 1
        IntDefaultHandler,                      // Analog Comparator 2
        IntDefaultHandler,                      // System Control (PLL, OSC, BO)
        IntDefaultHandler,                      // FLASH Control
        IntDefaultHandler,                      // GPIO Port F
        IntDefaultHandler,                      // GPIO Port G
        IntDefaultHandler,                      // GPIO Port H
        IntDefaultHandler,                      // UART2 Rx and Tx
        IntDefaultHandler,                      // SSI1 Rx and Tx
        IntDefaultHandler,                      // Timer 3 subtimer A
        IntDefaultHandler,                      // Timer 3 subtimer B
        IntDefaultHandler,                      // I2C1 Master and Slave
        IntDefaultHandler,                      // Quadrature Encoder 1
        IntDefaultHandler,                      // CAN0
        IntDefaultHandler,                      // CAN1
        0,                                      // Reserved
        0,                                      // Reserved
        IntDefaultHandler,                      // Hibernate
        IntDefaultHandler,                      // USB0
        IntDefaultHandler,                      // PWM Generator 3
        IntDefaultHandler,                      // uDMA Software Transfer
        IntDefaultHandler,                      // uDMA Error
        ADC1SS0IntHandler,                      // ADC1 Sequence 0
        IntDefaultHandler,                      // ADC1 Sequence 1
        IntDefaultHandler,                      // ADC1 Sequence 2
        IntDefaultHandler,                      // ADC1 Sequence 3
        0,                                      // Reserved
        0,                                      // Reserved
        IntDefaultHandler,                      // GPIO Port J
        IntDefaultHandler,                      // GPIO Port K
        IntDefaultHandler,                      // GPIO Port L
        IntDefaultHandler,                      // SSI2 Rx and Tx
        IntDefaultHandler,                      // SSI3 Rx and Tx
        IntDefaultHandler,                      // UART3 Rx and Tx
        IntDefaultHandler,                      // UART4 Rx and Tx
        IntDefaultHandler,                      // UART5 Rx and Tx
        IntDefaultHandler,                      // UART6 Rx and Tx
        IntDefaultHandler,                      // UART7 Rx and Tx
        0,                                      // Reserved
        0,                                      // Reserved
        0,                                      // Reserved
        0,                                      // Reserved
        IntDefaultHandler,                      // I2C2 Master and Slave
        IntDefaultHandler,                      // I2C3 Master and Slave
        IntDefaultHandler,                      // Timer 4 subtimer A
        IntDefaultHandler,                      // Timer 4 subtimer B
        0,                                      // Reserved
        0,                                      // Reserved
        0,                                      // Reserved
        0,                                      // Reserved
        0,                                      // Reserved
        0,                                      // Reserved
        0,                                      // Reserved
        0,                                      // Reserved
        0,                                      // Reserved
        0,                                      // Reserved
        0,                                      // Reserved
        0,                                      // Reserved
        0,                                      // Reserved
        0,                                      // Reserved
        0,                                      // Reserved
        0,                                      // Reserved
        0,                                      // Reserved
        0,                                      // Reserved
        0,                                      // Reserved
        0,                                      // Reserved
        IntDefaultHandler,                      // Timer 5 subtimer A
        IntDefaultHandler,                      // Timer 5 subtimer B
        IntDefaultHandler,                      // Wide Timer 0 subtimer A
        IntDefaultHandler,                      // Wide Timer 0 subtimer B
        IntDefaultHandler,                      // Wide Timer 1 subtimer A
        IntDefaultHandler,                      // Wide Timer 1 subtimer B
        IntDefaultHandler,                      // Wide Timer 2 subtimer A
        IntDefaultHandler,                      // Wide Timer 2 subtimer B
        IntDefaultHandler,                      // Wide Timer 3 subtimer A
        IntDefaultHandler,                      // Wide Timer 3 subtimer B
        IntDefaultHandler,                      // Wide Timer 4 subtimer A
        IntDefaultHandler,                      // Wide Timer 4 subtimer B
        IntDefaultHandler,                      // Wide Timer 5 subtimer A
        IntDefaultHandler,                      // Wide Timer 5 subtimer B
        IntDefaultHandler,                      // FPU
        0,                                      // Reserved
        0,                                      // Reserved
        IntDefaultHandler,                      // I2C4 Master and Slave
        IntDefaultHandler,                      // I2C5 Master and Slave
        IntDefaultHandler,                      // GPIO Port M
        IntDefaultHandler,                      // GPIO Port N
        IntDefaultHandler,                      // Quadrature Encoder 2
        0,                                      // Reserved
        0,                                      // Reserved
        IntDefaultHandler,                      // GPIO Port P (Summary or P0)
        IntDefaultHandler,                      // GPIO Port P1
        IntDefaultHandler,                      // GPIO Port P2
        IntDefaultHandler,                      // GPIO Port P3
        IntDefaultHandler,                      // GPIO Port P4
        IntDefaultHandler,                      // GPIO Port P5
        IntDefaultHandler,                      // GPIO Port P6
        IntDefaultHandler,                      // GPIO Port P7
        IntDefaultHandler,                      // GPIO Port Q (Summary or Q0)
        IntDefaultHandler,                      // GPIO Port Q1
        IntDefaultHandler,                      // GPIO Port Q2
        IntDefaultHandler,                      // GPIO Port Q3
        IntDefaultHandler,                      // GPIO Port Q4
        IntDefaultHandler,                      // GPIO Port Q5
        IntDefaultHandler,                      // GPIO Port Q6
        IntDefaultHandler,                      // GPIO Port Q7
        IntDefaultHandler,                      // GPIO Port R
        IntDefaultHandler,                      // GPIO Port S
        IntDefaultHandler,                      // PWM 1 Generator 0
        IntDefaultHandler,                      // PWM 1 Generator 1
        IntDefaultHandler,                      // PWM 1 Generator 2
        IntDefaultHandler,                      // PWM 1 Generator 3
        IntDefaultHandler                       // PWM 1 Fault
    };
    
    //*****************************************************************************
    //
    // This is the code that gets called when the processor first starts execution
    // following a reset event.  Only the absolutely necessary set is performed,
    // after which the application supplied entry() routine is called.  Any fancy
    // actions (such as making decisions based on the reset cause register, and
    // resetting the bits in that register) are left solely in the hands of the
    // application.
    //
    //*****************************************************************************
    void
    ResetISR(void)
    {
        //
        // Jump to the CCS C initialization routine.  This will enable the
        // floating-point unit as well, so that does not need to be done here.
        //
        __asm("    .global _c_int00\n"
              "    b.w     _c_int00");
    }
    
    //*****************************************************************************
    //
    // This is the code that gets called when the processor receives a NMI.  This
    // simply enters an infinite loop, preserving the system state for examination
    // by a debugger.
    //
    //*****************************************************************************
    static void
    NmiSR(void)
    {
        //
        // Enter an infinite loop.
        //
        while(1)
        {
        }
    }
    
    //*****************************************************************************
    //
    // This is the code that gets called when the processor receives a fault
    // interrupt.  This simply enters an infinite loop, preserving the system state
    // for examination by a debugger.
    //
    //*****************************************************************************
    static void
    FaultISR(void)
    {
        //
        // Enter an infinite loop.
        //
        while(1)
        {
        }
    }
    
    //*****************************************************************************
    //
    // This is the code that gets called when the processor receives an unexpected
    // interrupt.  This simply enters an infinite loop, preserving the system state
    // for examination by a debugger.
    //
    //*****************************************************************************
    static void
    IntDefaultHandler(void)
    {
        //
        // Go into an infinite loop.
        //
        while(1)
        {
        }
    }
    

    Regards

    Amit

  • Hello all, 

    Thanks for the comments on my problems so far. Apologies for my silence. I'm working my way through them. I have moved the ADC interrupt to a timer as I think this is a great idea and allows me to control the speed for debugging my code during development. I have yet to get onto some of the other suggestions although I'm not sure that bug linked a few posts above is relevant to my problem. I'll take a look in more detail at the driverlib source file to be sure though.

    Kind thanks and a pleasant weekend.