主题中讨论的其他器件:TM4C123
工具/软件:Code Composer Studio
嗨、大家好、
我已经学习了 TM4C123一段时间、并且在连接到不同的 UART 引脚时遇到了问题。 由于我尝试在同一控制器上运行 SensHub 和 HC-06、我受到了我可以连接到哪些引脚的限制、因此我尝试将 UART1示例移动到 UART3、并且在遵循工作簿和数据表的同时、我无法看到错误的位置。
当使用 UART 1运行时、代码和输出为:
#include #include #include "inc/hw_ints.h" #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "driverlib/GPIO.h" #include "driverlib/interrupt.h" #include "driverlib/pin_map.h" #include "SysCtlSysCtl_SysSet.h (SysCtl_sysctl );#sysct1_sysctl (#sysctl 1) GPIOPinConfigure (GPIO_PB0_U1RX); GPIOPinConfigure (GPIO_PB1_U1TX); GPIOPinTypeUART (GPIO_PORTB_BASE、GPIO_PIN_0 | GPIO_PIN_1); UARTClockSourceSet (UART1_BASE、 UART_CLOCK_PIOSC);//16MHz 晶体示波器 UARTStdioConfig (1、38400、16000000);//端口1、波特率、 16MHz oscill IntMasterEnable ();//启用处理器中断 IntEnable (INT_UART1);//启用 UART 中断 UARTIntEnable (UART1_BASE、UART_INT_RX | UART_INT_RT);//仅启用 RX 和 TX 中断 UARTCharPut (UART1_BASE、'E'); UART1_UART1_BASE (UART1_UART1_UART1_UART1_BASE); "T"); UARTCharPut (UART1_BASE、"e"); UARTCharPut (UART1_BASE、"r"); UARTCharPut (UART1_base、'); UARTCharPut (UART1_base、'T'); UARTCharPut (UART1_base、 'e'); UARTCharPut (UART1_base、'x'); UARTCharPut (UART1_base、't'); UARTCharPut (UART1_base、':'); UARTCharPut (UART1_base、'); while (1)//let 中断处理程序执行 UART 回显函 数{ // if (UARTCharsAvail (UART0_BASE)) UARTCharPut (UART0_BASE、UARTCharGet (UART0_BASE)); } void UARTIntHandler (void) { uint32_t ui32Status; ui32Status = UART1_base、true ); }UART1_中断/清除 UART1_BASE (UART1) UARTCharPutNonBlocking (UART1_base、UARTCharGetNonBlocking (UART1_base));//echo 字符 }
但是、当尝试切换到 UART 3时、我不会获得任何输出。 代码为:
实际上、该版本似乎停留在第一个字符上。
#include #include #include "inc/hw_ints.h" #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "driverlib/GPIO.h" #include "driverlib/interrupt.h" #include "driverlib/pin_map.h" #include "SysCtlSysCtl_SysSet.h (SysCtl_sysctl );#sysct1_sysctl (#sysctol_sytl )#include "sysct_sysctl (s_sysctl) GPIOPinConfigure (GPIO_PC6_U3RX); GPIOPinConfigure (GPIO_PC7_U3TX); GPIOPinTypeUART (GPIO_PORTC_BASE、GPIO_PIN_6 | GPIO_PIN_7); UARTClockSourceSet (UART3_base、 UART_CLOCK_PIOSC);//16MHz 晶体示波器 UARTStdioConfig (3、38400、16000000);//端口1、波特率、 16MHz oscill IntMasterEnable ();//启用处理器中断 IntEnable (INT_UART3);//启用 UART 中断 UARTIntEnable (UART3_base、UART_INT_RX | UART_INT_RT);//仅启用 RX 和 TX 中断 UARTCharPut (UART3_base、'E'); UART3_PUt (UART3_base、UART3_BASE); "T"); UARTCharPut (UART3_base、'e'); UARTCharPut (UART3_base、'r'); UARTCharPut (UART3_base、'); UARTCharPut (UART3_base、'T'); UARTCharPut (UART3_base、 'e'); UARTCharPut (UART3_base、'x'); UARTCharPut (UART3_base、't'); UARTCharPut (UART3_base、':'); UARTCharPut (UART3_base、'); while (1)//let 中断处理程序执行 UART 回显函 数{ } void UARTIntHandler (void) { uint32_t ui32Status; ui32Status = UART3_base (UART3_base) ;while UART32_unt (UART32_base)、while (UART32_click)、/uchar)、while (uART32_base)、/uart/uart/uart/uchar (while)、while (uART32_base)、/uart/u UARTCharPutNonBlocking (UART3_base、UARTCharGetNonBlocking (UART3_base));//echo 字符 }
感谢您的任何帮助或建议。

