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.

LP-AM243: How to send data to a specific UART instance

Part Number: LP-AM243
Other Parts Discussed in Thread: SYSCONFIG

I have defined two UART instances. I want to write to console by writing to DebugP_log. I would like different data sent to a terminal window, I am using UART_write for that.

the two instances are autopopulated 

#define CONFIG_UART0 (0U)
#define CONFIG_UART_CONSOLE (1U)

I am receiving data both to the console and to the terminal window connected to UART. The console looks fine but the terminal window gets both strings or no data strings. 

So I am not able to direct the output correctly. The code below is sending the console data to the console, but both data streams out to the terminal window, that is, the terminal window is also getting the string from DebugP_log interlaced with the UART_write.

If I change the UART_write first parameter to gUartHandle[CONFIG_UART0] I get nothing in the terminal window. This part in particular looks wrong is very confusing to me. 

Can you please tell me how, or where the documentation is, to be able to direct the data to a specific UART instance only?

UART_Transaction trans;

UART_Transaction_init(&trans);

DebugP_log("Console out\r\n");

trans.buf = (void *)gUartTxBuffer;

sprintf(trans.buf, "UART out\r\n");

trans.count = strlen(trans.buf);

UART_write(gUartHandle[CONFIG_UART_CONSOLE], &trans);

  • Hi Jeffery,

    By default, the "Debug Log" (in syscfg file, where the DebugP_log configuration) will use UART0 as its output UART port (CONFIG_UART_CONSOLE), i.e. the "UART Instance" in the Debug Log is UART0. If you want to direct the DebugP_Log to UART1 instead, you will need to make the following change in syscfg file:

    Then you will notice the change in the UART (UART0 to UART1):

    Now you can add a new UART instance (CONFIG_UART0) for UART0:

    And the 

    UART_write(gUartHandle[CONFIG_UART_CONSOLE], &trans);

    should be 

    UART_write(gUartHandle[CONFIG_UART0], &trans);

    Because the DebugP_log always goes to CONFIG_UART_CONSOLE.

    Best regards,

    Ming

  • I really feel like the example.sysconfig is buggy. Certainly your setup on the empty project behaves differently. I am not trying to change the behavior of the DebugP_log out to console. What I am trying to do is write out UART to a terminal window. I cannot change the CONFIG_UART_CONSOLE to any other uart instances. I cannot do what you did on the empty project and change it to USART1. That is not an option in example.syscfg. Only USART0 is possible. It is not locked. I cannot delete the CONFIG_UART_CONSOLE. I have now added another uart instance. Just to try something else I set it to USART2. But before I also tried USART1. 

    When I do this

    I get this.

  • Hi Jeffery,

    What board are you using right now? The AM243x EVM or the AM243 LaunchPad?

    If you want multiple UART port, then you have to use the AM243x EVM which has four UART ports (UART0 - 3) through the USB connector J26.

    For AM243x LP, there are only one UART port (UART0) available.

    If the CONFIG_UART_CONSOLE uses the UART0, then the CONFIG_UART2 can use either UART1 or UART2. It will only work for the AM243x EVM though.

    Best regards,

    Ming

  • Yes I am using the LP. I just tried the empty project and it let me change the uart for the console but the behavior was the same. So what I saw was what you described. Thanks!