我用CSL编写uart中断接收数据并发送出去,但是当我用串口调试助手发送数据时,RBR中的数据和我发送的不一样,而且也并没有收到uart发出的数据
void UART_init();
void UART_int();
int main(void)
[
UART_init();
UART_int();
while(1);
]
void UAR
tisr()
[
int rxData = 0;
IntEventClear(CSL_INTC_EVENTID_UARTINT0);
rxData = UART_charGetNonBlocking_v0(CSL_UART_0_REGS);
UART_charPut_v0(CSL_UART_0_REGS, rxData);
]
void UART_init()
[
int divisor = 0;
int intFlag;
UART_operatingModeSelect_v0(CSL_UART_0_REGS, UART16x_OPER_MODE);
UART_pwremuConfig_v0(CSL_UART_0_REGS, 0x00006003);
UART_fIFORegisterWrite_v0(CSL_UART_0_REGS, 0x00000000);
UART_breakCtl_v0(CSL_UART_0_REGS, UART_BREAK_COND_DISABLE);
divisor = UART_divisorValCompute_v0(150000000, 9600, UART16x_OPER_MODE);
UART_divisorLatchWrite_v0(CSL_UART_0_REGS, divisor);
UART_divisorLatchDisable_v0(CSL_UART_0_REGS);
UART_lineCharacConfig_v0(CSL_UART_0_REGS, (CSL_UART_LCR_WLS__8BITS | CSL_UART_LCR_STB__1BIT), UART_PARITY_NONE);
intFlag = (UART_INT_LINE_STAT | UART_INT_RHR_CTI);
UART_intEnable_v0(CSL_UART_0_REGS, intFlag);
]
void UART_int()
[
Intc_SystemDisable ();
Intc_Init ();
IntEventMap (C674X_MASK_INT4, CSL_INTC_EVENTID_UARTINT0);
Intc_IntRegister (C674X_MASK_INT4, UARTIsr);
Intc_IntEnable (C674X_MASK_INT4);
Intc_SystemEnable ();
]