Skip to content

AWU_IRQHandler not working for STM8S #164

@wmarkow

Description

@wmarkow

I wanted to use the active halt power save mode together with AWU unit to wake up.
Basically the concept of AWU works but the processor gets restarted every time the AWU interrupt occur. Expected behavior is that the procesdor should continue its execution from the place where HALT instruction has been called.

Root cause: it is not possible to correctly set the AWU_IRQHandler to some specific method. This code doesn't work:

INTERRUPT_HANDLER(AWU_IRQHandler, 1)
{
    AWU->CSR &= (uint8_t)(~AWU_CSR_AWUF);
}

because the AWU_IRQHandler is commented out in the stm8s_it.h file:

// SDCC patch: __interrupt keyword required after function name --> requires new block
#elif defined (_SDCC_)

// INTERRUPT_HANDLER_TRAP(TRAP_IRQHandler);                 /* TRAP */
// INTERRUPT_HANDLER(TLI_IRQHandler, 0);                    /* TLI */
// INTERRUPT_HANDLER(AWU_IRQHandler, 1);                    /* AWU */
// INTERRUPT_HANDLER(CLK_IRQHandler, 2);                    /* CLOCK */
 INTERRUPT_HANDLER(EXTI_PORTA_IRQHandler, 3);             /* EXTI PORTA */
 INTERRUPT_HANDLER(EXTI_PORTB_IRQHandler, 4);             /* EXTI PORTB */
 INTERRUPT_HANDLER(EXTI_PORTC_IRQHandler, 5);             /* EXTI PORTC */
 INTERRUPT_HANDLER(EXTI_PORTD_IRQHandler, 6);             /* EXTI PORTD */
 INTERRUPT_HANDLER(EXTI_PORTE_IRQHandler, 7);             /* EXTI PORTE */

In this way the AWU_IRQHandler is set to zero and the processor gets restarted on this interrupt.

When I modify the file and uncomment the line

INTERRUPT_HANDLER(AWU_IRQHandler, 1);                    /* AWU */

then everything works fine. Is there any particular reason why the interrupt handler is commented out?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions