Multiple interrupts on MSP430

I read in the users guide while the MSP430 is in the interrupt service routine then further interrupts are disabled.

What happens if during the ISR anthother interrupt happens?

Does the interrupt get handled when the ISR completes or is it lost?

  • If one interrupt is being serviced and the CPU is executing instructions in that ISR, other pending interrupts wait until the completion of the servicing ISR. Then the next interrupt will be serviced according to its priority in the device datasheet.

  • From the MSP430x5xxx User Guide (SLAU208C):

    Interrupt nesting is enabled if the GIE bit is set inside an interrupt service routine. When interrupt nesting is enabled, any interrupt occurring during an interrupt service routine interrupts the routine, regardless of the interrupt priorities.

    Seems it depends on the particular chip as to how it works.

  • In reply to Jack Peacock:

    I have external interrupt signal in P1.0. In PORT1_ISR I wanna start Timer_A0 to flash the LED connected to P2.1. How should I do???

     

     

  • In reply to Mr.LEARN:

    This seems like a simple thing, I think.

    If you PORT1_ISR is firing based on the external interrupt, just enable your Timer_A0 and the TimerA0_ISR can toggle the LED on P2.1.  Have a flag that also tells you Timer_A0 has been enabled, so that you do not "re-enable" it if PORT1_ISR fires again.

    I think this is one way to do it, for a very simple test or small application.

  • In reply to Engrforever:

    Hi,

    One more additional question,

    Is it possible to use multiple interrupts with Timer,

    say if I am using TACCR1 and TACCR2,

    is it possible to enable TACCR2 interrupt while TACCR1 is in process.

     

    Thankyou in advance.

     

  • In reply to paddu:

    A quick question related to LPM0 to 4 . How and when does the device enter into the Low power mode ?

    In the user guides exit from LPM's is clear but entry is not really clear. Please help.

     

  • In reply to Preeyadarshini Salagar:

    Hi...

    Regarding interrupt priorities,

    I am using timer A and timer B interrupts. 

    In the timer A ISR, I have a function which takes more time.  I thought that timer B ISR which has higher priority over timer A,

     would pre-empt  timer A ISR and do its high priority work without delay.   

    But, I oberve that timer A ISR gives chance to timer B ISR only after it runs to completion.  Is this the expected behaviour ?  

    Or in general,  Can a higher priority ISR pre-empt lower priority ISR while it is running  on MSP430f5418?

    Thanks.

  • In reply to krish50197:

    Krish,

    Please take a moment to re-read the other answers in this thread.  They are good answers.

    While the GIE bit in the SR is clear, interrupt requests of all priorities remain pending.  The CPU keeps doing whatever it is doing while the interrupt requests wait.

    If the GIE bit in the SR is set, the highest priority interrupt pending is recognized and its ISR begins execution with the GIE bit clear.  Normally, the ISR leaves the GIE bit clear, so normally, the ISR finishes before any other ISR can run, no matter the priority.

    However, an ISR can purposely set the GIE bit to allow another interrupt to be recognized.  Any interrupt (including lower priority interrupts) can then cause the interrupted ISR to wait.

    Most MSP430 users don't allow nested interrupts because ISRs are very small and fast.  If you think you need nested ISRs, consider writing smaller, faster ISRs, leaving most work to the "mainline" code.  If you still think you need nested ISRs, consider using DMA for high-priority, high-bandwidth I/O.

    Jeff

  • In reply to Jeff Tenney:

    Jeff,

    Thanks for the explanation.  

    I had a low priority core function (runs every 50 ms)  in timer A ISR as I thought  it would allow timer B ISR (1ms.. high prio) run intermittantly   throughout.

    Setting GIE bit  doesn't help as my core function inside timer A is large.  

    It will continue to run after resuming execution, this time with GIE bit clear and therefore blocking Timer B.

    So, I will have to reduce timer A core-function and shift it to main.  

    Thanks once again to all for the explanation.