帮我看看LM4F232H5QD串口1的问题,应该配置对了,怎么不能输入也不能输出???
[复制链接]
void UARTIntHandler(void)
{
unsigned long ulStatus;
ulStatus = ROM_UARTIntStatus(UART1_BASE, true);
ROM_UARTIntClear(UART1_BASE, ulStatus);
while(ROM_UARTCharsAvail(UART1_BASE))
{
ROM_UARTCharPutNonBlocking(UART1_BASE,
ROM_UARTCharGetNonBlocking(UART1_BASE));
}
}
void UARTSend(const unsigned char *pucBuffer, unsigned long ulCount)
{
while(ulCount--)
{
ROM_UARTCharPutNonBlocking(UART1_BASE, *pucBuffer++);
}
}
int main(void)
{
tRectangle sRect;
tContext sContext;
ROM_FPULazyStackingEnable();
ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
GPIOPinConfigure(GPIO_PC4_U1RX);
GPIOPinConfigure(GPIO_PC5_U1TX);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1);
ROM_GPIOPinTypeUART(GPIO_PORTC_BASE, GPIO_PIN_4 | GPIO_PIN_5);
ROM_UARTConfigSetExpClk(UART1_BASE, ROM_SysCtlClockGet(), 115200,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE));
ROM_IntMasterEnable();
ROM_IntEnable(INT_UART1);
ROM_UARTIntEnable(UART1_BASE, UART_INT_RX | UART_INT_RT);
UARTSend((unsigned char *)"usart1 test", 12);
while(1)
{
}
}
串口1实际连接的是PC4【Rx】, PC5【Tx】
|