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.

Interrupts, flow never reaches the interrupt handler

Other Parts Discussed in Thread: AM3358

Hello,

I am currently developing a C baremetal application using a BeagleBone Black Rev C board, using a JTAG header and a XDS100 debugger, the processor is a Sitara AM3358 and I use the latest Code Composer Studio IDE v6 from TI and StarterWare libraries.


Perhaps someone could lend me a hand in an issue with interrupts, I've been looking at this for a few hours with no sucess and I have no idea what could be the problem. I have little experience with other ARM microcontrollers from ST and I though the transition would be easier but the currently is becomming a bit of a pain hehe

The problem is the flow never jumps to the interrupt handler. I have already checked and the timer itself works ok, it goes from the initial count to the overflow value and reloads again, however the overflow interrupt never generates, at least the flow never goes to the interrupt handler. I believe I've managed to isolate the problem to the interrupt part as I've tried with RTC with interrupts and the flow never jumps to the interrupt handler.

This is the code I have, mostly made of the examples provided in the StarterWare, it should be self explanatory. I've also doing the interrupt configuration first and changing the order of operations but that didn't work. The order of operations should be the same as the one on the TI wiki.

    /* DMTimer clocks */
    DMTimer2ModuleClkConfig();
    /* Configure the DMTimer for Auto-reload and compare mode */
    DMTimerModeConfigure(SOC_DMTIMER_2_REGS, DMTIMER_AUTORLD_NOCMP_ENABLE);
    /* Load the counter with the initial count value */
    DMTimerCounterSet(SOC_DMTIMER_2_REGS, 0xFF000000u);
    /* Load the load register with the reload count value */
    DMTimerReloadSet(SOC_DMTIMER_2_REGS, 0xFF000000u);
    /* Enable the DMTimer interrupts */
    DMTimerIntEnable(SOC_DMTIMER_2_REGS, DMTIMER_INT_OVF_EN_FLAG);
    /* Start the DMTimer */
    DMTimerEnable(SOC_DMTIMER_2_REGS);


    IntAINTCInit();
    /* Registering DMTimerIsr */
    IntRegister(SYS_INT_TINT2, DMTimerIsr);
    /* Set the priority */
    IntPrioritySet(SYS_INT_TINT2, 4, AINTC_HOSTINT_ROUTE_IRQ);
    /* Enable the system interrupt */
    IntSystemEnable(SYS_INT_TINT2);
    /* Enable IRQ in CPSR */
    IntMasterIRQEnable();

This code was taken from an example, so I guess I am missing something. I am currently reading the reference manual and the interrupt registers and continue from there, but I would appreciate any comments on this.

Thanks in advance!

  • Moving this to the Starterware forum.

  • How do you recognise your ISR is never reached?

    When you check it with the debugger and a breakpoint set into it: that often does not work, you never will reach it although your code is correct. So try to e.g. set an LED out of your ISR and let your code run freely without debugger to verify this.

  • I've tried intrusive things like printfs and breakpoints and non intrusive things like LEDs on my interrupt service routine to check if it is executed, everything I tried is with the debugger attached, here is how my ISR looks like:

    static void DMTimerIsr(void)
    {
    	//printf("Interrupt TIMER Reached.\r\n");
        // Clear the status of the interrupt flags.
        DMTimerIntStatusClear(SOC_DMTIMER_2_REGS, DMTIMER_INT_OVF_EN_FLAG);
        // Turn LED on and OFF.
        LED_Toggle(LED_USR_D3);
    }

    And this is my main routine, which works as intended:

    /**
      * @brief  Main routine. Flow jumps here after initialization.
      * @param  None.
      * @retval None.
      */
    
    int main(void) {
    	unsigned int i = 0;
    	// Main routine Reached.
    	printf("BBB: Main Reached.\r\n");
    	// LEDs pin configuration.
    	LED_Init();
    	// LEDs ON.
    	LED_Off(LED_USR_D2);
    	LED_Off(LED_USR_D3);
    	LED_Off(LED_USR_D4);
    	LED_Off(LED_USR_D5);
    	// Timers enable and configuration.
    	TIM_Delay_Init();
    	// Infinite Loop reached.
    	printf("BBB: Infinite Loop reached.\r\n");
    
    	while (1)
    	{
    		i = DMTimerCounterGet(SOC_DMTIMER_2_REGS);
    		if (i >= 0xFFFFF000)
    		{
    			LED_Toggle(LED_USR_D2);
    			while (i > 0xFFFFF000) {
    				i = DMTimerCounterGet(SOC_DMTIMER_2_REGS);
    			}
    		}
    	}
    }

    However, I've just noticed that with no debugger attached the code doesn't run, I've tried to load the program in release mode and debug mode. I load the out files with CCS with the debugger attached but when I disconnect the debugger and press reset nothing runs. I will look more into this.