TI的技术人员及各位大牛:
小弟在UART0测试的时候遇到一些问题,状态寄存器LSR在putchar之后值不会改变
参数设置如下:
divisor = (24000000 / baudrate) / 16;
uart_handle = ( UART_Handle )&UART_MODULE_0;
uart_handle->regs->PWREMU_MGMT = 0; // Reset UART TX & RX components
_wait( 100 );
uart_handle->regs->DLL = (divisor & 0xff); // Set baud rate
uart_handle->regs->DLH = (divisor >> 8);
uart_handle->regs->FCR = 0x0007; // Clear UART TX & RX FIFOs
uart_handle->regs->FCR = 0x0000; // Non-FIFO mode
uart_handle->regs->IER = 0x0007; // Enable interrupts
uart_handle->regs->LCR = 0x0003; // 8-bit words,
// 1 STOP bit generated,
// No Parity, No Stick paritiy,
// No Break control
uart_handle->regs->MCR = 0x0000; // RTS & CTS disabled,
// Loopback mode disabled,
// Autoflow disabled
//uart_handle->regs->PWREMU_MGMT = 0xE001; // Enable TX & RX componenets
uart_handle->regs->PWREMU_MGMT = 0x6001;
主要程序如下:
while( EVMDM365_UART_xmtReady( uart0 ) ) // Wait for TX ready
{
if ( timeout-- < 0 )
return -1;
}
EVMDM365_UART_putChar( uart0, tx[i] ); // Write 1 byte
/* RX */
timeout = test_timeout;
while( EVMDM365_UART_rcvReady( uart0 ) ) // Wait for Rx ready
{
if ( timeout-- < 0 )
return -1;
}
EVMDM365_UART_getChar( uart0, &rx[i] ); // Read 1 byte