TI工程师,你好。
我在调试OMAPL137的定时器时遇到如下问题:
连接仿真器的情况下定时器可以正常运行,但是从FLASH加载后定时器无法正常工作(确定FLASH烧写和加载均正常)
定时器使用的是TIMER0的TIM34,双32位,unchained模式,工作方式为连续。
代码如下:
*TIMER0_TGCR = 0x0104;//0x04;
OMAPL137_UART_putChar(uart1,0x1); // 从串口输出
_wait(15000);
*TIMER0_TGCR = *TIMER0_TGCR | 0x3; // remove from reset
OMAPL137_UART_putChar(uart1,0x2);
_wait(15000);
*TIMER0_PRD34 = 0x47ff;
OMAPL137_UART_putChar(uart1,0x3);
_wait(15000);
*TIMER0_INTCTLSTAT = 0x00020000;//0x00010000; //关闭timer int
OMAPL137_UART_putChar(uart1,0x4);
_wait(15000);
*TIMER0_TCR = 0x00800000; // mode1 enable
OMAPL137_UART_putChar(uart1,0x5);
_wait(15000);
IER = 0xFFFF; // 使能中断INT8
OMAPL137_UART_putChar(uart1,0x6);
_wait(15000);
*((unsigned int *)0x01800108) = 0x00000040; // 中断挂接 evt40 -> INT8
OMAPL137_UART_putChar(uart1,0x7);
_wait(15000);
*TIMER0_INTCTLSTAT = 0x00010000; //0x00020000; //使能timer int
OMAPL137_UART_putChar(uart1,0x8);
_wait(15000);
脱机运行发现每次串口输出完0x1后就再无输出,故推断是执行*TIMER0_TGCR = *TIMER0_TGCR | 0x3语句,打开定时器造成死机。
该问题已经困扰了好几天,项目进度比较急,工程师大大拜托啦!!