From 26cb7f0ded33653dfd862bc97c1c6280a997b6b2 Mon Sep 17 00:00:00 2001 From: dragonmux Date: Mon, 13 May 2024 23:23:24 +0100 Subject: [PATCH] stm32/h7: Implemented support for the LSI clock source --- include/libopencm3/stm32/h7/rcc.h | 5 +++++ lib/stm32/h7/rcc.c | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/include/libopencm3/stm32/h7/rcc.h b/include/libopencm3/stm32/h7/rcc.h index 8176956b..50909dba 100644 --- a/include/libopencm3/stm32/h7/rcc.h +++ b/include/libopencm3/stm32/h7/rcc.h @@ -778,6 +778,11 @@ void rcc_clock_setup_pll(const struct rcc_pll_config *config); */ void rcc_clock_setup_hsi48(void); +/** + * Setup and bring up the LSI. + */ +void rcc_clock_setup_lsi(void); + /** * Get the clock rate (in Hz) of the specified clock source. There are * numerous clock sources and configurations on the H7, so rates for each diff --git a/lib/stm32/h7/rcc.c b/lib/stm32/h7/rcc.c index 9393edc5..c46b42fb 100644 --- a/lib/stm32/h7/rcc.c +++ b/lib/stm32/h7/rcc.c @@ -230,6 +230,13 @@ void rcc_clock_setup_hsi48(void) continue; } +void rcc_clock_setup_lsi(void) +{ + RCC_CSR |= RCC_CSR_LSION; + while (!(RCC_CSR & RCC_CSR_LSIRDY)) + continue; +} + uint32_t rcc_get_bus_clk_freq(enum rcc_clock_source source) { uint32_t clksel; switch (source) {