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.

关于TMS320C6678的uart调试问题



你好:

最近在调试UART中断,调试所用例程为http://www.deyisupport.com/question_answer/dsp_arm/c6000_multicore/f/53/t/8458.aspx提供的例程,调试时发现如下问题:

刚开始程序是可以跑通的,但是我在调试了下其他uart程序之后,这个例程再也无法跑通了,总是卡在函数

int Keystone_uartWrite_Busy(Uint32 uartNumber, char c)
{
 CSL_UartRegs * localUartRegs = (CSL_UartRegs *)((Uint32)UART_Regs + uartNumber * 0x1000);
 while(!((localUartRegs->LSR) & CSL_UART_LSR_TEMT_MASK));
 localUartRegs->RBR = c;

 return 1;
}

的while(!((localUartRegs->LSR) & CSL_UART_LSR_TEMT_MASK));那里,感觉很莫名其妙。请问这是什么原因呢?

很迷惑。

 

  • 这个函数是在对UART做写操作之前检查LSR状态寄存器是否提示BUSY,如果不提示BUSY才能发送,否则死等。如果卡在while循环上的话,应该是之前其他程序的数据没有发完或是在配置UART发送FIFO之后FIFO还没有满而无法完成发送,请进行单板复位或是重新对UART进行初始化来避免其他例程的干扰。具体寄存器配置以及比特位位域描述请参考TI官网上Keystone UART User Guide,多谢!