UART interrupt problem

OP #1289462
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.

Reply

A question of your own? This thread is over 17 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.