Forum: ARM programming with GCC/GNU tools UART interrupt problem

Author: Kanak Nath (kanaknath)
Posted on:

Rate this post
0 useful
not useful
I am using Olimex's SAM7-P64 board, development tool set from YAGARTO 
OPENOCD and Insight for my debugging. I sn suing USART1 and setup for 
UART receive interrupt. The code starts and keeps looping in the main() 
routine. When I enter a character (using Hyperterminal in XP PC) the 
code stops at a debug break in the UART ISR. The ISR is coded as naked 
function. When in ISR the LR shows a value of 0xC0. As a result when 
returns from interrupt it does not go back to the main() routine. In the 
beginning of ISR I've ISR_ENTRY() and at the end ISR_EXIT() macros.

#define ISR_ENTRY() asm volatile(" sub   lr, lr,#4\n" \
                                 " stmfd sp!,{r0-r12,lr}\n" \
                                 " mrs   r1, spsr\n" \
                                 " stmfd sp!,{r1}")

#define ISR_EXIT()  asm volatile(" ldmia sp!,{r1}\n" \
                                 " msr   spsr_c,r1\n" \
                                 " ldmia sp!,{r0-r12,pc}^")

Also when in the ISR the processor mode is 0x13 which is supervisor mode 
I thought I would see 0x12 the IRQ mode. Also at the beginning of the 
ISR when SPSR is stored in R1, the SPSR[5:0] has value 0x33. The code is 
compiled in ARM mode only.

Could anyone please help me in solving this problem.



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.