EmbDev.net

Forum: ARM programming with GCC/GNU tools UART0 interrupt problem with LPC2124/Eclipse


von Randall A. (randallaiken)


Attached files:

Rate this post
useful
not useful
I have a problem getting a UART0 receive interrupt to function using 
Eclipse.   I cannot get the ISR for UART0 to respond to an interrupt 
request.  It appears the request is enabled and acknowledged, but not 
processed.  I suspect the problem is with the crt0.s assembler startup 
code. Unfortunately, I don't really know a lot about what needs to be 
there in terms of interrupt handlers.  I've attached a copy of the 
crt0.s file, along with a snippet showing the interrupt initialization 
routine and the UART0 ISR (barebones - just sends back a "u" to indicate 
the routine has been serviced and clears the interrupt).

Here are the values of the status registers before I hit a key to send a 
character to UART0:

VICIRQStatus = 0x0
VICFIQStatus = 0x0
VICIntSelect = 0x0
VICIntEnable = 0x40
VICSoftInt   = 0x0
VICDefVectAddr = 0x494
VICVectAddr0 = 0x3A0
VICVectCntl0 = 0x26
VICVectAddr1 = 0x374
VICVectCntl1 = 0x27
U0IER = 0x1
U1IER = 0x0

And here are the status registers after I hit the key to send a 
character to UART0

VICIRQStatus = 0x40
VICFIQStatus = 0x0
VICIntSelect = 0x0
VICIntEnable = 0x40
VICSoftInt   = 0x0
VICDefVectAddr = 0x494
VICVectAddr0 = 0x3A0
VICVectCntl0 = 0x26
VICVectAddr1 = 0x374
VICVectCntl1 = 0x27
U0IER = 0x1
U1IER = 0x0

As you can see, the VICIRQStatus changed, but the interrupt never 
vectored to the service routine.   Does there need to be a low-level 
assembler handler in the crt0.s code, or am I doing something wrong in 
the high-level code?

Thanks for any help in this matter!

von Randall A. (randallaiken)


Rate this post
useful
not useful
Update:

I was able to branch to the interrupt service routine by changing the 
following code in crt0.s:

msr   CPSR_c,#MODE_SYS|I_BIT|F_BIT // System Mode

changed to:

msr   CPSR_c,#MODE_USR       // User Mode

Now it branches to the service routine and hangs up, so I suspect I am 
now in the infinite loop handler, and need to figure out how to write an 
interrupt handler in assembler...

von Randall A. (randallaiken)


Rate this post
useful
not useful
Update:

Okay, I think I've figured out the problem:

I changed the interrupt declaration from:

void UART0_irq (void)

to:

void _attribute_ ((interrupt("IRQ"))) UART0_irq(void)


All appears to be working now.

I would still appreciate any comments to educate me further on this 
matter.

Thanks!

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.