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.

SW-EK-TM4C1294XL: NMI INTERRUPT

Part Number: SW-EK-TM4C1294XL

Hi,

We have a TI launchpad development kit. We r facing issue when breakpoint is put inside Nmi interrupt handler. Interrupt is hitting 2 times inside the NMI interrupt handler.Actually it should hit only single time but its hitting 2 times.So kindly help to avoid this issue

  • Hello Arun,

    I am going to need more details here or possibly the code you are using to be able to understand this and dig into the behavior you are seeing. Some questions to start...

    • What is triggering the NMI?
    • What are you doing inside of the NMI interrupt?
    • How are you counting the interrupt entries into the NMI handler?
    • What are your compiler settings for optimizations?

    More details beyond that would be helpful but that at least would give me some understanding.

    Best Regards,

    Ralph

  • >External Input 3.3V  is given as trigger to NMI

    > We have used SysCtlNMIClear(SysCtlNMIStatus()); to clear the status and we also used SysCtlNMIClear(SYSCTL_NMI_EXTERNAL); register of interrupt is getting cleared in first hit but still its hitting twice inside NMI interrupt handler.Image given below contains registers which are checked for clearing the interrupt.

    > using breakpoint                                                                          

    > no optimization

  • Hello Arun,

    Is the voltage source from a button? If so, how is switch debounce handled?

    Can you share the actual code of the NMI ISR? If so I can run it on my LaunchPad to try and replicate the issue. Setup code would help too.

    Best Regards,

    Ralph

  • This is the main function

    int main(void)
    {
    uint32_t clockFrequency = SYSTEM_CLOCK_FREQUENCY;
    //
    // Unlock the Port-Pin and Set the CR bit for PD7
    //

    clockFrequency = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
    SYSCTL_OSC_MAIN |
    SYSCTL_USE_PLL |
    SYSCTL_CFG_VCO_480),
    SYSTEM_CLOCK_FREQUENCY);


    MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
    HWREG(GPIO_PORTD_BASE+GPIO_O_LOCK) = GPIO_LOCK_KEY;
    HWREG(GPIO_PORTD_BASE+GPIO_O_CR) |= GPIO_PIN_7;
    GPIOPinConfigure(GPIO_PD7_NMI);
    GPIOPadConfigSet(GPIO_PORTD_BASE, GPIO_PIN_7, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD_WPD);
    GPIODirModeSet(GPIO_PORTD_BASE, GPIO_PIN_7, GPIO_DIR_MODE_HW);

    while(1)
    {

    }
    }

    this is the NMI ISR Function

    static void
    NmiSR(void)
    {

    SysCtlNMIClear(SysCtlNMIStatus());
    //
    // Enter an infinite loop.
    //

    }

    Still breakpoint is hitting twice inside NMI handler. Square wave was given from the function generator as trigger for interrupt to PD7.IDE used is CCS Studio.

    Please provide a solution .

    Thank You

  • HI Arun,

    Your "Enter an infinite loop" is missing, while(1){} ...The function generator square wave has one shot mode? Have you set your scope single capture as to verify only one edge occurs? Perhaps Tivaware has way to set the Nmi interrupt input PD7 trigger edge direction.

  • Hello Arun,

    I am able to replicate your behavior and I am not entirely clear on what is occurring myself. It feels like there may need to be an additional clear that has to occur to avoid the reentry, but I tried one that seemed logical to no avail which was:

        HWREG(NVIC_INT_CTRL) &= ~NVIC_INT_CTRL_NMI_SET;
    

    I'd like to tie in my investigation here with your application requirements. Can you explain what your ultimate intent for using the NMI is so that I can keep that in mind as I continue to investigate?

    Best Regards,

    Ralph