Page 1 of 1

Using LOG on UART0 and console example on UART1?

Posted: Tue Dec 26, 2017 5:45 pm
by ufanders
Hi guys,

I'm trying to use the console example on UART1 and keep the logging functionality on UART0. I modified the console.c code to use UART1 like so:

Code: Select all

/* Install UART driver for interrupt-driven reads and writes */
    ESP_ERROR_CHECK( uart_driver_install(/*CONFIG_CONSOLE_UART_NUM*/ 1,
            256, 0, 0, NULL, 0) );

    /* Tell VFS to use UART driver */
    esp_vfs_dev_uart_use_driver(/*CONFIG_CONSOLE_UART_NUM*/ 1);
However, when I run this I get crazy output on UART0:
This is an example of ESP-IDF console component.
Type 'help' to get the list of commands.
Use UP/DOWN arrows to navigate through command history.
Press TAB when typing command name to auto-complete.
>
>

...

> ;1R;3R;;1R;3[25R;1[25R;1R;1R25R;1R;1R;3R;1R;1R;3R3R;1R;1R;3R;1R;1R;3R;1R;1R;3R;1R;1R;3R
Unrecognized command
>
>
It looks like Linenoise and LOG might be using the same stdin/stdout/stderr.

Is there a way to redirect the printf() streams, create new streams or make the LOG and console coexist on differnet UARTs?

=]

Re: Using LOG on UART0 and console example on UART1?

Posted: Wed Feb 24, 2021 2:20 pm
by ESP_Sara
hi,
you can enable ESP_CONSOLE_MULTIPLE_UART and select which UART you want to use for console.