diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-10-23 16:21:17 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-10-23 16:21:17 +0000 |
| commit | d673f8a865930d78b4bc863eadd8dd15850e54fe (patch) | |
| tree | cef9b8f3963910cecc955078d4b8ebf80aeda8d2 /tests | |
| parent | 64ab23d17d9addd82f0b11a27a3d2219c1a8ec20 (diff) | |
| parent | 82593bd404066c4cd1366ed03209d1845a91315f (diff) | |
Merge pull request #2103 from embassy-rs/rcc-no-spaghetti
stm32/rcc: merge wb into l4/l5.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/stm32/src/common.rs | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/tests/stm32/src/common.rs b/tests/stm32/src/common.rs index cb1738154..ff808281a 100644 --- a/tests/stm32/src/common.rs +++ b/tests/stm32/src/common.rs | |||
| @@ -227,6 +227,11 @@ pub fn config() -> Config { | |||
| 227 | #[allow(unused_mut)] | 227 | #[allow(unused_mut)] |
| 228 | let mut config = Config::default(); | 228 | let mut config = Config::default(); |
| 229 | 229 | ||
| 230 | #[cfg(feature = "stm32wb55rg")] | ||
| 231 | { | ||
| 232 | config.rcc = embassy_stm32::rcc::WPAN_DEFAULT; | ||
| 233 | } | ||
| 234 | |||
| 230 | #[cfg(feature = "stm32f207zg")] | 235 | #[cfg(feature = "stm32f207zg")] |
| 231 | { | 236 | { |
| 232 | use embassy_stm32::rcc::*; | 237 | use embassy_stm32::rcc::*; |
| @@ -307,7 +312,7 @@ pub fn config() -> Config { | |||
| 307 | mode: HseMode::BypassDigital, | 312 | mode: HseMode::BypassDigital, |
| 308 | }); | 313 | }); |
| 309 | config.rcc.pll1 = Some(Pll { | 314 | config.rcc.pll1 = Some(Pll { |
| 310 | source: PllSource::Hse, | 315 | source: PllSource::HSE, |
| 311 | prediv: PllPreDiv::DIV2, | 316 | prediv: PllPreDiv::DIV2, |
| 312 | mul: PllMul::MUL125, | 317 | mul: PllMul::MUL125, |
| 313 | divp: Some(PllDiv::DIV2), | 318 | divp: Some(PllDiv::DIV2), |
| @@ -318,18 +323,18 @@ pub fn config() -> Config { | |||
| 318 | config.rcc.apb1_pre = APBPrescaler::DIV1; | 323 | config.rcc.apb1_pre = APBPrescaler::DIV1; |
| 319 | config.rcc.apb2_pre = APBPrescaler::DIV1; | 324 | config.rcc.apb2_pre = APBPrescaler::DIV1; |
| 320 | config.rcc.apb3_pre = APBPrescaler::DIV1; | 325 | config.rcc.apb3_pre = APBPrescaler::DIV1; |
| 321 | config.rcc.sys = Sysclk::Pll1P; | 326 | config.rcc.sys = Sysclk::PLL1_P; |
| 322 | config.rcc.voltage_scale = VoltageScale::Scale0; | 327 | config.rcc.voltage_scale = VoltageScale::Scale0; |
| 323 | } | 328 | } |
| 324 | 329 | ||
| 325 | #[cfg(any(feature = "stm32h755zi", feature = "stm32h753zi"))] | 330 | #[cfg(any(feature = "stm32h755zi", feature = "stm32h753zi"))] |
| 326 | { | 331 | { |
| 327 | use embassy_stm32::rcc::*; | 332 | use embassy_stm32::rcc::*; |
| 328 | config.rcc.hsi = Some(Hsi::Mhz64); | 333 | config.rcc.hsi = Some(HSIPrescaler::DIV1); |
| 329 | config.rcc.csi = true; | 334 | config.rcc.csi = true; |
| 330 | config.rcc.hsi48 = true; // needed for RNG | 335 | config.rcc.hsi48 = true; // needed for RNG |
| 331 | config.rcc.pll_src = PllSource::Hsi; | ||
| 332 | config.rcc.pll1 = Some(Pll { | 336 | config.rcc.pll1 = Some(Pll { |
| 337 | source: PllSource::HSI, | ||
| 333 | prediv: PllPreDiv::DIV4, | 338 | prediv: PllPreDiv::DIV4, |
| 334 | mul: PllMul::MUL50, | 339 | mul: PllMul::MUL50, |
| 335 | divp: Some(PllDiv::DIV2), | 340 | divp: Some(PllDiv::DIV2), |
| @@ -337,13 +342,14 @@ pub fn config() -> Config { | |||
| 337 | divr: None, | 342 | divr: None, |
| 338 | }); | 343 | }); |
| 339 | config.rcc.pll2 = Some(Pll { | 344 | config.rcc.pll2 = Some(Pll { |
| 345 | source: PllSource::HSI, | ||
| 340 | prediv: PllPreDiv::DIV4, | 346 | prediv: PllPreDiv::DIV4, |
| 341 | mul: PllMul::MUL50, | 347 | mul: PllMul::MUL50, |
| 342 | divp: Some(PllDiv::DIV8), // 100mhz | 348 | divp: Some(PllDiv::DIV8), // 100mhz |
| 343 | divq: None, | 349 | divq: None, |
| 344 | divr: None, | 350 | divr: None, |
| 345 | }); | 351 | }); |
| 346 | config.rcc.sys = Sysclk::Pll1P; // 400 Mhz | 352 | config.rcc.sys = Sysclk::PLL1_P; // 400 Mhz |
| 347 | config.rcc.ahb_pre = AHBPrescaler::DIV2; // 200 Mhz | 353 | config.rcc.ahb_pre = AHBPrescaler::DIV2; // 200 Mhz |
| 348 | config.rcc.apb1_pre = APBPrescaler::DIV2; // 100 Mhz | 354 | config.rcc.apb1_pre = APBPrescaler::DIV2; // 100 Mhz |
| 349 | config.rcc.apb2_pre = APBPrescaler::DIV2; // 100 Mhz | 355 | config.rcc.apb2_pre = APBPrescaler::DIV2; // 100 Mhz |
| @@ -356,11 +362,11 @@ pub fn config() -> Config { | |||
| 356 | #[cfg(any(feature = "stm32h7a3zi"))] | 362 | #[cfg(any(feature = "stm32h7a3zi"))] |
| 357 | { | 363 | { |
| 358 | use embassy_stm32::rcc::*; | 364 | use embassy_stm32::rcc::*; |
| 359 | config.rcc.hsi = Some(Hsi::Mhz64); | 365 | config.rcc.hsi = Some(HSIPrescaler::DIV1); |
| 360 | config.rcc.csi = true; | 366 | config.rcc.csi = true; |
| 361 | config.rcc.hsi48 = true; // needed for RNG | 367 | config.rcc.hsi48 = true; // needed for RNG |
| 362 | config.rcc.pll_src = PllSource::Hsi; | ||
| 363 | config.rcc.pll1 = Some(Pll { | 368 | config.rcc.pll1 = Some(Pll { |
| 369 | source: PllSource::HSI, | ||
| 364 | prediv: PllPreDiv::DIV4, | 370 | prediv: PllPreDiv::DIV4, |
| 365 | mul: PllMul::MUL35, | 371 | mul: PllMul::MUL35, |
| 366 | divp: Some(PllDiv::DIV2), // 280 Mhz | 372 | divp: Some(PllDiv::DIV2), // 280 Mhz |
| @@ -368,13 +374,14 @@ pub fn config() -> Config { | |||
| 368 | divr: None, | 374 | divr: None, |
| 369 | }); | 375 | }); |
| 370 | config.rcc.pll2 = Some(Pll { | 376 | config.rcc.pll2 = Some(Pll { |
| 377 | source: PllSource::HSI, | ||
| 371 | prediv: PllPreDiv::DIV4, | 378 | prediv: PllPreDiv::DIV4, |
| 372 | mul: PllMul::MUL35, | 379 | mul: PllMul::MUL35, |
| 373 | divp: Some(PllDiv::DIV8), // 70 Mhz | 380 | divp: Some(PllDiv::DIV8), // 70 Mhz |
| 374 | divq: None, | 381 | divq: None, |
| 375 | divr: None, | 382 | divr: None, |
| 376 | }); | 383 | }); |
| 377 | config.rcc.sys = Sysclk::Pll1P; // 280 Mhz | 384 | config.rcc.sys = Sysclk::PLL1_P; // 280 Mhz |
| 378 | config.rcc.ahb_pre = AHBPrescaler::DIV1; // 280 Mhz | 385 | config.rcc.ahb_pre = AHBPrescaler::DIV1; // 280 Mhz |
| 379 | config.rcc.apb1_pre = APBPrescaler::DIV2; // 140 Mhz | 386 | config.rcc.apb1_pre = APBPrescaler::DIV2; // 140 Mhz |
| 380 | config.rcc.apb2_pre = APBPrescaler::DIV2; // 140 Mhz | 387 | config.rcc.apb2_pre = APBPrescaler::DIV2; // 140 Mhz |
| @@ -405,6 +412,7 @@ pub fn config() -> Config { | |||
| 405 | config.rcc.hse = Some(Hse { | 412 | config.rcc.hse = Some(Hse { |
| 406 | freq: Hertz(32_000_000), | 413 | freq: Hertz(32_000_000), |
| 407 | mode: HseMode::Bypass, | 414 | mode: HseMode::Bypass, |
| 415 | prescaler: HsePrescaler::DIV1, | ||
| 408 | }); | 416 | }); |
| 409 | config.rcc.mux = ClockSrc::PLL1_R; | 417 | config.rcc.mux = ClockSrc::PLL1_R; |
| 410 | config.rcc.pll = Some(Pll { | 418 | config.rcc.pll = Some(Pll { |
