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.

TM4C1294KCPDT: TM4C1294KCPDT

Part Number: TM4C1294KCPDT
Other Parts Discussed in Thread: EK-TM4C1294XL

Tool/software:

I am using the development board EK-TM4C1294XL

The two tactile switches on the board (USR_SW1) and USR_SW) do not do anything.

We compiled the program for polling and interrupt mode of operation and still the two switches did not do anything.

We are monitoring the CPU action via debug port.

If another pin is toggled, then the two above switches appear to work.

Please advise.

This is extremely critical

  • If another pin is toggled, then the two above switches appear to work.

    Hi,

      What do you mean another is toggled then the two switches will work? Which pin are you talking about? Please reference the below code where USR_SW1 (PJ0) is configured to generate an interrupt. Each time you press the switch, it will change the LED blink rate on the board. Compare with your code if have configured the pin properly for edge detection. 

    #include <stdbool.h>
    #include <stdint.h>
    #include "inc/hw_ints.h"
    #include "inc/hw_memmap.h"
    #include "driverlib/gpio.h"
    #include "driverlib/interrupt.h"
    #include "driverlib/pin_map.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/timer.h"
    #include "driverlib/uart.h"
    #include "utils/uartstdio.h"
    
    
    #define USER_LED1  GPIO_PIN_0
    #define USER_LED2  GPIO_PIN_1
    uint32_t ui32SysClock;
    
    
    //*****************************************************************************
    //
    // Counter to count the number of interrupts that have been called.
    //
    //*****************************************************************************
    static volatile uint32_t g_ui32Counter = 0;
    
    
    //*****************************************************************************
    //
    // The interrupt handler for the Timer0 interrupt.
    //
    //*****************************************************************************
    void
    Timer0IntHandler(void)
    {
        //
        // Clear the timer interrupt flag.
        //
        TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
    
    
        if ((g_ui32Counter % 2) == 0){
            GPIOPinWrite(GPIO_PORTN_BASE, (USER_LED1|USER_LED2), USER_LED1);
    
        } else {
            GPIOPinWrite(GPIO_PORTN_BASE, (USER_LED1|USER_LED2), USER_LED2);
    
        }
    
        //
        // Update the periodic interrupt counter.
        //
        g_ui32Counter++;
    
    
    }
    
    void SW1Handler (void)
    {
        GPIOIntClear(GPIO_PORTJ_BASE, GPIO_PIN_0);
        ui32SysClock *= 1.2;
        TimerLoadSet(TIMER0_BASE, TIMER_A, ui32SysClock / 2);
    
    }
    
    
    
    //*****************************************************************************
    //
    // Configure Timer0B as a 16-bit periodic counter with an interrupt
    // every 1ms.
    //
    //*****************************************************************************
    int
    main(void)
    {
    
    
    
        //
        // Set the clocking to run directly from the external crystal/oscillator.
        // TODO: The SYSCTL_XTAL_ value must be changed to match the value of the
        // crystal on your board.
        //
    
        ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
                                           SYSCTL_OSC_MAIN |
                                           SYSCTL_USE_OSC), 25000000);
    
        //
        // The Timer0 peripheral must be enabled for use.
        //
        SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
    
        //
        // Enable and wait for the port to be ready for access
        //
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION);
        while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPION))
        {
        }
    
        //
        // Configure the GPIO port for the LED operation.
        //
        GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, (USER_LED1|USER_LED2));
    
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOJ);
        while(!(SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOJ)));
        GPIOPinTypeGPIOInput(GPIO_PORTJ_BASE, GPIO_PIN_0);
        GPIOPadConfigSet(GPIO_PORTJ_BASE, GPIO_PIN_0, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
        GPIOIntTypeSet(GPIO_PORTJ_BASE, GPIO_PIN_0, GPIO_FALLING_EDGE);
        GPIOIntRegister(GPIO_PORTJ_BASE, SW1Handler);
        GPIOIntEnable(GPIO_PORTJ_BASE, GPIO_INT_PIN_0);
        IntEnable(INT_GPIOJ);
        //
        // Configure Timer0B as a 16-bit periodic timer.
        //
        TimerConfigure(TIMER0_BASE,  TIMER_CFG_PERIODIC);
    
    
        //
        // Set the Timer0B load value to 1ms.
        //
        TimerLoadSet(TIMER0_BASE, TIMER_A, ui32SysClock / 2);
    
        //
        // Enable processor interrupts.
        //
        IntMasterEnable();
    
        //
        // Configure the Timer0B interrupt for timer timeout.
        //
        TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
    
        //
        // Enable the Timer0B interrupt on the processor (NVIC).
        //
        IntEnable(INT_TIMER0A);
    
        //
        // Initialize the interrupt counter.
        //
        g_ui32Counter = 0;
    
        //
        // Enable Timer0B.
        //
        TimerEnable(TIMER0_BASE, TIMER_A);
    
        //
        // Loop forever while the Timer0B runs.
        //
        while(1)
        {
    
        }
    }