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

Timer interrupt on lpc3250

Hi,

I am trying to get timer interrupts every second and update a variable. I use timer0 and do the settings as follows:

TIMCLK_CTRL1 = 0x04; //enable timer0 clock
T0CTCR = 0x00;       //use as a timer
T0TCR = 0x01;        //enable timer
T0PR = 12999999;     //set timer frequency to 1hz
T0MR0 = 8;           //match register0 is set to 8
T0MCR = 0x03;        //reset and give interrupt when match occurs
MIC_ER = 0x10000;       // enable timer0 interrupts

Then, I write my interrupt subroutine as follows:

STMFD   sp!, {r0-r3, lr}
LDR     R3, =0x01
LDR     R1, =0x40044000
STR     R3, [R1]         // interrupt cleared
BL      C_Irq_Handler
LDMFD   sp!, {r0-r3, pc}

Everything works fine but, I can only get the interrupts for once. I do the setting s to continuously get the interrupt but it goes into the interrupt only once.

What is wrong with this, I dont understand. I'd be grateful if anyone could help me.

Parents
  • I think you should re-examine your solution.

    You preserve registers R0 to R3 in the ISR and those registers certainly CAN be used to release the source of the interrupt.

    Hint: The function you call from your ISR (C_Irq_Handler), what registers do you think that might use? Were they being preserved in your original code? These questions would be specific to the ARM core (not specific to a particular ARM device) and the ABI.

Reply
  • I think you should re-examine your solution.

    You preserve registers R0 to R3 in the ISR and those registers certainly CAN be used to release the source of the interrupt.

    Hint: The function you call from your ISR (C_Irq_Handler), what registers do you think that might use? Were they being preserved in your original code? These questions would be specific to the ARM core (not specific to a particular ARM device) and the ABI.

Children
No data