This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP432,为什么中断有时候会跳到FaultISR()这个中断里?



我用的是TI 测试FPU的例程 fpu_simple_floating_point_operation,有时候可以正常进中断,有时候就会跳到FaultISR()这个中断里,请问是怎么回事?

/* DriverLib Includes */
#include "driverlib.h"

/* Standard Includes */
#include <stdint.h>

#include <stdbool.h>
#include <math.h>

/* Statics */
static volatile bool flipFlop;

int main(void)
{
    volatile float fCalculate;
    uint32_t ii;
    flipFlop = false;

    MAP_WDT_A_holdTimer();

    /* Configuring P1.1 as an input and enabling interrupts */
    MAP_GPIO_setAsInputPinWithPullUpResistor(GPIO_PORT_P1, GPIO_PIN1);
    MAP_GPIO_clearInterruptFlag(GPIO_PORT_P1, GPIO_PIN1);
    MAP_GPIO_enableInterrupt(GPIO_PORT_P1, GPIO_PIN1);
    MAP_Interrupt_enableInterrupt(INT_PORT1);
    MAP_Interrupt_enableMaster();

    while(1)
    {
        for(ii=0;ii<20;ii++)
        {
            fCalculate = (sin(50.5) * (12.2f / 50.1f) * 10.22f / 3) * ii;
        }
    }
}

/* GPIO ISR */
void gpio_isr(void)
{
    uint32_t status;

    status = MAP_GPIO_getEnabledInterruptStatus(GPIO_PORT_P1);
    MAP_GPIO_clearInterruptFlag(GPIO_PORT_P1, status);

    /* Toggling the output on the LED */
    if(status & GPIO_PIN1)
    {
        if(flipFlop)
        {
            MAP_FPU_disableModule();
            flipFlop = false;
        }
        else
        {
            MAP_FPU_enableModule();
            flipFlop = true;
        }
    }

}
//*****************************************************************************
//
// This is the code that gets called when the processor receives a fault
// interrupt.  This simply enters an infinite loop, preserving the system state
// for examination by a debugger.
//
//*****************************************************************************
static void FaultISR(void)
{
    //
    // Enter an infinite loop.
    //
    while(1)
    {
    }
}
  • 很多情况下会跳转到FaultISR下面,鉴于你的测试例程,有可能是在调用FPU的过程中函数调用不当,导致系统出现fault的情况。

    你可以比对一下我们的例程,看看你修改了什么地方。

    谢谢

  • 我是直接导入的TI例程,没有做任何修改。。经过多次测试,发现当开启FPU,也就是调用FPU_enablemoudle()函数后,再次触发中断就会导致程序进入这个错误的中断。而且是首先会进入gpio_isr(),然后再进入这个错误的中断。请问是哪里出了问题?