diff --git a/components/console/esp_console_repl.c b/components/console/esp_console_repl.c index 839029a03b..c99e1c4b69 100644 --- a/components/console/esp_console_repl.c +++ b/components/console/esp_console_repl.c @@ -225,16 +225,24 @@ esp_err_t esp_console_new_repl_uart(const esp_console_dev_uart_config_t *dev_con /* Configure UART. Note that REF_TICK/XTAL is used so that the baud rate remains * correct while APB frequency is changing in light sleep mode. */ +#if SOC_UART_SUPPORT_REF_TICK + uart_sclk_t clk_source = UART_SCLK_REF_TICK; + // REF_TICK clock can't provide a high baudrate + if (dev_config->baud_rate > 1 * 1000 * 1000) { + clk_source = UART_SCLK_DEFAULT; + ESP_LOGW(TAG, "light sleep UART wakeup might not work at the configured baud rate"); + } +#elif SOC_UART_SUPPORT_XTAL_CLK + uart_sclk_t clk_source = UART_SCLK_XTAL; +#else + #error "No UART clock source is aware of DFS" +#endif // SOC_UART_SUPPORT_xxx const uart_config_t uart_config = { .baud_rate = dev_config->baud_rate, .data_bits = UART_DATA_8_BITS, .parity = UART_PARITY_DISABLE, .stop_bits = UART_STOP_BITS_1, -#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 - .source_clk = UART_SCLK_REF_TICK, -#else - .source_clk = UART_SCLK_XTAL, -#endif + .source_clk = clk_source, }; uart_param_config(dev_config->channel, &uart_config); @@ -484,9 +492,9 @@ static void esp_console_repl_task(void *args) /* This message shall be printed here and not earlier as the stdout * has just been set above. */ printf("\r\n" - "Type 'help' to get the list of commands.\r\n" - "Use UP/DOWN arrows to navigate through command history.\r\n" - "Press TAB when typing command name to auto-complete.\r\n"); + "Type 'help' to get the list of commands.\r\n" + "Use UP/DOWN arrows to navigate through command history.\r\n" + "Press TAB when typing command name to auto-complete.\r\n"); if (linenoiseIsDumbMode()) { printf("\r\n"