完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
使用LM4F232H5QC这个片子的Uart2(PD6,PD7)的时候发现MCU可以接收到PC端的数据,但是无法发送数据,用示波器测了下PD7这个管脚,发现MCU发送数据时该管脚上无波形输出,MCU收数据的时候是有波形的。 使用GPIO将PD7这个管脚拉高拉低都没有问题,但是配置成Uart7就无法输出Uart数据,这是怎么回事儿呢? 代码: 系统初始化 Void main() [ //Task_Params taskParams; /* IO init s*/ ROM_FPULazyStackingEnable(); ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOH); ROM_GPIOPinTypeGPIOOutput(GPIO_PORTH_BASE, GPIO_PIN_2); GPIOPinWrite(GPIO_PORTH_BASE, GPIO_PIN_2, 0x04); ConfigureUART2(); UARTprintf("****************************************************n"); UARTprintf("***********XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX**********n"); UARTprintf("****************************************************n"); /* IO init e*/ WatchDogInit(); /* enable watchdog1 */ BIOS_start(); /* enable interrupts and start SYS/BIOS */ ] void ConfigureUART2(void) [ MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART2); MAP_GPIOPinConfigure(GPIO_PD6_U2RX); MAP_GPIOPinConfigure(GPIO_PD7_U2TX); MAP_GPIOPinTypeUART(GPIO_PORTD_BASE, GPIO_PIN_6 | GPIO_PIN_7); MAP_UARTConfigSetExpClk(UART2_BASE, ROM_SysCtlClockGet(), 115200,(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE)); MAP_UARtintDisable(UART2_BASE, 0xFFFFFFFF); MAP_UARTIntEnable(UART2_BASE, UART_INT_RX | UART_INT_RT); MAP_IntEnable(INT_UART2); MAP_UARTEnable(UART2_BASE); ] /*Data Receive*/ void DebugIntHandler(UArg arg) [ Type_sWord aubRet; UARTIntClear(UART2_BASE, UART_INT_RX | UART_INT_RT); UARTRxErrorClear(UART2_BASE); aubRet=UARTCharGetNonBlocking(UART2_BASE); if(aubRet!=-1) [ UARTprintf("****************** UART2 ISR ok *********************n"); //UARTprintf("%c",aubRet); wvdDebugLogRcvIntData(aubRet); ] ] /*Data Transimit*/ void UARTprintf(const Type_uByte *pcString, ...) [ va_list vaArgP; // // Start the varargs processing. // va_start(vaArgP, pcString); UARTvprintf(pcString, vaArgP); // // We're finished with the varargs now. // va_end(vaArgP); ] void UARTvprintf(const Type_uByte *pcString, va_list vaArgP) [ Type_sWord ui32Idx, ui32Value, ui32Pos, ui32Count, ui32Base, ui32Neg; Type_uByte *pcStr, PCBuf[16], cFill; // // Loop while there are more characters in the string. // while(*pcString) [ // // Find the first non-% character, or the end of the string. // for(ui32Idx = 0; (pcString[ui32Idx] != '%') && (pcString[ui32Idx] != ' |