Skip to content

Commit 2bd3931

Browse files
author
Jiang Jiang Jian
committed
Merge branch 'fix/force_enable_uart0_sclk_in_esp_restart' into 'master'
fix(esp_system): force enable uart0 sclk in esp_restart Closes PM-423 and PM-424 See merge request espressif/esp-idf!40196
2 parents f9c7d37 + f5cd1d8 commit 2bd3931

File tree

9 files changed

+36
-6
lines changed

9 files changed

+36
-6
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, "lp_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_hw_support/port/esp32c61/pmu_param.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ uint32_t get_act_hp_dbias(void)
434434
hp_cali_dbias = 31;
435435
}
436436
} else {
437-
ESP_HW_LOGW(TAG, "hp_cali_dbias not burnt in efuse, use default.");
437+
ESP_HW_LOGD(TAG, "hp_cali_dbias not burnt in efuse, use default.");
438438
}
439439
return hp_cali_dbias;
440440
}
@@ -457,7 +457,7 @@ uint32_t get_act_lp_dbias(void)
457457
lp_cali_dbias = 31;
458458
}
459459
} else {
460-
ESP_HW_LOGW(TAG, "lp_cali_dbias not burnt in efuse, use default.");
460+
ESP_HW_LOGD(TAG, "lp_cali_dbias not burnt in efuse, use default.");
461461
}
462462
return lp_cali_dbias;
463463
}

components/esp_hw_support/port/esp32p4/pmu_param.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ uint32_t get_act_hp_dbias(void)
345345
hp_cali_dbias = 31;
346346
}
347347
} else {
348-
ESP_HW_LOGW(TAG, "hp_cali_dbias not burnt in efuse, use default.");
348+
ESP_HW_LOGD(TAG, "hp_cali_dbias not burnt in efuse, use default.");
349349
}
350350
return hp_cali_dbias;
351351
}
@@ -367,7 +367,7 @@ uint32_t get_act_lp_dbias(void)
367367
lp_cali_dbias = 31;
368368
}
369369
} else {
370-
ESP_HW_LOGW(TAG, "lp_cali_dbias not burnt in efuse, use default.");
370+
ESP_HW_LOGD(TAG, "lp_cali_dbias not burnt in efuse, use default.");
371371
}
372372
return lp_cali_dbias;
373373
}

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 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 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 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 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 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
@@ -21,6 +21,7 @@
2121
#include "soc/rtc_periph.h"
2222
#include "soc/uart_reg.h"
2323
#include "hal/wdt_hal.h"
24+
#include "hal/uart_ll.h"
2425

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

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

0 commit comments

Comments
 (0)