Skip to content

Commit 7fedc2c

Browse files
committed
fix(build): Update APB frequency set routine
1 parent 72a582b commit 7fedc2c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cores/esp32/esp32-hal-cpu.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
#include "soc/efuse_reg.h"
2727
#include "esp32-hal.h"
2828
#include "esp32-hal-cpu.h"
29+
#include "hal/timer_ll.h"
30+
#include "esp_private/systimer.h"
2931

3032
#include "esp_system.h"
3133
#ifdef ESP_IDF_VERSION_MAJOR // IDF 4+
@@ -246,7 +248,11 @@ bool setCpuFrequencyMhz(uint32_t cpu_freq_mhz) {
246248
//Update APB Freq REG
247249
rtc_clk_apb_freq_update(apb);
248250
//Update esp_timer divisor
251+
#if defined(LACT_MODULE) && defined(LACT_TICKS_PER_US)
252+
timer_ll_set_lact_clock_prescale(TIMER_LL_GET_HW(LACT_MODULE), apb / MHZ / LACT_TICKS_PER_US);
253+
#else
249254
esp_timer_impl_update_apb_freq(apb / MHZ);
255+
#endif
250256
}
251257
#endif
252258
//Update FreeRTOS Tick Divisor

0 commit comments

Comments
 (0)