diff options
| author | Carl St-Laurent <[email protected]> | 2023-06-04 10:58:44 -0400 |
|---|---|---|
| committer | Carl St-Laurent <[email protected]> | 2023-06-04 10:58:44 -0400 |
| commit | 6fe853a7d353edcc8b0fba8773915c4269599179 (patch) | |
| tree | 3d8edb694c7a8a97fe06dc4ebd0e27f12b29bb9a | |
| parent | 675499449fa3e348d27aebc5aae2b7f736648609 (diff) | |
Better comments
| -rw-r--r-- | embassy-stm32/src/rcc/g4.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/embassy-stm32/src/rcc/g4.rs b/embassy-stm32/src/rcc/g4.rs index 13dced73d..7d061192b 100644 --- a/embassy-stm32/src/rcc/g4.rs +++ b/embassy-stm32/src/rcc/g4.rs | |||
| @@ -261,14 +261,14 @@ pub(crate) unsafe fn init(config: Config) { | |||
| 261 | ClockSrc::PLL(src, prediv, mul, div) => { | 261 | ClockSrc::PLL(src, prediv, mul, div) => { |
| 262 | let src_freq = match src { | 262 | let src_freq = match src { |
| 263 | PllSrc::HSI16 => { | 263 | PllSrc::HSI16 => { |
| 264 | // Enable HSI16 | 264 | // Enable HSI16 as clock source for PLL |
| 265 | RCC.cr().write(|w| w.set_hsion(true)); | 265 | RCC.cr().write(|w| w.set_hsion(true)); |
| 266 | while !RCC.cr().read().hsirdy() {} | 266 | while !RCC.cr().read().hsirdy() {} |
| 267 | 267 | ||
| 268 | HSI_FREQ.0 | 268 | HSI_FREQ.0 |
| 269 | } | 269 | } |
| 270 | PllSrc::HSE(freq) => { | 270 | PllSrc::HSE(freq) => { |
| 271 | // Enable HSE | 271 | // Enable HSE as clock source for PLL |
| 272 | RCC.cr().write(|w| w.set_hseon(true)); | 272 | RCC.cr().write(|w| w.set_hseon(true)); |
| 273 | while !RCC.cr().read().hserdy() {} | 273 | while !RCC.cr().read().hserdy() {} |
| 274 | 274 | ||
| @@ -276,7 +276,7 @@ pub(crate) unsafe fn init(config: Config) { | |||
| 276 | } | 276 | } |
| 277 | }; | 277 | }; |
| 278 | 278 | ||
| 279 | // Disable PLL | 279 | // Make sure PLL is disabled while we configure it |
| 280 | RCC.cr().modify(|w| w.set_pllon(false)); | 280 | RCC.cr().modify(|w| w.set_pllon(false)); |
| 281 | while RCC.cr().read().pllrdy() {} | 281 | while RCC.cr().read().pllrdy() {} |
| 282 | 282 | ||
| @@ -290,6 +290,7 @@ pub(crate) unsafe fn init(config: Config) { | |||
| 290 | w.set_pllsrc(src.into()); | 290 | w.set_pllsrc(src.into()); |
| 291 | }); | 291 | }); |
| 292 | 292 | ||
| 293 | // Enable PLL | ||
| 293 | RCC.cr().modify(|w| w.set_pllon(true)); | 294 | RCC.cr().modify(|w| w.set_pllon(true)); |
| 294 | while !RCC.cr().read().pllrdy() {} | 295 | while !RCC.cr().read().pllrdy() {} |
| 295 | RCC.pllcfgr().modify(|w| w.set_pllren(true)); | 296 | RCC.pllcfgr().modify(|w| w.set_pllren(true)); |
