Skip to content

Commit ebaece4

Browse files
author
Jiang Jiang Jian
committed
Merge branch 'fix/force_enable_uart0_sclk_in_esp_restart_v5.5' into 'release/v5.5'
fix(esp_system): force enable uart0 sclk in esp_restart (v5.5) See merge request espressif/esp-idf!40346
2 parents cf8dad0 + 577d650 commit ebaece4

File tree

7 files changed

+32
-2
lines changed

7 files changed

+32
-2
lines changed

components/esp_hw_support/port/esp32c5/pmu_param.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ uint32_t get_act_hp_dbias(void)
439439
hp_cali_dbias = 31;
440440
}
441441
} else {
442-
ESP_HW_LOGW(TAG, "hp_cali_dbias not burnt in efuse, use default.");
442+
ESP_HW_LOGD(TAG, "hp_cali_dbias not burnt in efuse, use default.");
443443
}
444444
return hp_cali_dbias;
445445
}
@@ -463,7 +463,7 @@ uint32_t get_act_lp_dbias(void)
463463
lp_cali_dbias = 31;
464464
}
465465
} else {
466-
ESP_HW_LOGW(TAG, "hp_cali_dbias not burnt in efuse, use default.");
466+
ESP_HW_LOGD(TAG, "lp_cali_dbias not burnt in efuse, use default.");
467467
}
468468

469469
return lp_cali_dbias;

components/esp_system/port/soc/esp32c5/system_internal.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "soc/rtc_periph.h"
2323
#include "soc/uart_reg.h"
2424
#include "hal/wdt_hal.h"
25+
#include "hal/uart_ll.h"
2526
#if SOC_MODEM_CLOCK_SUPPORTED
2627
#include "hal/modem_syscon_ll.h"
2728
#include "hal/modem_lpcon_ll.h"
@@ -82,6 +83,10 @@ void IRAM_ATTR esp_system_reset_modules_on_exit(void)
8283
CLEAR_PERI_REG_MASK(PCR_RSA_CONF_REG, PCR_RSA_RST_EN);
8384
SET_PERI_REG_MASK(PCR_SHA_CONF_REG, PCR_SHA_RST_EN);
8485
CLEAR_PERI_REG_MASK(PCR_SHA_CONF_REG, PCR_SHA_RST_EN);
86+
87+
// UART's sclk is controlled in the PCR register and does not reset with the UART module. The ROM missed enabling
88+
// it when initializing the ROM UART. If it is not turned on, it will trigger LP_WDT in the ROM.
89+
uart_ll_sclk_enable(&UART0);
8590
}
8691

