aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-stm32/src/clock.rs2
-rw-r--r--embassy-stm32/src/dac/v2.rs3
-rw-r--r--embassy-stm32/src/pwr/h7.rs5
-rw-r--r--embassy-stm32/src/rcc/h7/mod.rs47
-rw-r--r--embassy-stm32/src/rcc/h7/pll.rs22
-rw-r--r--embassy-stm32/src/rcc/l0/mod.rs41
m---------stm32-data0
7 files changed, 53 insertions, 67 deletions
diff --git a/embassy-stm32/src/clock.rs b/embassy-stm32/src/clock.rs
index 075b80118..7f478e790 100644
--- a/embassy-stm32/src/clock.rs
+++ b/embassy-stm32/src/clock.rs
@@ -83,7 +83,7 @@ impl<T: Instance> Clock<T> {
83 unsafe { 83 unsafe {
84 let rcc = crate::pac::RCC; 84 let rcc = crate::pac::RCC;
85 rcc.apb1enr() 85 rcc.apb1enr()
86 .modify(|w| w.set_tim2en(crate::pac::rcc::vals::Lptimen::ENABLED)); 86 .modify(|w| w.set_tim2en(true));
87 rcc.apb1rstr().modify(|w| w.set_tim2rst(true)); 87 rcc.apb1rstr().modify(|w| w.set_tim2rst(true));
88 rcc.apb1rstr().modify(|w| w.set_tim2rst(false)); 88 rcc.apb1rstr().modify(|w| w.set_tim2rst(false));
89 } 89 }
diff --git a/embassy-stm32/src/dac/v2.rs b/embassy-stm32/src/dac/v2.rs
index d8c9415b6..25a87db06 100644
--- a/embassy-stm32/src/dac/v2.rs
+++ b/embassy-stm32/src/dac/v2.rs
@@ -5,7 +5,8 @@ use core::marker::PhantomData;
5use embassy::util::Unborrow; 5use embassy::util::Unborrow;
6use embassy_extras::unborrow; 6use embassy_extras::unborrow;
7 7
8#[derive(Debug, defmt::Format)] 8#[derive(Debug)]
9#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9pub enum Error { 10pub enum Error {
10 UnconfiguredChannel, 11 UnconfiguredChannel,
11 InvalidValue, 12 InvalidValue,
diff --git a/embassy-stm32/src/pwr/h7.rs b/embassy-stm32/src/pwr/h7.rs
index 3d83b5e85..b298408a4 100644
--- a/embassy-stm32/src/pwr/h7.rs
+++ b/embassy-stm32/src/pwr/h7.rs
@@ -28,8 +28,6 @@ pub struct Power {
28 28
29impl Power { 29impl Power {
30 pub fn new(_peri: peripherals::PWR, enable_overdrive: bool) -> Self { 30 pub fn new(_peri: peripherals::PWR, enable_overdrive: bool) -> Self {
31 use crate::pac::rcc::vals::Apb4enrSyscfgen;
32
33 // NOTE(unsafe) we have the PWR singleton 31 // NOTE(unsafe) we have the PWR singleton
34 unsafe { 32 unsafe {
35 // NB. The lower bytes of CR3 can only be written once after 33 // NB. The lower bytes of CR3 can only be written once after
@@ -57,8 +55,7 @@ impl Power {
57 VoltageScale::Scale1 55 VoltageScale::Scale1
58 } else { 56 } else {
59 critical_section::with(|_| { 57 critical_section::with(|_| {
60 RCC.apb4enr() 58 RCC.apb4enr().modify(|w| w.set_syscfgen(true));
61 .modify(|w| w.set_syscfgen(Apb4enrSyscfgen::ENABLED));
62 59
63 SYSCFG.pwrcr().modify(|w| w.set_oden(1)); 60 SYSCFG.pwrcr().modify(|w| w.set_oden(1));
64 }); 61 });
diff --git a/embassy-stm32/src/rcc/h7/mod.rs b/embassy-stm32/src/rcc/h7/mod.rs
index 57cdd5470..f15dbe075 100644
--- a/embassy-stm32/src/rcc/h7/mod.rs
+++ b/embassy-stm32/src/rcc/h7/mod.rs
@@ -101,10 +101,7 @@ impl<'d> Rcc<'d> {
101 /// achieved, but the mechanism for doing so is not yet 101 /// achieved, but the mechanism for doing so is not yet
102 /// implemented here. 102 /// implemented here.
103 pub fn freeze(mut self, pwr: &Power) -> CoreClocks { 103 pub fn freeze(mut self, pwr: &Power) -> CoreClocks {
104 use crate::pac::rcc::vals::{ 104 use crate::pac::rcc::vals::{Ckpersel, Dppre, Hpre, Hsebyp, Hsidiv, Pllsrc, Sw};
105 Apb4enrSyscfgen, Ckpersel, D1ppre, D2ppre1, D3ppre, Hpre, Hsebyp, Hsidiv, Hsion, Lsion,
106 Pllsrc, Sw,
107 };
108 105
109 let srcclk = self.config.hse.unwrap_or(HSI); // Available clocks 106 let srcclk = self.config.hse.unwrap_or(HSI); // Available clocks
110 let (sys_ck, sys_use_pll1_p) = self.sys_ck_setup(srcclk); 107 let (sys_ck, sys_use_pll1_p) = self.sys_ck_setup(srcclk);
@@ -132,10 +129,10 @@ impl<'d> Rcc<'d> {
132 // do so it would need to ensure all PLLxON bits are clear 129 // do so it would need to ensure all PLLxON bits are clear
133 // before changing the value of HSIDIV 130 // before changing the value of HSIDIV
134 let cr = RCC.cr().read(); 131 let cr = RCC.cr().read();
135 assert!(cr.hsion() == Hsion::ON); 132 assert!(cr.hsion());
136 assert!(cr.hsidiv() == Hsidiv::DIV1); 133 assert!(cr.hsidiv() == Hsidiv::DIV1);
137 134
138 RCC.csr().modify(|w| w.set_lsion(Lsion::ON)); 135 RCC.csr().modify(|w| w.set_lsion(true));
139 while !RCC.csr().read().lsirdy() {} 136 while !RCC.csr().read().lsirdy() {}
140 } 137 }
141 138
@@ -228,12 +225,12 @@ impl<'d> Rcc<'d> {
228 // NOTE(unsafe) We have the RCC singleton 225 // NOTE(unsafe) We have the RCC singleton
229 unsafe { 226 unsafe {
230 // Ensure CSI is on and stable 227 // Ensure CSI is on and stable
231 RCC.cr().modify(|w| w.set_csion(Hsion::ON)); 228 RCC.cr().modify(|w| w.set_csion(true));
232 while !RCC.cr().read().csirdy() {} 229 while !RCC.cr().read().csirdy() {}
233 230
234 // Ensure HSI48 is on and stable 231 // Ensure HSI48 is on and stable
235 RCC.cr().modify(|w| w.set_hsi48on(Hsion::ON)); 232 RCC.cr().modify(|w| w.set_hsi48on(true));
236 while RCC.cr().read().hsi48on() == Hsion::OFF {} 233 while !RCC.cr().read().hsi48on() {}
237 234
238 // XXX: support MCO ? 235 // XXX: support MCO ?
239 236
@@ -241,7 +238,7 @@ impl<'d> Rcc<'d> {
241 Some(hse) => { 238 Some(hse) => {
242 // Ensure HSE is on and stable 239 // Ensure HSE is on and stable
243 RCC.cr().modify(|w| { 240 RCC.cr().modify(|w| {
244 w.set_hseon(Hsion::ON); 241 w.set_hseon(true);
245 w.set_hsebyp(if self.config.bypass_hse { 242 w.set_hsebyp(if self.config.bypass_hse {
246 Hsebyp::BYPASSED 243 Hsebyp::BYPASSED
247 } else { 244 } else {
@@ -261,25 +258,27 @@ impl<'d> Rcc<'d> {
261 }; 258 };
262 RCC.pllckselr().modify(|w| w.set_pllsrc(pllsrc)); 259 RCC.pllckselr().modify(|w| w.set_pllsrc(pllsrc));
263 260
261 let enable_pll = |pll| {
262 RCC.cr().modify(|w| w.set_pllon(pll, true));
263 while !RCC.cr().read().pllrdy(pll) {}
264 };
265
264 if pll1_p_ck.is_some() { 266 if pll1_p_ck.is_some() {
265 RCC.cr().modify(|w| w.set_pll1on(Hsion::ON)); 267 enable_pll(0);
266 while !RCC.cr().read().pll1rdy() {}
267 } 268 }
268 269
269 if pll2_p_ck.is_some() { 270 if pll2_p_ck.is_some() {
270 RCC.cr().modify(|w| w.set_pll2on(Hsion::ON)); 271 enable_pll(1);
271 while !RCC.cr().read().pll2rdy() {}
272 } 272 }
273 273
274 if pll3_p_ck.is_some() { 274 if pll3_p_ck.is_some() {
275 RCC.cr().modify(|w| w.set_pll3on(Hsion::ON)); 275 enable_pll(2);
276 while !RCC.cr().read().pll3rdy() {}
277 } 276 }
278 277
279 // Core Prescaler / AHB Prescaler / APB3 Prescaler 278 // Core Prescaler / AHB Prescaler / APB3 Prescaler
280 RCC.d1cfgr().modify(|w| { 279 RCC.d1cfgr().modify(|w| {
281 w.set_d1cpre(Hpre(d1cpre_bits)); 280 w.set_d1cpre(Hpre(d1cpre_bits));
282 w.set_d1ppre(D1ppre(ppre3_bits)); 281 w.set_d1ppre(Dppre(ppre3_bits));
283 w.set_hpre(hpre_bits) 282 w.set_hpre(hpre_bits)
284 }); 283 });
285 // Ensure core prescaler value is valid before future lower 284 // Ensure core prescaler value is valid before future lower
@@ -288,12 +287,12 @@ impl<'d> Rcc<'d> {
288 287
289 // APB1 / APB2 Prescaler 288 // APB1 / APB2 Prescaler
290 RCC.d2cfgr().modify(|w| { 289 RCC.d2cfgr().modify(|w| {
291 w.set_d2ppre1(D2ppre1(ppre1_bits)); 290 w.set_d2ppre1(Dppre(ppre1_bits));
292 w.set_d2ppre2(D2ppre1(ppre2_bits)); 291 w.set_d2ppre2(Dppre(ppre2_bits));
293 }); 292 });
294 293
295 // APB4 Prescaler 294 // APB4 Prescaler
296 RCC.d3cfgr().modify(|w| w.set_d3ppre(D3ppre(ppre4_bits))); 295 RCC.d3cfgr().modify(|w| w.set_d3ppre(Dppre(ppre4_bits)));
297 296
298 // Peripheral Clock (per_ck) 297 // Peripheral Clock (per_ck)
299 RCC.d1ccipr().modify(|w| w.set_ckpersel(ckpersel)); 298 RCC.d1ccipr().modify(|w| w.set_ckpersel(ckpersel));
@@ -312,8 +311,7 @@ impl<'d> Rcc<'d> {
312 311
313 // IO compensation cell - Requires CSI clock and SYSCFG 312 // IO compensation cell - Requires CSI clock and SYSCFG
314 assert!(RCC.cr().read().csirdy()); 313 assert!(RCC.cr().read().csirdy());
315 RCC.apb4enr() 314 RCC.apb4enr().modify(|w| w.set_syscfgen(true));
316 .modify(|w| w.set_syscfgen(Apb4enrSyscfgen::ENABLED));
317 315
318 // Enable the compensation cell, using back-bias voltage code 316 // Enable the compensation cell, using back-bias voltage code
319 // provide by the cell. 317 // provide by the cell.
@@ -364,13 +362,10 @@ impl<'d> Rcc<'d> {
364 /// Set `enable_dma1` to true if you do not have at least one bus master (other than the CPU) 362 /// Set `enable_dma1` to true if you do not have at least one bus master (other than the CPU)
365 /// enable during WFI/WFE 363 /// enable during WFI/WFE
366 pub fn enable_debug_wfe(&mut self, _dbg: &mut peripherals::DBGMCU, enable_dma1: bool) { 364 pub fn enable_debug_wfe(&mut self, _dbg: &mut peripherals::DBGMCU, enable_dma1: bool) {
367 use crate::pac::rcc::vals::Ahb1enrDma1en;
368
369 // NOTE(unsafe) We have exclusive access to the RCC and DBGMCU 365 // NOTE(unsafe) We have exclusive access to the RCC and DBGMCU
370 unsafe { 366 unsafe {
371 if enable_dma1 { 367 if enable_dma1 {
372 RCC.ahb1enr() 368 RCC.ahb1enr().modify(|w| w.set_dma1en(true));
373 .modify(|w| w.set_dma1en(Ahb1enrDma1en::ENABLED));
374 } 369 }
375 370
376 DBGMCU.cr().modify(|w| { 371 DBGMCU.cr().modify(|w| {
diff --git a/embassy-stm32/src/rcc/h7/pll.rs b/embassy-stm32/src/rcc/h7/pll.rs
index 4c40d84d4..d3709378b 100644
--- a/embassy-stm32/src/rcc/h7/pll.rs
+++ b/embassy-stm32/src/rcc/h7/pll.rs
@@ -46,7 +46,7 @@ fn vco_output_divider_setup(output: u32, plln: usize) -> (u32, u32) {
46/// 46///
47/// Must have exclusive access to the RCC register block 47/// Must have exclusive access to the RCC register block
48unsafe fn vco_setup(pll_src: u32, requested_output: u32, plln: usize) -> PllConfigResults { 48unsafe fn vco_setup(pll_src: u32, requested_output: u32, plln: usize) -> PllConfigResults {
49 use crate::pac::rcc::vals::{Pll1rge, Pll1vcosel}; 49 use crate::pac::rcc::vals::{Pllrge, Pllvcosel};
50 50
51 let (vco_ck_target, pll_x_p) = vco_output_divider_setup(requested_output, plln); 51 let (vco_ck_target, pll_x_p) = vco_output_divider_setup(requested_output, plln);
52 52
@@ -60,8 +60,8 @@ unsafe fn vco_setup(pll_src: u32, requested_output: u32, plln: usize) -> PllConf
60 assert!((1_000_000..=2_000_000).contains(&ref_x_ck)); 60 assert!((1_000_000..=2_000_000).contains(&ref_x_ck));
61 61
62 RCC.pllcfgr().modify(|w| { 62 RCC.pllcfgr().modify(|w| {
63 w.set_pllvcosel(plln, Pll1vcosel::MEDIUMVCO); 63 w.set_pllvcosel(plln, Pllvcosel::MEDIUMVCO);
64 w.set_pllrge(plln, Pll1rge::RANGE1); 64 w.set_pllrge(plln, Pllrge::RANGE1);
65 }); 65 });
66 PllConfigResults { 66 PllConfigResults {
67 ref_x_ck, 67 ref_x_ck,
@@ -79,7 +79,7 @@ pub(super) unsafe fn pll_setup(
79 config: &PllConfig, 79 config: &PllConfig,
80 plln: usize, 80 plln: usize,
81) -> (Option<u32>, Option<u32>, Option<u32>) { 81) -> (Option<u32>, Option<u32>, Option<u32>) {
82 use crate::pac::rcc::vals::{Divp1, Divp1en, Pll1fracen}; 82 use crate::pac::rcc::vals::Divp;
83 83
84 match config.p_ck { 84 match config.p_ck {
85 Some(requested_output) => { 85 Some(requested_output) => {
@@ -101,22 +101,19 @@ pub(super) unsafe fn pll_setup(
101 .modify(|w| w.set_divn1((pll_x_n - 1) as u16)); 101 .modify(|w| w.set_divn1((pll_x_n - 1) as u16));
102 102
103 // No FRACN 103 // No FRACN
104 RCC.pllcfgr() 104 RCC.pllcfgr().modify(|w| w.set_pllfracen(plln, false));
105 .modify(|w| w.set_pllfracen(plln, Pll1fracen::RESET));
106 let vco_ck = ref_x_ck * pll_x_n; 105 let vco_ck = ref_x_ck * pll_x_n;
107 106
108 RCC.plldivr(plln) 107 RCC.plldivr(plln)
109 .modify(|w| w.set_divp1(Divp1((pll_x_p - 1) as u8))); 108 .modify(|w| w.set_divp1(Divp((pll_x_p - 1) as u8)));
110 RCC.pllcfgr() 109 RCC.pllcfgr().modify(|w| w.set_divpen(plln, true));
111 .modify(|w| w.set_divpen(plln, Divp1en::ENABLED));
112 110
113 // Calulate additional output dividers 111 // Calulate additional output dividers
114 let q_ck = match config.q_ck { 112 let q_ck = match config.q_ck {
115 Some(Hertz(ck)) if ck > 0 => { 113 Some(Hertz(ck)) if ck > 0 => {
116 let div = (vco_ck + ck - 1) / ck; 114 let div = (vco_ck + ck - 1) / ck;
117 RCC.plldivr(plln).modify(|w| w.set_divq1((div - 1) as u8)); 115 RCC.plldivr(plln).modify(|w| w.set_divq1((div - 1) as u8));
118 RCC.pllcfgr() 116 RCC.pllcfgr().modify(|w| w.set_divqen(plln, true));
119 .modify(|w| w.set_divqen(plln, Divp1en::ENABLED));
120 Some(vco_ck / div) 117 Some(vco_ck / div)
121 } 118 }
122 _ => None, 119 _ => None,
@@ -125,8 +122,7 @@ pub(super) unsafe fn pll_setup(
125 Some(Hertz(ck)) if ck > 0 => { 122 Some(Hertz(ck)) if ck > 0 => {
126 let div = (vco_ck + ck - 1) / ck; 123 let div = (vco_ck + ck - 1) / ck;
127 RCC.plldivr(plln).modify(|w| w.set_divr1((div - 1) as u8)); 124 RCC.plldivr(plln).modify(|w| w.set_divr1((div - 1) as u8));
128 RCC.pllcfgr() 125 RCC.pllcfgr().modify(|w| w.set_divren(plln, true));
129 .modify(|w| w.set_divren(plln, Divp1en::ENABLED));
130 Some(vco_ck / div) 126 Some(vco_ck / div)
131 } 127 }
132 _ => None, 128 _ => None,
diff --git a/embassy-stm32/src/rcc/l0/mod.rs b/embassy-stm32/src/rcc/l0/mod.rs
index a8be72033..ac32a6c4c 100644
--- a/embassy-stm32/src/rcc/l0/mod.rs
+++ b/embassy-stm32/src/rcc/l0/mod.rs
@@ -7,9 +7,7 @@ use core::marker::PhantomData;
7use embassy::util::Unborrow; 7use embassy::util::Unborrow;
8use embassy_extras::unborrow; 8use embassy_extras::unborrow;
9use pac::dbg::vals::{DbgSleep, DbgStandby, DbgStop}; 9use pac::dbg::vals::{DbgSleep, DbgStandby, DbgStop};
10use pac::rcc::vals::{ 10use pac::rcc::vals::{Hpre, Msirange, Plldiv, Pllmul, Pllsrc, Ppre, Sw};
11 Crypen, Dbgen, Hpre, Iophen, Lptimen, Msirange, Plldiv, Pllmul, Pllon, Pllsrc, Ppre, Sw,
12};
13 11
14/// Most of clock setup is copied from stm32l0xx-hal, and adopted to the generated PAC, 12/// Most of clock setup is copied from stm32l0xx-hal, and adopted to the generated PAC,
15/// and with the addition of the init function to configure a system clock. 13/// and with the addition of the init function to configure a system clock.
@@ -266,7 +264,7 @@ impl<'d> Rcc<'d> {
266 // NOTE(unsafe) We have exclusive access to the RCC and DBGMCU 264 // NOTE(unsafe) We have exclusive access to the RCC and DBGMCU
267 unsafe { 265 unsafe {
268 if enable_dma { 266 if enable_dma {
269 pac::RCC.ahbenr().modify(|w| w.set_dmaen(Crypen::ENABLED)); 267 pac::RCC.ahbenr().modify(|w| w.set_dmaen(true));
270 } 268 }
271 269
272 pac::DBGMCU.cr().modify(|w| { 270 pac::DBGMCU.cr().modify(|w| {
@@ -285,14 +283,14 @@ impl<'d> Rcc<'d> {
285 rcc.apb2rstr().modify(|w| w.set_syscfgrst(false)); 283 rcc.apb2rstr().modify(|w| w.set_syscfgrst(false));
286 284
287 // Enable SYSCFG peripheral 285 // Enable SYSCFG peripheral
288 rcc.apb2enr().modify(|w| w.set_syscfgen(Dbgen::ENABLED)); 286 rcc.apb2enr().modify(|w| w.set_syscfgen(true));
289 287
290 // Reset CRS peripheral 288 // Reset CRS peripheral
291 rcc.apb1rstr().modify(|w| w.set_crsrst(true)); 289 rcc.apb1rstr().modify(|w| w.set_crsrst(true));
292 rcc.apb1rstr().modify(|w| w.set_crsrst(false)); 290 rcc.apb1rstr().modify(|w| w.set_crsrst(false));
293 291
294 // Enable CRS peripheral 292 // Enable CRS peripheral
295 rcc.apb1enr().modify(|w| w.set_crsen(Lptimen::ENABLED)); 293 rcc.apb1enr().modify(|w| w.set_crsen(true));
296 294
297 // Initialize CRS 295 // Initialize CRS
298 let crs = pac::CRS; 296 let crs = pac::CRS;
@@ -369,7 +367,7 @@ impl RccExt for RCC {
369 367
370 // Enable MSI 368 // Enable MSI
371 unsafe { 369 unsafe {
372 rcc.cr().write(|w| w.set_msion(Pllon::ENABLED)); 370 rcc.cr().write(|w| w.set_msion(true));
373 while !rcc.cr().read().msirdy() {} 371 while !rcc.cr().read().msirdy() {}
374 } 372 }
375 373
@@ -379,7 +377,7 @@ impl RccExt for RCC {
379 ClockSrc::HSI16 => { 377 ClockSrc::HSI16 => {
380 // Enable HSI16 378 // Enable HSI16
381 unsafe { 379 unsafe {
382 rcc.cr().write(|w| w.set_hsi16on(Pllon::ENABLED)); 380 rcc.cr().write(|w| w.set_hsi16on(true));
383 while !rcc.cr().read().hsi16rdyf() {} 381 while !rcc.cr().read().hsi16rdyf() {}
384 } 382 }
385 383
@@ -388,7 +386,7 @@ impl RccExt for RCC {
388 ClockSrc::HSE(freq) => { 386 ClockSrc::HSE(freq) => {
389 // Enable HSE 387 // Enable HSE
390 unsafe { 388 unsafe {
391 rcc.cr().write(|w| w.set_hseon(Pllon::ENABLED)); 389 rcc.cr().write(|w| w.set_hseon(true));
392 while !rcc.cr().read().hserdy() {} 390 while !rcc.cr().read().hserdy() {}
393 } 391 }
394 392
@@ -399,7 +397,7 @@ impl RccExt for RCC {
399 PLLSource::HSE(freq) => { 397 PLLSource::HSE(freq) => {
400 // Enable HSE 398 // Enable HSE
401 unsafe { 399 unsafe {
402 rcc.cr().write(|w| w.set_hseon(Pllon::ENABLED)); 400 rcc.cr().write(|w| w.set_hseon(true));
403 while !rcc.cr().read().hserdy() {} 401 while !rcc.cr().read().hserdy() {}
404 } 402 }
405 freq.0 403 freq.0
@@ -407,7 +405,7 @@ impl RccExt for RCC {
407 PLLSource::HSI16 => { 405 PLLSource::HSI16 => {
408 // Enable HSI 406 // Enable HSI
409 unsafe { 407 unsafe {
410 rcc.cr().write(|w| w.set_hsi16on(Pllon::ENABLED)); 408 rcc.cr().write(|w| w.set_hsi16on(true));
411 while !rcc.cr().read().hsi16rdyf() {} 409 while !rcc.cr().read().hsi16rdyf() {}
412 } 410 }
413 HSI_FREQ 411 HSI_FREQ
@@ -416,7 +414,7 @@ impl RccExt for RCC {
416 414
417 // Disable PLL 415 // Disable PLL
418 unsafe { 416 unsafe {
419 rcc.cr().modify(|w| w.set_pllon(Pllon::DISABLED)); 417 rcc.cr().modify(|w| w.set_pllon(false));
420 while rcc.cr().read().pllrdy() {} 418 while rcc.cr().read().pllrdy() {}
421 } 419 }
422 420
@@ -447,7 +445,7 @@ impl RccExt for RCC {
447 }); 445 });
448 446
449 // Enable PLL 447 // Enable PLL
450 rcc.cr().modify(|w| w.set_pllon(Pllon::ENABLED)); 448 rcc.cr().modify(|w| w.set_pllon(true));
451 while !rcc.cr().read().pllrdy() {} 449 while !rcc.cr().read().pllrdy() {}
452 } 450 }
453 451
@@ -459,8 +457,8 @@ impl RccExt for RCC {
459 rcc.cfgr().modify(|w| { 457 rcc.cfgr().modify(|w| {
460 w.set_sw(sw.into()); 458 w.set_sw(sw.into());
461 w.set_hpre(cfgr.ahb_pre.into()); 459 w.set_hpre(cfgr.ahb_pre.into());
462 w.set_ppre(0, cfgr.apb1_pre.into()); 460 w.set_ppre1(cfgr.apb1_pre.into());
463 w.set_ppre(1, cfgr.apb2_pre.into()); 461 w.set_ppre2(cfgr.apb2_pre.into());
464 }); 462 });
465 } 463 }
466 464
@@ -526,14 +524,13 @@ pub struct LSE(());
526 524
527pub unsafe fn init(config: Config) { 525pub unsafe fn init(config: Config) {
528 let rcc = pac::RCC; 526 let rcc = pac::RCC;
529 let enabled = Iophen::ENABLED;
530 rcc.iopenr().write(|w| { 527 rcc.iopenr().write(|w| {
531 w.set_iopaen(enabled); 528 w.set_iopaen(true);
532 w.set_iopben(enabled); 529 w.set_iopben(true);
533 w.set_iopcen(enabled); 530 w.set_iopcen(true);
534 w.set_iopden(enabled); 531 w.set_iopden(true);
535 w.set_iopeen(enabled); 532 w.set_iopeen(true);
536 w.set_iophen(enabled); 533 w.set_iophen(true);
537 }); 534 });
538 535
539 let r = <peripherals::RCC as embassy::util::Steal>::steal(); 536 let r = <peripherals::RCC as embassy::util::Steal>::steal();
diff --git a/stm32-data b/stm32-data
Subproject 33dfa674865b1b5f0bfb86f3217055a6a057a6f Subproject ced687a382fa8b641af568dadc71af7abe62d5c