Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions firmware/targets/f7/furi_hal/furi_hal_clock.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include <furi_hal_clock.h>
#include <furi_hal_resources.h>
#include <furi_hal_rtc.h>
#include <furi.h>

#include <stm32wbxx_ll_pwr.h>
Expand Down Expand Up @@ -143,7 +142,10 @@ void furi_hal_clock_switch_to_hsi() {
}

void furi_hal_clock_switch_to_pll() {
#ifdef FURI_HAL_CLOCK_TRACK_STARTUP
uint32_t clock_start_time = DWT->CYCCNT;
#endif

LL_RCC_HSE_Enable();
LL_RCC_PLL_Enable();
LL_RCC_PLLSAI1_Enable();
Expand All @@ -166,11 +168,12 @@ void furi_hal_clock_switch_to_pll() {
while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL)
;

#ifdef FURI_HAL_CLOCK_TRACK_STARTUP
uint32_t total = DWT->CYCCNT - clock_start_time;
if(total > (20 * 0x148)) {
furi_hal_rtc_set_flag(FuriHalRtcFlagLegacySleep);
furi_crash("Slow HSE/PLL startup");
}
#endif
}

void furi_hal_clock_suspend_tick() {
Expand Down