void UART_INIT()
{
CSL_UartObj uartObj;
CSL_UartHandle hUart;
CSL_UartSetup uartSetup =
{
/* Input clock freq in MHz */
200000000,
/* Baud rate */
115200,
/* Word length of 8 */
CSL_UART_WORD8,
/* To generate 1 stop bit */
0,
/* Disable the parity */
CSL_UART_DISABLE_PARITY,
/* Disable fifo */
/* Enable trigger 14 fifo */
CSL_UART_FIFO_DMA1_DISABLE_TRIG14,
/* Loop Back enable */
CSL_UART_NO_LOOPBACK,
/* No auto flow control*/
CSL_UART_NO_AFE ,
/* No RTS */
CSL_UART_NO_RTS ,
};
UART_init(&uartObj,CSL_UART_INST_0,UART_POLLED);
/* Handle created */
hUart = (CSL_UartHandle)(&uartObj);
/* Configure UART registers using setup structure */
UART_setup(hUart,&uartSetup);
/* Enable the UART Events */
UART_eventEnable(hUart, CSL_UART_RECVOR_REG_DATA_INTERRUPT);
}
void UART_INTC_INIT()
{
// CSL_UartIsrAddr isrAddr;
//
// /* Configure and Register the UART interrupts */
// isrAddr.rbiAddr = uart_rxIsr;
// isrAddr.tbeiAddr = uart_txIsr;
// isrAddr.ctoi = uart_ctoIsr;
// isrAddr.lsiAddr = uart_lsiIsr;
/* Disable interrupt */
IRQ_globalDisable(); //全局中断关闭(INTM=1)
/* Clear any pending interrupts */
IRQ_clearAll();
/* Disable all the interrupts */
IRQ_disableAll();
IRQ_setVecs((Uint32)(&VECSTART)); //设置中断向量入口
/* Configuring Interrupt */
IRQ_plug (UART_EVENT, &UART_intrDispatch);
/* Enabling Interrupt */
IRQ_enable(UART_EVENT);
/* Enabling Interrupt */
IRQ_globalEnable(); //全局中断打开(INTM=0)
}
/* Interrupt vector start address */
void VECSTART();
interrupt void UART_intrDispatch(void)
{
IRQ_disable(UART_EVENT);
UART_SEND(0xcc);
IRQ_enable(UART_EVENT);
}
Tony Tang:
自己对照CSL里的例程看吧:
http://www.ti.com/tool/sprc133
user4117338:
回复 Tony Tang:
你好 我串口中断只能接受前14个字节,然后程序就一直在主函数里正常运行, 14个字节后的数据再往串口中断发送,串口中断不响应,这可能是什么问题啊?
user4117338:
回复 user4117338:
是不是我设置这个缘故造成的?—–Enable trigger 14 fifo ?
Tony Tang:
回复 user4117338:
-Enable trigger 14 fifo 就需要每次中断里给FIFO送14个数据。