This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Cortex M0 - Returning from Interrupt

Dear Concern

 I connected the CMSDK timer example with the Cortex - M0 processor. I have written exception handler for a timer in assembly code. After a certain moment interrupt is generated from the timer module in CMSDK. I see that the processor enters the exception handler for the first time and executes the handler and stays there.  Please check the timer handler which basically sends a digit to a peripheral when triggered. The code is provided below. The processor does not return to the reset handler from the timer handler. I see that the processor when enters the timer handler for the first time responds to the interrupt and in the end of executing the timer handler provides the address like fffffff8. fffffff8,..fffffffc.....fffffffc...00000004 then gets stuck. The processor does not provide the other addresses. As a result, it does not go to reset handler hence does not respond to any peripherals. I am sharing the timer handler and reset handlers. Please help.

Reset_Handler PROC
GLOBAL Reset_Handler
ENTRY

; Setting the NVIC register

LDR R1, =0xE000E400 ;Interrupt Priority Register
LDR R0, =0x00000000 ;Priority: IRQ0: 0x00
STR R0, [R1] 
LDR R1, =0xE000E100 ;Interrupt Set Enable Register
LDR R0, =0x00000001 ;Enable interrupt for timer 
STR R0, [R1]

MOVS R0,#0x0; clearing the Primask to accept the interrupts
MSR PRIMASK, R0

; configure the timer

LDR R1, =0x40001008 ;reload value to Timer 
MOVS R0, #0xFF
STR R0, [R1]

LDR R1, =0x40001000 ;control register value to Timer 
MOVS R0, #0x09
STR R0, [R1]

; apb led 

LDR R1, =0x40000000 ;Write to APB-LED with value with 0x25
MOVS R0, #0x35
STR R0, [R1]

LDR R1, =0x20000000 ;Write to SRAM with value with 0x25
LDR R0, =0x25
STR R0, [R1]

; loop to keep processor awake so that it can receive interrupts
AGAIN 
B AGAIN
ENDP

;Timer_Handler 
Timer_Handler PROC
EXPORT Timer_Handler

LDR R1, =0x4000100C ;Clear Register
MOVS R0, #0x01
STR R0, [R1] 

LDR R1, =0x40000000 ;Write to APB-LED with value with 0x25
MOVS R0, #0x25
STR R0, [R1]

BX LR
ENDP
ALIGN 4 ; Align to a word boundary

END