Skip to main content
Graduate II
February 10, 2021
Question

Getting out of interrupts stop the software from running.

  • February 10, 2021
  • 3 replies
  • 760 views

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 ?

    This topic has been closed for replies.

    3 replies

    Visitor II
    February 16, 2021

    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...

    Explorer
    February 16, 2021

    Out-of-bounds array access ?

    Local stack address passed as a parameter ?

    OferAuthor
    Graduate II
    February 18, 2021

    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();

    }

    Visitor II
    February 18, 2021

    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.