aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorKevin Lannen <[email protected]>2023-06-14 10:44:51 -0600
committerKevin Lannen <[email protected]>2023-06-14 10:44:51 -0600
commitc94ba8489289789e295a248720c96040b2dc724c (patch)
tree0cf8512e0c3bdcc1787583e5a51ca0dbe977abe0 /examples
parentc822fd46e558fc694bbec3358f31076e89d99164 (diff)
stm32g4: PLL: Add support for configuring PLL_P and PLL_Q
Diffstat (limited to 'examples')
-rw-r--r--examples/stm32g4/src/bin/pll.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/examples/stm32g4/src/bin/pll.rs b/examples/stm32g4/src/bin/pll.rs
index 8cee41e9b..ef7d4800c 100644
--- a/examples/stm32g4/src/bin/pll.rs
+++ b/examples/stm32g4/src/bin/pll.rs
@@ -4,7 +4,7 @@
4 4
5use defmt::*; 5use defmt::*;
6use embassy_executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_stm32::rcc::{ClockSrc, PllM, PllN, PllR, PllSrc}; 7use embassy_stm32::rcc::{ClockSrc, Pll, PllM, PllN, PllR, PllSrc};
8use embassy_stm32::Config; 8use embassy_stm32::Config;
9use embassy_time::{Duration, Timer}; 9use embassy_time::{Duration, Timer};
10use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
@@ -13,8 +13,17 @@ use {defmt_rtt as _, panic_probe as _};
13async fn main(_spawner: Spawner) { 13async fn main(_spawner: Spawner) {
14 let mut config = Config::default(); 14 let mut config = Config::default();
15 15
16 // Configure PLL to max frequency of 170 MHz 16 config.rcc.pll = Some(Pll {
17 config.rcc.mux = ClockSrc::PLLCLK(PllSrc::HSI16, PllM::Div4, PllN::Mul85, PllR::Div2); 17 source: PllSrc::HSI16,
18 prediv_m: PllM::Div4,
19 mul_n: PllN::Mul85,
20 div_p: None,
21 div_q: None,
22 // Main system clock at 170 MHz
23 div_r: Some(PllR::Div2),
24 });
25
26 config.rcc.mux = ClockSrc::PLL;
18 27
19 let _p = embassy_stm32::init(config); 28 let _p = embassy_stm32::init(config);
20 info!("Hello World!"); 29 info!("Hello World!");