8792
/* "inner" restart function for after RTOS, interrupts & anything else on this

components/esp_system/port/soc/esp32c6/system_internal.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "esp_private/rtc_clk.h"
2121
#include "soc/rtc_periph.h"
2222
#include "soc/uart_reg.h"
23+
#include "hal/uart_ll.h"
2324
#include "hal/wdt_hal.h"
2425
#include "hal/modem_syscon_ll.h"
2526
#include "hal/modem_lpcon_ll.h"
@@ -75,6 +76,10 @@ void IRAM_ATTR esp_system_reset_modules_on_exit(void)
7576
CLEAR_PERI_REG_MASK(PCR_HMAC_CONF_REG, PCR_HMAC_RST_EN);
7677
CLEAR_PERI_REG_MASK(PCR_RSA_CONF_REG, PCR_RSA_RST_EN);
7778
CLEAR_PERI_REG_MASK(PCR_SHA_CONF_REG, PCR_SHA_RST_EN);
79+
80+
// UART's sclk is controlled in the PCR register and does not reset with the UART module. The ROM missed enabling
81+
// it when initializing the ROM UART. If it is not turned on, it will trigger LP_WDT in the ROM.
82+
uart_ll_sclk_enable(&UART0);
7883
}
7984

8085
/* "inner" restart function for after RTOS, interrupts & anything else on this

components/esp_system/port/soc/esp32c61/system_internal.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "esp_private/rtc_clk.h"
2121
#include "soc/rtc_periph.h"
2222
#include "soc/uart_reg.h"
23+
#include "hal/uart_ll.h"
2324
#include "hal/wdt_hal.h"
2425
#include "esp_private/cache_err_int.h"
2526

@@ -82,6 +83,10 @@ void IRAM_ATTR esp_system_reset_modules_on_exit(void)
8283
CLEAR_PERI_REG_MASK(PCR_RSA_CONF_REG, PCR_RSA_RST_EN);
8384
SET_PERI_REG_MASK(PCR_SHA_CONF_REG, PCR_SHA_RST_EN);
8485
CLEAR_PERI_REG_MASK(PCR_SHA_CONF_REG, PCR_SHA_RST_EN);
86+
87+
// UART's sclk is controlled in the PCR register and does not reset with the UART module. The ROM missed enabling
88+
// it when initializing the ROM UART. If it is not turned on, it will trigger LP_WDT in the ROM.
89+
uart_ll_sclk_enable(&UART0);
8590
}
8691

8792
/* "inner" restart function for after RTOS, interrupts & anything else on this

components/esp_system/port/soc/esp32h2/system_internal.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "soc/uart_reg.h"
2424
#include "hal/wdt_hal.h"
2525
#include "hal/spimem_flash_ll.h"
26+
#include "hal/uart_ll.h"
2627
#include "esp_private/cache_err_int.h"
2728
#include "esp_private/mspi_timing_tuning.h"
2829

@@ -73,6 +74,10 @@ void IRAM_ATTR esp_system_reset_modules_on_exit(void)
7374
CLEAR_PERI_REG_MASK(PCR_HMAC_CONF_REG, PCR_HMAC_RST_EN);
7475
CLEAR_PERI_REG_MASK(PCR_RSA_CONF_REG, PCR_RSA_RST_EN);
7576
CLEAR_PERI_REG_MASK(PCR_SHA_CONF_REG, PCR_SHA_RST_EN);
77+
78+
// UART's sclk is controlled in the PCR register and does not reset with the UART module. The ROM missed enabling
79+
// it when initializing the ROM UART. If it is not turned on, it will trigger LP_WDT in the ROM.
80+
uart_ll_sclk_enable(&UART0);
7681
}
7782

7883
/* "inner" restart function for after RTOS, interrupts & anything else on this

components/esp_system/port/soc/esp32h21/system_internal.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "esp_private/rtc_clk.h"
2121
#include "soc/rtc_periph.h"
2222
#include "soc/uart_reg.h"
23+
#include "hal/uart_ll.h"
2324
#include "hal/wdt_hal.h"
2425
#include "hal/spimem_flash_ll.h"
2526
#include "esp_private/cache_err_int.h"
@@ -77,6 +78,10 @@ void IRAM_ATTR esp_system_reset_modules_on_exit(void)
7778
CLEAR_PERI_REG_MASK(PCR_RSA_CONF_REG, PCR_RSA_RST_EN);
7879
SET_PERI_REG_MASK(PCR_SHA_CONF_REG, PCR_SHA_RST_EN);
7980
CLEAR_PERI_REG_MASK(PCR_SHA_CONF_REG, PCR_SHA_RST_EN);
81+
82+
// UART's sclk is controlled in the PCR register and does not reset with the UART module. The ROM missed enabling
83+
// it when initializing the ROM UART. If it is not turned on, it will trigger LP_WDT in the ROM.
84+
uart_ll_sclk_enable(&UART0);
8085
}
8186

8287
/* "inner" restart function for after RTOS, interrupts & anything else on this

components/esp_system/port/soc/esp32h4/system_internal.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "soc/rtc_periph.h"
2121
#include "soc/uart_reg.h"
2222
#include "hal/wdt_hal.h"
23+
#include "hal/uart_ll.h"
2324

2425
#include "esp32h4/rom/cache.h"
2526
// TODO: IDF-11911 need refactor
@@ -69,6 +70,10 @@ void IRAM_ATTR esp_system_reset_modules_on_exit(void)
6970
CLEAR_PERI_REG_MASK(PCR_HMAC_CONF_REG, PCR_HMAC_RST_EN);
7071
SET_PERI_REG_MASK(PCR_SHA_CONF_REG, PCR_SHA_RST_EN);
7172
CLEAR_PERI_REG_MASK(PCR_SHA_CONF_REG, PCR_SHA_RST_EN);
73+
74+
// UART's sclk is controlled in the PCR register and does not reset with the UART module. The ROM missed enabling
75+
// it when initializing the ROM UART. If it is not turned on, it will trigger LP_WDT in the ROM.
76+
uart_ll_sclk_enable(&UART0);
7277
}
7378

7479
/* "inner" restart function for after RTOS, interrupts & anything else on this

0 commit comments

Comments
 (0)