mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
bugfix(ble): workaround to avoid ble rtc not work when power up
This commit is contained in:
parent
c686e23038
commit
b2cc9800d0
@ -17,6 +17,7 @@
|
|||||||
#include "esp_private/esp_pmu.h"
|
#include "esp_private/esp_pmu.h"
|
||||||
#include "esp_sleep.h"
|
#include "esp_sleep.h"
|
||||||
#include "hal/efuse_hal.h"
|
#include "hal/efuse_hal.h"
|
||||||
|
#include "hal/clk_tree_ll.h"
|
||||||
|
|
||||||
// Please define the frequently called modules in the low bit,
|
// Please define the frequently called modules in the low bit,
|
||||||
// which will improve the execution efficiency
|
// which will improve the execution efficiency
|
||||||
@ -354,10 +355,29 @@ void modem_clock_select_lp_clock_source(periph_module_t module, modem_clock_lpcl
|
|||||||
|
|
||||||
#if SOC_BT_SUPPORTED
|
#if SOC_BT_SUPPORTED
|
||||||
case PERIPH_BT_MODULE:
|
case PERIPH_BT_MODULE:
|
||||||
|
#if CONFIG_IDF_TARGET_ESP32H2
|
||||||
|
bool rc_clk_en = true;
|
||||||
|
bool selected = (src == MODEM_CLOCK_LPCLK_SRC_MAIN_XTAL) ||
|
||||||
|
(src == MODEM_CLOCK_LPCLK_SRC_RC_SLOW);
|
||||||
|
if (selected) {
|
||||||
|
rc_clk_en = clk_ll_rc32k_is_enabled();
|
||||||
|
if (!rc_clk_en) {
|
||||||
|
clk_ll_rc32k_enable();
|
||||||
|
}
|
||||||
|
modem_clock_hal_select_ble_rtc_timer_lpclk_source(MODEM_CLOCK_instance()->hal, MODEM_CLOCK_LPCLK_SRC_RC32K);
|
||||||
|
}
|
||||||
|
#endif // CONFIG_IDF_TARGET_ESP32H2
|
||||||
modem_clock_hal_deselect_all_ble_rtc_timer_lpclk_source(MODEM_CLOCK_instance()->hal);
|
modem_clock_hal_deselect_all_ble_rtc_timer_lpclk_source(MODEM_CLOCK_instance()->hal);
|
||||||
modem_clock_hal_select_ble_rtc_timer_lpclk_source(MODEM_CLOCK_instance()->hal, src);
|
modem_clock_hal_select_ble_rtc_timer_lpclk_source(MODEM_CLOCK_instance()->hal, src);
|
||||||
modem_clock_hal_set_ble_rtc_timer_divisor_value(MODEM_CLOCK_instance()->hal, divider);
|
modem_clock_hal_set_ble_rtc_timer_divisor_value(MODEM_CLOCK_instance()->hal, divider);
|
||||||
modem_clock_hal_enable_ble_rtc_timer_clock(MODEM_CLOCK_instance()->hal, true);
|
modem_clock_hal_enable_ble_rtc_timer_clock(MODEM_CLOCK_instance()->hal, true);
|
||||||
|
#if CONFIG_IDF_TARGET_ESP32H2
|
||||||
|
if (!rc_clk_en) {
|
||||||
|
extern void esp_ble_rtc_ticks_delay(uint32_t ticks);
|
||||||
|
esp_ble_rtc_ticks_delay(2);
|
||||||
|
clk_ll_rc32k_disable();
|
||||||
|
}
|
||||||
|
#endif // CONFIG_IDF_TARGET_ESP32H2
|
||||||
#if SOC_BLE_USE_WIFI_PWR_CLK_WORKAROUND
|
#if SOC_BLE_USE_WIFI_PWR_CLK_WORKAROUND
|
||||||
if (efuse_hal_chip_revision() != 0) {
|
if (efuse_hal_chip_revision() != 0) {
|
||||||
if (src == MODEM_CLOCK_LPCLK_SRC_MAIN_XTAL) {
|
if (src == MODEM_CLOCK_LPCLK_SRC_MAIN_XTAL) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user