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.

tiva TM4C1294中断嵌套的问题,TIMER 与GPIO 中断

大体上是这样的,写了一个测频率的程序,思路这样,设置时间中断与goio上升沿中断,每一个上升沿中断n+1,知道时间到1秒后,定时器中断触发

之后将中断关闭,读出变量的数值就是频率的值,但是程序在板上仿真时,当频率为1.5M以下的情况,可以触发计时器中断(因为我设置了进入定时器点灯)

而当频率大于1.5MHZ的话就根本不会触发定时器中断,只是不断触发gpio中断,但是我明明将timer优先级设为最高,将gpio设为最低,按道理来说,应该满足中断

嵌套的条件啊,但是为什么会出现这样的现象呢,我记得之前学习32时有抢占优先级和响应优先级,而tiva在设置优先级只有一个函数,不知道具体什么原因

程序如下

#include <stdbool.h>
#include <stdint.h>
#include "inc/hw_gpio.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/rom.h"
#include "driverlib/rom_map.h"
#include "driverlib/sysctl.h"

#include "inc/hw_timer.h"
#include "driverlib/timer.h"

#include "inc/hw_ints.h"
#include "driverlib/interrupt.h"

void INT_TIMER0A_Handler(void);
void INT_GPIOE_Handler(void);
float n=0;
float f=0;
int i=0;
unsigned long int count=120000000;
int main()
{
//open the system clock with 120MHZ
SysCtlClockFreqSet((SYSCTL_USE_PLL|SYSCTL_OSC_MAIN|SYSCTL_CFG_VCO_480|SYSCTL_XTAL_25MHZ),120000000);

//Enable the peirpheral clock
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);

SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);

SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION);

GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE,GPIO_PIN_0);

//configure type of peripheal
GPIODirModeSet(GPIO_PORTE_BASE,GPIO_PIN_3,GPIO_DIR_MODE_IN);

//configure the two pin as wpu mode
GPIOPadConfigSet(GPIO_PORTE_BASE,GPIO_PIN_3,GPIO_STRENGTH_12MA,GPIO_PIN_TYPE_STD_WPU);

TimerClockSourceSet(TIMER0_BASE,TIMER_CLOCK_SYSTEM);

TimerConfigure(TIMER0_BASE,TIMER_CFG_PERIODIC);

IntRegister(INT_TIMER0A,INT_TIMER0A_Handler);

IntRegister(INT_GPIOE,INT_GPIOE_Handler);


IntPrioritySet(INT_TIMER0A,0X00);

IntPrioritySet(INT_GPIOE,0Xe0);
//enable master interrupt
IntMasterEnable();


//Enable the timer0 interrupt
IntEnable(INT_TIMER0A);

IntEnable(INT_GPIOE);


GPIOIntEnable(GPIO_PORTE_BASE,GPIO_INT_PIN_3);
GPIOIntTypeSet(GPIO_PORTE_BASE,GPIO_PIN_3,GPIO_RISING_EDGE);
TimerIntEnable(TIMER0_BASE,TIMER_TIMA_TIMEOUT);
//load the timer
TimerLoadSet(TIMER0_BASE,TIMER_A,count);

//Enable the Timer
TimerEnable(TIMER0_BASE,TIMER_A);

while(1)
{
if(i==2)
{
f=(120000000/count)*n;
IntMasterDisable();
TimerDisable(TIMER0_BASE,TIMER_A);
}
}
}


void INT_TIMER0A_Handler(void)
{

TimerIntClear(TIMER0_BASE,TIMER_TIMA_TIMEOUT);
GPIOPinWrite(GPIO_PORTN_BASE,GPIO_PIN_0,1);
i=2;
}
void INT_GPIOE_Handler(void)
{
GPIOIntClear(GPIO_PORTE_BASE,GPIO_INT_PIN_3);
n++;
}