Răsfoiți Sursa

Merge branch 'bugfix/esp32s2_startup_garbled_output' into 'master'

esp_system: fix garbled UART output on startup on esp32s2

Closes IDFGH-7615

See merge request espressif/esp-idf!18549
morris 3 ani în urmă
părinte
comite
d178d1d58a
1 a modificat fișierele cu 6 adăugiri și 0 ștergeri
  1. 6 0
      components/esp_system/port/soc/esp32s2/clk.c

+ 6 - 0
components/esp_system/port/soc/esp32s2/clk.c

@@ -71,6 +71,12 @@ static void select_rtc_slow_clk(slow_clk_sel_t slow_clk);
     soc_reset_reason_t rst_reas = esp_rom_get_reset_reason(0);
     if (rst_reas == RESET_REASON_CHIP_POWER_ON) {
         cfg.cali_ocode = 1;
+        /* Ocode calibration will switch to XTAL frequency, need to wait for UART FIFO
+         * to be empty, to avoid garbled output.
+         */
+        if (CONFIG_ESP_CONSOLE_UART_NUM >= 0) {
+            esp_rom_uart_tx_wait_idle(CONFIG_ESP_CONSOLE_UART_NUM);
+        }
     }
     rtc_init(cfg);