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

NVIC_EnableIRQ : enables only one interrupt at a time?

Looking at the one of the implementations of NVIC_EnableIRQ, Im wondering how the ISER works

static __INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
{
  NVIC->ISER[((uint32_t)(IRQn) >> 5)] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* enable interrupt */
}

Calling the above two consequitve times with a different IRQn, will erase the enable of the previous interrupt. Does it mean I can enable one interrupt at a time?

NVIC_EnableIRQ(8);   // enables IRQ8

NVIC_EnableIRQ(7);   // enables IRQ7 but disables IRQ8 ?!?

Correct, or do I miss something?

Further, can I set an IER of a peripheral device without enabling its interrupt ?!?

Thanks in advance !

Parents
  • ISER/ICER : Atomically set/clear bits. You can of course set/clear more then one bit. But not with the CMSIS function but by directly writing.
    NVIC->ICER = 0xffffffff; /* clear all interrupts */

    And no "NVIC_EnableIRQ(UART2_IRQn);    // this disables UART3 already" is wrong. Hence the name is "ISER". It does only set those bits are written one. It does _not_ clear those where you write a zero.

    Also, you mix core (NVIC) and peripheral/SoC (UART). The core/NVIC has several input lines. These are connected to the SoC peripherals (UART or GPIO or ...).

    Since the NVIC does not know about the peripheral you have to enable interrupts at the source (peripheral) and the sink (NVIC).

Reply
  • ISER/ICER : Atomically set/clear bits. You can of course set/clear more then one bit. But not with the CMSIS function but by directly writing.
    NVIC->ICER = 0xffffffff; /* clear all interrupts */

    And no "NVIC_EnableIRQ(UART2_IRQn);    // this disables UART3 already" is wrong. Hence the name is "ISER". It does only set those bits are written one. It does _not_ clear those where you write a zero.

    Also, you mix core (NVIC) and peripheral/SoC (UART). The core/NVIC has several input lines. These are connected to the SoC peripherals (UART or GPIO or ...).

    Since the NVIC does not know about the peripheral you have to enable interrupts at the source (peripheral) and the sink (NVIC).

Children