TI中文支持网
TI专业的中文技术问题搜集分享网站

CC3200定时器无法进入中断

程序是自己参考timer demo写的,经过UART调试发现,定时器中断没有进入,对比了timer demo,也没发现错误,请问问题出在哪里?以下是代码:
/*
 * main.c
 */
#include"hw_types.h"
#include"hw_memmap.h"
#include"hw_ints.h"
#include"rom_map.h"
#include"gpio.h"
#include"stdint.h"
#include"prcm.h"
#include"stdio.h"
#include"interrupt.h"
#include"uart.h"
#include"gpio.h"
#include"pin_mux_config.h"
#include"utils.h"
#include"timer.h"
#include"pin.h"
#include"timer_if.h"
//goal vars
extern void (* const g_pfnVectors[])(void);
unsigned int PosEdgeValue[2]={0};
unsigned int TimerOutCont=0;
unsigned char string[];
//defines
#define ccs
//functions
void BoardInit(void);
void UART_Init(unsigned int boand);
void UART_StringPuts(unsigned char *str);
void TIMER_Init(void);
void Sensor_Start(void);
unsigned int Sensor_GetValue(void);
void TimerBaseIntHandler(void)
{
 printf("int_1\r\n");
// unsigned long ulInts;
// ulInts=MAP_TimerIntStatus(TIMERA0_BASE, true);
// MAP_TimerIntClear(TIMERA0_BASE,ulInts);
// MAP_TimerIntClear(TIMERA0_BASE,TIMER_TIMA_TIMEOUT);
 Timer_IF_InterruptClear(TIMERA0_BASE);
 TimerOutCont++;
 printf("int\r\n");
}
int main(void) {
 
// unsigned int SensorValue=0;
 BoardInit();
 PinMuxConfig();
 UART_Init(115200);
 printf("begin\r\n");
 //TIMER_Init();
 Timer_IF_Init(PRCM_TIMERA0, TIMERA0_BASE, TIMER_CFG_PERIODIC, TIMER_A, 79);
 Timer_IF_IntSetup(TIMERA0_BASE, TIMER_A, TimerBaseIntHandler);
 Timer_IF_Start(TIMERA0_BASE, TIMER_A, 0xffff);
 while(1)
 {
  printf("end\r\n");
//  Sensor_Start();
//  SensorValue=Sensor_GetValue();
//  sprintf((char *)string,"%d\r\n",TimerOutCont);
//  UART_StringPuts(string);
//  sprintf((char *)string,"PosEdgeValue: 0x%x,0x%x\r\n",PosEdgeValue[0],PosEdgeValue[1]);
//  UART_StringPuts(string);
//  UtilsDelay(80000000);
 }
}
void BoardInit(void)
{
 MAP_IntVTableBaseSet((unsigned long)g_pfnVectors[0]);
 MAP_IntMasterEnable();
 MAP_IntEnable(FAULT_SYSTICK);
 PRCMCC3200MCUInit();
}
void UART_Init(unsigned int boand)
{
 MAP_UARTFlowControlSet(UARTA0_BASE,UART_FLOWCONTROL_NONE);
 MAP_UARTConfigSetExpClk(UARTA0_BASE,MAP_PRCMPeripheralClockGet(UARTA0_BASE),boand, \
   UART_CONFIG_WLEN_8|UART_CONFIG_STOP_ONE|UART_CONFIG_PAR_NONE);
}
void UART_StringPuts(unsigned char *str)
{
 if(str!=NULL)
 {
  while(*str!='\0')
  {
   MAP_UARTCharPut(UARTA0_BASE,*(str++));
   while(MAP_UARTBusy(UARTA0_BASE));
  }
 }
}
int fputc(int ch,FILE *f)
{
 MAP_UARTCharPut(UARTA0_BASE,(unsigned char)ch);
 while(MAP_UARTBusy(UARTA0_BASE));
 return(ch);
}
Heng Zhang4:

更改了Timer_IF_Init(PRCM_TIMERA0, TIMERA0_BASE, TIMER_CFG_A_PERIODIC|TIMER_CFG_SPLIT_PAIR, TIMER_A, 79);后还是不可以!

Heng Zhang4:

回复 Heng Zhang4:

问题已经解决!!定时器不能进入中断,是中断向量表的问题!修改上面的错误地方:MAP_IntVTableBaseSet((unsigned long)g_pfnVectors[0]);为:     MAP_IntVTableBaseSet((unsigned long)&g_pfnVectors[0]);‘&’符号没有打上~!

赞(0)
未经允许不得转载:TI中文支持网 » CC3200定时器无法进入中断
分享到: 更多 (0)