This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

No timer1 interrupt on aduc7020

Hi everyone,

I've already spent 3 days trying to get a timer1 interrupt on an aduc7020, without any success

Timer1 init:

        IRQCLR = GP_TIMER_BIT;
        T1CLRI = 0x55;           // Clear pending interrupts
        T1LD  = (32768/2)-1;            // 32768 clock ticks
        T1CON = BIT9 + BIT7 + BIT6;  // Periodic mode, enable timer, 32768Hz source clock
        IRQEN = GP_TIMER_BIT;   // Enable Timer 1 interrupt

in my main loop:

if(IRQSIG & GP_TIMER_BIT)
GP0CLR = (1 << 16 << 6);
else
GP0SET = (1 << 16 << 6);

perfectly works.

i'm using keil compiler, with the default startup code that clears the I & F flags:

;  Enter Supervisor Mode and set its Stack Pointer
                MSR     CPSR_c, #Mode_SVC:OR:I_Bit:OR:F_Bit
                MOV     SP, R0
                SUB     R0, R0, #SVC_Stack_Size

;  Enter User Mode and set its Stack Pointer
                MSR     CPSR_c, #Mode_USR
                IF      :DEF:__MICROLIB

my interrupt routine which is never called (led is never set):

void IRQ_Handler(void) __irq
{
        unsigned long IRQSTATUS = 0;
        IRQSTATUS = IRQSTA;

        if ((IRQSTATUS & GP_TIMER_BIT) == GP_TIMER_BIT)         //Timer 1 interrupt source
        {
                T1CLRI = 0x55;
        }
        GP0SET = (1 << 16 << 4);    //Red on
}

and my main code blinking a led

while(1)
{
GP4CLR = (1 << 16 << 2);
for(i = 0; i < 300000; i++)
__nop();

if(IRQSIG & GP_TIMER_BIT)
GP0CLR = (1 << 16 << 6);
else
GP0SET = (1 << 16 << 6);

GP4SET = (1 << 16 << 2);
for(i = 0; i < 300000; i++)
__nop();

if(IRQSIG & GP_TIMER_BIT)
GP0CLR = (1 << 16 << 6);
else
GP0SET = (1 << 16 << 6);
}

this code works, the led keeps blinking and the other led is set when the irqsig is present. However, the the interrupt setting another led is never launched.

Thanks

0