diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-10-17 15:51:46 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2023-10-17 15:57:09 +0200 |
| commit | b47864046381cccdef186321fc0d46a1dd2a45be (patch) | |
| tree | 74b09c3924ad6cb756b5fda56ef7587865a9099d /examples/stm32wl/src | |
| parent | 846f2fc6e4d30a12f4da676c5d12147d1910add1 (diff) | |
fix clocks in stm32wl rng example.
Diffstat (limited to 'examples/stm32wl/src')
| -rw-r--r-- | examples/stm32wl/src/bin/random.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/examples/stm32wl/src/bin/random.rs b/examples/stm32wl/src/bin/random.rs index 7c7e8a4e6..70676c704 100644 --- a/examples/stm32wl/src/bin/random.rs +++ b/examples/stm32wl/src/bin/random.rs | |||
| @@ -4,6 +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, MSIRange}; | ||
| 7 | use embassy_stm32::rng::{self, Rng}; | 8 | use embassy_stm32::rng::{self, Rng}; |
| 8 | use embassy_stm32::{bind_interrupts, pac, peripherals}; | 9 | use embassy_stm32::{bind_interrupts, pac, peripherals}; |
| 9 | use {defmt_rtt as _, panic_probe as _}; | 10 | use {defmt_rtt as _, panic_probe as _}; |
| @@ -15,12 +16,10 @@ bind_interrupts!(struct Irqs{ | |||
| 15 | #[embassy_executor::main] | 16 | #[embassy_executor::main] |
| 16 | async fn main(_spawner: Spawner) { | 17 | async fn main(_spawner: Spawner) { |
| 17 | let mut config = embassy_stm32::Config::default(); | 18 | let mut config = embassy_stm32::Config::default(); |
| 18 | config.rcc.mux = embassy_stm32::rcc::ClockSrc::HSE; | 19 | config.rcc.mux = ClockSrc::MSI(MSIRange::RANGE32M); |
| 19 | |||
| 20 | let p = embassy_stm32::init(config); | 20 | let p = embassy_stm32::init(config); |
| 21 | pac::RCC.ccipr().modify(|w| { | 21 | |
| 22 | w.set_rngsel(0b01); | 22 | pac::RCC.ccipr().modify(|w| w.set_rngsel(0b11)); // msi |
| 23 | }); | ||
| 24 | 23 | ||
| 25 | info!("Hello World!"); | 24 | info!("Hello World!"); |
| 26 | 25 | ||
