我现在使用DM642开发板做实验 在bios中单独的网络通信程序,以及单独的定时器程序都运行正常,但是如果把这两个程序合在一块,定时器运行一瞬间就不运行了,不知怎么回事? 即前面我用LOG_printf来检验定时器的计数值cnt发现不行后,现在 我又用串口来检验定时器计数的cnt值(串口芯片为TL16C752B),发现电脑上的串口调试助手只能接收到 前面三个cnt的值,后面的就收不到了,与LOG_printf的情况一样,还请各位高手给指点一下! #include <std.h> #include <log.h> #include <tsk.h> #include <sem.h> #include <gio.h> #include <csl.h> #include <csl_emifa.h> #include <csl_timer.h> #include <csl_irq.h>
#include "appData.h" #include "scom.h" #include "seeddm642.h" #include "Tcpip_loopbackcfg.h" static TIMER_Handle hTimer1;
static Uint32 TimerEventId;
static int cnt = 0; static Uint32 TimerControl =
TIMER_CTL_RMK
(
TIMER_CTL_SPND_EMUSTOP,
TIMER_CTL_INVINP_NO, // TINP inverter control(INVINP)
TIMER_CTL_CLKSRC_CPUOVR8, // Timer input clock source (CLKSRC)
TIMER_CTL_CP_PULSE, // Clock/pulse mode(CP)
TIMER_CTL_HLD_YES, // Hold(HLD)
TIMER_CTL_GO_NO, // Go bit(GO)-
// resets & starts timer counter
TIMER_CTL_PWID_ONE, // Pulse width(PWID)-
// used only in pulse mode
TIMER_CTL_DATOUT_0, // Data output (DATOUT)
TIMER_CTL_INVOUT_NO, // TOUT inverter control (INVOUT)
TIMER_CTL_FUNC_GPIO // Function of TOUT pin(FUNC)
); SEEDDM642_UART_Config UartConfig ={ 0x01,/*寄存器IER*/ 0x5f,/*寄存器FCR*/ 0x03,/*寄存器LCR*/ 0x08,/*寄存器MCR*/ };
main() { TIMER_Config myTimConfig; CSL_init(); /*.................网络通信部分.......................*/ CACHE_enableCaching(CACHE_EMIFA_CE00); CACHE_enableCaching(CACHE_EMIFA_CE01); DAT_open(DAT_CHAANY, DAT_PRI_LOW, DAT_OPEN_2D); SCOM_init(); CACHE_setL2Queue(0x3, 0x7); CACHE_setL2Queue(0x1, 0x7); CACHE_setPriL2Req(CACHE_L2PRIHIGH); // create all SCOM and message objects SCOM_create("NETOK", NULL); /*..............................定时器部分............*/
hTimer1 = TIMER_open(TIMER_DEV1, 0); TimerEventId = TIMER_getEventId(hTimer1); IRQ_globalDisable(); IRQ_nmiDisable(); IRQ_globalEnable(); IRQ_nmiEnable(); IRQ_map(TimerEventId, 15); IRQ_reset(TimerEventId); IRQ_reset(IRQ_EVT_EXTINT5); SEEDuartHandleA = SEEDDM642_UART_open(SEEDDM642_UARTA, SEEDDM642_UART_BAUD9600, &UartConfig); /* Open UARTB*/ SEEDuartHandleB = SEEDDM642_UART_open(SEEDDM642_UARTB, SEEDDM642_UART_BAUD9600, &UartConfig);
myTimConfig.cnt = 0x0; myTimConfig.ctl = TimerControl; myTimConfig.prd = 0x00124f8;//1ms定时,即每1ms,cnt计数增1 TIMER_config(hTimer1, &myTimConfig); IRQ_enable(TimerEventId); IRQ_enable(IRQ_EVT_EXTINT5); TIMER_start(hTimer1); } void CLK_cnt() { cnt++; SEEDDM642_UART_putChar(0,cnt);//在串口调试助手中只能接收到前三个cnt的值,不知为什么? }
void Uart_isr(void) { Uint16 Data_Temp; //Int16 status; Data_Temp = SEEDDM642_UART_rget(SEEDuartHandleA,0); SEEDDM642_UART_putChar(0, Data_Temp); }
|