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

Setting up NVIC with ISR in CortexM4

Could you please send me a snippet of code to set up the NVIC to use an ISR &  trigger the ISR ?

Parents
  • Chapter 7 has an example of setting up interrupts right in the chapter as well as an English description of what it is doing.  (Page 268 of the 3rd edition has a "simple" setting up of an interrupt example. )

    It goes like this 

    // No need to set priority grouping just yet, use the default

    // No need to set the priority just yet, use the default

    NVIC_EnableIRQ(IRQn);

    If you want to execute this interrupt through software

    NVIC_SetPendingIRQ(IRQn);

    Normally the hardware would assert the interrupt pending and not the software, but this would let you test the IRQ out.

    When the Interrupt happens the processor will enter the Exception sequence ending with loading the PC with the address in the Vector Table at index (IRQn + 16)  

Reply
  • Chapter 7 has an example of setting up interrupts right in the chapter as well as an English description of what it is doing.  (Page 268 of the 3rd edition has a "simple" setting up of an interrupt example. )

    It goes like this 

    // No need to set priority grouping just yet, use the default

    // No need to set the priority just yet, use the default

    NVIC_EnableIRQ(IRQn);

    If you want to execute this interrupt through software

    NVIC_SetPendingIRQ(IRQn);

    Normally the hardware would assert the interrupt pending and not the software, but this would let you test the IRQ out.

    When the Interrupt happens the processor will enter the Exception sequence ending with loading the PC with the address in the Vector Table at index (IRQn + 16)  

Children