This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

串口通信中函数extern void UARTprintf(const char *pcString, ...);是通过哪个串口发出去的?

在串口通信中,打开了多个串口,那么函数extern void UARTprintf(const char *pcString, ...);是通过哪个串口发出去的?

  • UARTprintf这个函数来自C:\ti\TivaWare_C_Series-2.1.0.12573\utils\uartstdio.c

    TivaWare中默认的使用串口0。在这个文件中:

    //*****************************************************************************
    //
    // The base address of the chosen UART.
    //
    //*****************************************************************************
    static uint32_t g_ui32Base = 0;

  • 可是很奇怪的是,我两个串口(uart0和uart1)都开了以后,用了打印函数,结果是串口1打印出来的额

  • 调试一下吧,先只打开一个UART看看,然后两个都打开,单步仿真一下,看程序走到哪里了?