diff options
| author | Kevin Lannen <[email protected]> | 2023-06-14 10:44:51 -0600 |
|---|---|---|
| committer | Kevin Lannen <[email protected]> | 2023-06-14 10:44:51 -0600 |
| commit | c94ba8489289789e295a248720c96040b2dc724c (patch) | |
| tree | 0cf8512e0c3bdcc1787583e5a51ca0dbe977abe0 /examples | |
| parent | c822fd46e558fc694bbec3358f31076e89d99164 (diff) | |
stm32g4: PLL: Add support for configuring PLL_P and PLL_Q
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/stm32g4/src/bin/pll.rs | 15 |
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 | ||
| 5 | use defmt::*; | 5 | use defmt::*; |
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_stm32::rcc::{ClockSrc, PllM, PllN, PllR, PllSrc}; | 7 | use embassy_stm32::rcc::{ClockSrc, Pll, PllM, PllN, PllR, PllSrc}; |
| 8 | use embassy_stm32::Config; | 8 | use embassy_stm32::Config; |
| 9 | use embassy_time::{Duration, Timer}; | 9 | use embassy_time::{Duration, Timer}; |
| 10 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| @@ -13,8 +13,17 @@ use {defmt_rtt as _, panic_probe as _}; | |||
| 13 | async fn main(_spawner: Spawner) { | 13 | async 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!"); |
