Hello,

following the description of NMIs (chapter 2.2.1 in msp430x1xx userguide ) I want to implement an NMI handler.

I use:
interrupt (NMI_VECTOR)  INT_NMI(void) // 0xFFFC
{
        if ( (IFG1 & NMIIFG) != 0) // NMIIFG NMI
        {
                IFG1 &= ~NMIIFG;
                RS232printf( "NMIIFG\r\n");
        }
        else if ( (IFG1 & OFIFG) != 0) // OFIFG osc faul
        {
                IFG1 &= ~OFIFG;
                RS232printf( "osc failed\r\n");
        }
        else if ( (IFG1 & ACCVIFG) != 0) // ACCVIFG flash mem access violation
        {
                IFG1 &= ~ACCVIFG;
                RS232printf( "flash mem access violation\r\n");
        }
        else
        {
RS232printf( "don't know what caused this int in NMI \r\n IFG1=%u\r\n",(unsigned int)IFG1);
        }

        IE1 |= ( ACCVIE | NMIIE | OFIE | WDTIE );
}

the doc Note says (at the bottom of chapter 2.2.2):
Note: Enabling NMI Interrupts with ACCVIE, NMIIE, and OFIE The ACCVIE, NMIIE, and OFIE enable bits should not be set inside of an NMI interrupt service routine, unless they are set by the last instruction of the routine before the RETI instruction. Otherwise, nested NMI interrupts may occur, causing stack overflow and unpredictable operation.

At the moment it generates:
How could I accomplish that from within C? is it possible to get the
        ...
        bis.b   #llo(51), &0x0000
/* epilogue: frame size=0 */
        pop     r12
        pop     r13
        pop     r14
        pop     r15
        reti

The reason for beeing interested is, that my app seems to run for several hours and then the f149 reboots and I don't know why. Stack probably but how would I attack that and why could the stack overflow from a C program (no dyn. mem allocation). Nested ints perhaps?

greetings,

        Georg

Reply via email to