EmbeddedRelated.com
Forums

LCD's on LPC's

Started by micro_minded May 18, 2010
HI,

I want to enable Timer0 interrupt. But IRQ interrupt occurs as soon as IRQ bit is cleared at bootup. This is happening when I run my code on board. I have added a breakpoint in first line of ISR. But this is not happening when I run my code in ARM debugger IDE software. As I understand IRQ interrupt should happen when both IRQ bit is enabled in CPSR and LBP2129 VIC. Please let me know if anyone faced this problem. My code: -

AREA Vect, CODE, READONLY
; *****************
; Vector Table
; *****************
LDR PC, Reset_Addr
LDR PC, Undefined_Addr
LDR PC, SWI_Addr
LDR PC, Prefetch_Addr
LDR PC, Abort_Addr
NOP ; Reserved vector
LDR PC, IRQ_Addr
LDR PC, FIQ_Addr

IMPORT IRQHandlerMain ; In IRQHandler.c

Reset_Addr DCD STACK_INTERRUPT_INIT
Undefined_Addr DCD 0 ; Not used
SWI_Addr DCD 0 ;Notused
Prefetch_Addr DCD 0 ;notused
Abort_Addr DCD 0 ;Notused
DCD 0; Reserved vector
IRQ_Addr DCD IRQHandlerMain
FIQ_Addr DCD 0 ;Notused
Kernel_Addr DCD 0x2000

STACK_INTERRUPT_INIT

; Enter IRQ mode and set up the IRQ stack pointer
MOV r0, #Mode_IRQ:OR:I_Bit:OR:F_Bit ; No interrupts
MSR cpsr_c, r0
LDR sp, =IRQ_Stack

; Enter FIQ mode and set up the FIQ stack pointer
MOV r0, #Mode_FIQ:OR:I_Bit:OR:F_Bit ; No interrupts
MSR cpsr_c, r0
LDR sp, =FIQ_Stack

; Enter ABT mode and set up the ABT stack pointer
MOV r0, #Mode_ABT:OR:I_Bit:OR:F_Bit ; No interrupts
MSR cpsr_c, r0
LDR sp, T_Stack

; Enter IRQ mode and set up the IRQ stack pointer
MOV r0, #Mode_UNDEF:OR:I_Bit:OR:F_Bit ; No interrupts
MSR cpsr_c, r0
LDR sp, =UNDEF_Stack

; Set up the SVC stack pointer last and return to SVC mode
MOV r0, #Mode_SVC:OR:I_Bit:OR:F_Bit ; No interrupts
MSR cpsr_c, r0
LDR sp, =SVC_Stack

MOV r0, #Mode_USR:OR:F_Bit ; Disable FIQ interrupt
BICr0,r0,#I_Bit ;Enable IRQ
MSR cpsr_c, r0 --> After this line IRQ interrupt happens always
LDR sp, =USR_Stack
LDR PC, Kernel_Addr ;Jump to kernel __main

END


My IRQ subrotine: -
__irq void IRQHandlerMain (void)
{
ulIRQHandler_counter ++; --> Breakpoint. Always control goes here
}


Best Reagrds
Swaroop JR

An Engineer's Guide to the LPC2100 Series