Hello everybody, I'm using LPC2148 ARM7, programming with uVision3.
Now, I need nesting Interrupts. Following lines were used:
AREA NESTED_IRQ, CODE, READONLY ARM EXPORT nested_irq_enable EXPORT nested_irq_disable nested_irq_enable ; Nested Interrupts Entry: MRS LR, SPSR STMFD SP!, {LR} MSR CPSR_c, #0x1F STMFD SP!, {LR} nested_irq_disable ; Nested Interrupts Exit: ldmfd sp!, {lr} msr cpsr_c, #0x92 ldmfd sp!, {lr} msr spsr_cxsf, lr ;/*****************************************************************************/ END
Now, my Controller runs always in Prefetch Abort Handler. Does anybody know this problem? Or does anybody see what I'm doing wrong?
Thanks for all Replys, Adrian
I never tested this code:
void __asm enable_nested_interrupts(void) { MOV R0, LR MRS LR, SPSR ; Copy SPSR_irq to LR PUSH {LR} ; Save SPSR_irq MSR CPSR_c, #0x1F ; Enable IRQ (Sys Mode) PUSH {LR} ; Save LR MOV LR, R0 BX LR } void __asm disable_nested_interrupts(void) { MOV R0, LR POP {LR} ; Restore LR MSR CPSR_c, #0x92 ; Disable IRQ (IRQ Mode) POP {LR} ; Restore SPSR_irq to LR MSR SPSR_cxsf, LR ; Copy LR to SPSR_irq MOV LR, R0 BX LR }
Hello Tamir, Thanks for Reply! I tested your routines, but I have now some strange Problems: When the Nested Interrupts were used, the Stack Pointer go into a unused routine and the uC hangs himself up... Or in tech. Language: The Controller runs into an endless Loop, even though this Loop isn't used... Do I have some Problems with Function calls? Or what?!?
Have anybody (Tamir =) an Idea?
Thanks for Replys, Adrian
You must make sure you have enough stack space - don't forget that all interrupts will use IRQ mode stack by default.
The biggest Object I use is a String FIFO which's declarated as a Global Structure... Otherwise I don't use big Variables. Where can I look how much Memory Space I use?
PS: I found an other routine and this is running!! It was the Nested Interrupt handling who crashed my programme =) Thanks a lot for your help
Adrian
Oh, sorry: My Solution was this Link:
http://www.keil.com/support/docs/3353.htm
Thanks again!