configure RCC to use 48MHz MSI as system clock

This commit is contained in:
2026-02-24 23:47:16 +01:00
parent adc3f0aada
commit 2adface93b
2 changed files with 10 additions and 3 deletions

View File

@@ -23,4 +23,4 @@ chrono = { version = "^0.4", default-features = false }
[profile.release]
debug = 2
opt-level = "s"
opt-level = 3

View File

@@ -3,13 +3,20 @@
use defmt::*;
use embassy_executor::Spawner;
use embassy_stm32::gpio::{Level, Output, Speed};
use embassy_stm32::{Config, gpio::{Level, Output, Speed}, rcc::{MSIRange, Sysclk, mux}};
use embassy_time::Timer;
use {defmt_rtt as _, panic_probe as _};
#[embassy_executor::main]
async fn main(_spawner: Spawner) {
let p = embassy_stm32::init(Default::default());
let mut config = Config::default();
{
config.rcc.msi = Some(MSIRange::RANGE48M);
config.rcc.sys = Sysclk::MSI;
config.rcc.mux.rngsel = mux::Rngsel::MSI;
config.enable_debug_during_sleep = true;
}
let p = embassy_stm32::init(config);
info!("hiiiiiiii :3");
let mut led = Output::new(p.PB5, Level::High, Speed::Low);