微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI WIFI设计交流 > CC3200的定时器中断无法进入

CC3200的定时器中断无法进入

时间:10-02 整理:3721RD 点击:

请问,配置好定时器后无法进入中断,程序参照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_A_PERIODIC|TIMER_CFG_SPLIT_PAIR, TIMER_A, 79);
	Timer_IF_IntSetup(TIMERA0_BASE, TIMER_A, TimerBaseIntHandler);
	Timer_IF_Start(TIMERA0_BASE, TIMER_A, 10000);


	while(1)
	{

	}
}
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);
}

问题已经解决!向量表初始化出错!
更改:

MAP_IntVTableBaseSet((unsigned long)g_pfnVectors[0]);

为:

MAP_IntVTableBaseSet((unsigned long)&g_pfnVectors[0]);

少了‘&’号!

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top