cancel
Showing results for 
Search instead for 
Did you mean: 

Getting out of interrupts stop the software from running.

Ofer
Associate III

I'm using STM8AF5288 and the COSMIC as my IDE.

Everything working great accept for interrupts using.

The interrupt are being fired as I accept but on returning from the interrupt the PC is out of the program memory addresses.

It is happening with external interrupt as well as with UART TX interrupt.

Anyone ?

4 REPLIES 4
Cristian Gyorgy
Senior III

Check if you somehow alter your stack content inside the interrupt routine. If by error you overwrite the return address in the stack, it will not find the return point by itself...

Out-of-bounds array access ?

Local stack address passed as a parameter ?

Ofer
Associate III

Thanks, but it is not seems to be the case, for example, here are 2 of my interrupts:

//INTERRUPT_HANDLER(UART1_TX_IRQHandler, 4)

void EXTI_PORTB_IRQHandler()

{

uint8_t status_1 = ais3624dq_get_interrupt_1_status();

uint8_t status_2 = ais3624dq_get_interrupt_2_status();

}

//INTERRUPT_HANDLER(UART1_TX_IRQHandler, 7)

void EXTI_PORTE_IRQHandler()

{

uint8_t status_1 = ais3624dq_get_interrupt_1_status();

uint8_t status_2 = ais3624dq_get_interrupt_2_status();

}

Cristian Gyorgy
Senior III

How do you know the PC is wrong on the return, you read it with the debugger or it jumps elsewhere in the program?

Try not to call any function in the interrupt handler, just reset the interrupt flag, to see it the problem persists. If not, you know one of the called functions is messing up the stack.