EmbDev.net

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


Author: Randall Aiken (randallaiken)
Posted on:
Attached files:

Rate this post
0 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!

Author: Randall Aiken (randallaiken)
Posted on:

Rate this post
0 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...

Author: Randall Aiken (randallaiken)
Posted on:

Rate this post
0 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!

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.