EmbDev.net

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


von Kanak N. (kanaknath)


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

Regards.

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.