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.

Interrupt Problem

Other Parts Discussed in Thread: CCSTUDIO

Hi, I am a software developer using TMS320 DM6446 EVM with an Emulator through JTAG, and I am using Windows CCStudio 5.3.

My task is to test the interrupt function of the 6446. Specifically Timer Interrupt. I have read through the DMSoC ARM Subsystem document, and set the corresponding registers to enable the interrupt. I created the vector table intvecs.asm according to the C Compiler guide (spnu151j). I believe I have done everything to make the interrupt work; yet program never jumps to the interrupt when the timer period is over.

Things I have done:

- Enabled the interrupts through the registers EINT0 & EINT1
- Modified the control register INTCTL
- Set the priority registers INTPRIx
- Cleared all the interrupt flags
- Wrote the interrupt function according to the guideline:
#pragma INTERRUPT (func, IRQ)
__interrupt void func (void) { printf("Interrupt!"); }

- Wrote the intvecs.asm according to the guideline, and mapped the interrupt function to the intvecs, at the precise location where the timer interrupt should go to (using IRQENTRY = (EABASE + 32 + 1)*SIZE)
- Tried to "initialize" the interrupt by:
CSL_intcInit();
CSL_intcDispatcherInit();

In the debug mode, from the Memory Map, I saw that all the Interrupt Registers are correct, and Timer Interrupt flag is asserted (last bit of IRQ1 is 0), and the IRQENTRY = 0x84 ( = 132 = (32+1)*4 = timer interrupt routine). But it never jumps to the interrupt routine (setting breakpoint at the routine and the program never stops there). The Assembly code shows that the vector table is entered correctly, i.e. a branching operation at the address 0x84. EABASE = 0.

Seems like the interrupt is masked in some way. I saw a PSC interrupt in the ARM document, but I don't think it matters. Is there anything that I have missed? Or did I not correctly initialized the interrupt controller? Any help will be greatly appreciated.

Regards,
AL

  • Hi Alvin,

    Can you share the code snippet with me so that i can give my inputs on it.
  • Dear Arvind,

    Sure. I attach my main.c file and the intvecs.asm. Please tell me if you need anything more.

    Regards,

    AL

    #include "stdio.h"
    #include "davincievm.h"
    #include "davincievm_emif.h"
    
    #define AINTC_BASE          0x01C48000
    #define AINTC_FIQ0          *( volatile Uint32* )( AINTC_BASE + 0x00 )  // FIQ0
    #define AINTC_FIQ1          *( volatile Uint32* )( AINTC_BASE + 0x04 )  // FIQ1
    #define AINTC_IRQ0          *( volatile Uint32* )( AINTC_BASE + 0x08 )  // IRQ0
    #define AINTC_IRQ1          *( volatile Uint32* )( AINTC_BASE + 0x0C )  // IRQ1
    #define AINTC_FIQENTRY      *( volatile Uint32* )( AINTC_BASE + 0x10 )  // FIQE
    #define AINTC_IRQENTRY      *( volatile Uint32* )( AINTC_BASE + 0x14 )  // FIQE
    #define AINTC_EINT0         *( volatile Uint32* )( AINTC_BASE + 0x18 )  // EINT0
    #define AINTC_EINT1         *( volatile Uint32* )( AINTC_BASE + 0x1C )  // EINT1
    #define AINTC_INTCTL        *( volatile Uint32* )( AINTC_BASE + 0x20 )  // Int Ctrl Reg
    #define AINTC_EABASE        *( volatile Uint32* )( AINTC_BASE + 0x24 )  // EABASE
    #define AINTC_INTPRI0       *( volatile Uint32* )( AINTC_BASE + 0x30 )  // INTPRI0
    #define AINTC_INTPRI1       *( volatile Uint32* )( AINTC_BASE + 0x34 )  // INTPRI1
    #define AINTC_INTPRI2       *( volatile Uint32* )( AINTC_BASE + 0x38 )  // INTPRI2
    #define AINTC_INTPRI3       *( volatile Uint32* )( AINTC_BASE + 0x3C )  // INTPRI3
    #define AINTC_INTPRI4       *( volatile Uint32* )( AINTC_BASE + 0x40 )  // INTPRI4
    #define AINTC_INTPRI5       *( volatile Uint32* )( AINTC_BASE + 0x44 )  // INTPRI5
    #define AINTC_INTPRI6       *( volatile Uint32* )( AINTC_BASE + 0x48 )  // INTPRI6
    #define AINTC_INTPRI7       *( volatile Uint32* )( AINTC_BASE + 0x4C )  // INTPRI7
    
    
    // interrupt routine
    #pragma INTERRUPT (func, IRQ)
    __interrupt void func (void) {
    	printf("Interrupt!");
    	printf("ISR_HANDLER!");
    }
    
    
    void main( void )
    {
    	int period = 0xF0000;		  // Timer period
    
    	// Interrupt settings
    	CSL_intcInit( );
    	CSL_intcDispatcherInit( );
    	AINTC_INTCTL = 3;
    
    	AINTC_EINT0 = 0xFFFFFFFF;		// Disable all unused interrupts
    	AINTC_EINT1 = 0xFFFFFFFF;		// Enable all timer interrupts
    	AINTC_EABASE = 0;
    
    	// Clear all interrupts
    	AINTC_IRQ0 = 0xFFFFFFFF;
    	AINTC_IRQ1 = 0xFFFFFFFF;
    
    	// Set Timer
    	TIMER0_TGCR = 0x00000004;			// Timer 32-bit unchained reset
    	TIMER0_TRC = 0x00000000;			// Internal clock, disable
    	TIMER0_PRD12 = period;				// Timer period set
    	TIMER0_TIM12 = 0x00000000;			// Timer counter reset
    
    	// Start the timer
    	TIMER0_TGCR = 0x00000007;			// Timer 32-bit unchained un-reset
    	TIMER0_TRC |= 1 << 7;			// Internal clock, enable
    
    	printf("\nTesting start!\n\n");
    	printf("FIQENTRY: %x; IRQENTRY: %x; EABASE: %x.\n", AINTC_FIQENTRY,
    			AINTC_IRQENTRY, AINTC_EABASE);
    	printf("EINT0: %x; EINT1: %x.\n", AINTC_EINT0, AINTC_EINT1);
    
    	// Wait until almost interrupt
    	while(TIMER0_TIM12 < 0xEFF00);
    	// Make it interrupt
    	int i;
    	for (i = 0; i < 1000; i++);
    
    	printf("FIQENTRY: %x; IRQENTRY: %x; EABASE: %x.\n", AINTC_FIQENTRY,
    			AINTC_IRQENTRY, AINTC_EABASE);
    
    	printf("Interrupt B: %x\n", AINTC_IRQ1); // Display interrupt
    }
    

    1682.intvects.asm