K10 的两个串口,一样的设置,FIFO为8,uart1中断接收正常;uart0却始终不正确,FIFO改成单个字节接收后,uart0能正常中断接收。
FIFO设置如下:
uartch->PFIFO |= UART_PFIFO_RXFE_MASK;
uartch->RWFIFO = 8;
uartch->CFIFO |= (UART_CFIFO_RXFLUSH_MASK | UART_CFIFO_TXFLUSH_MASK);
附上中断处理函数,依靠检测S1 RDRF,IDLE中断来完成收发。接收时能进入中断,并且在UART1上是正常的。就不知在UART0上就不正常了?
void UART0_RX_TX_IRQHandler(void)
{
/* Check receiver */
if (UART0->S1 & UART_S1_RDRF_MASK)
{
count = UART0->RCFIFO;
for (i = 0; i < count; i++)
{
data_byte = UART0->D;
Put(&Receive_Fifo, data_byte);
}
}
/* Check receiving idle */
if (UART0->S1 & UART_S1_IDLE_MASK)
{
count = UART0->RCFIFO;
if (count == 0)
{
data_byte = UART0->D;
UART0->CFIFO |= UART_CFIFO_RXFLUSH_MASK;
}
else
{
for (i = 0; i < count; i++)
{
data_byte = UART0->D;
Put(&Receive_Fifo, data_byte);
}
}
}
} |