aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src
diff options
context:
space:
mode:
authorGerzain Mata <[email protected]>2025-07-27 16:44:43 -0700
committerGerzain Mata <[email protected]>2025-07-27 16:44:43 -0700
commit81bef219e315aca005e50143757c681d5bc122ee (patch)
tree4b3a571c74d33f290ba61bc7ccc9982cf45a8dfb /embassy-stm32/src
parent00f94972d7293b946e4bf7de2722ea55dca6b0db (diff)
Working USB_OTG_HS example for STM32WBA
Diffstat (limited to 'embassy-stm32/src')
-rw-r--r--embassy-stm32/src/lib.rs6
-rw-r--r--embassy-stm32/src/usb/mod.rs4
-rw-r--r--embassy-stm32/src/usb/otg.rs7
3 files changed, 6 insertions, 11 deletions
diff --git a/embassy-stm32/src/lib.rs b/embassy-stm32/src/lib.rs
index d893f1b54..a676677e1 100644
--- a/embassy-stm32/src/lib.rs
+++ b/embassy-stm32/src/lib.rs
@@ -546,7 +546,11 @@ fn init_hw(config: Config) -> Peripherals {
546 { 546 {
547 use crate::pac::pwr::vals; 547 use crate::pac::pwr::vals;
548 crate::pac::PWR.svmcr().modify(|w| { 548 crate::pac::PWR.svmcr().modify(|w| {
549 w.set_io2sv(if config.enable_independent_io_supply {vals::Io2sv::B_0X1} else {vals::Io2sv::B_0X0}); 549 w.set_io2sv(if config.enable_independent_io_supply {
550 vals::Io2sv::B_0X1
551 } else {
552 vals::Io2sv::B_0X0
553 });
550 }); 554 });
551 } 555 }
552 #[cfg(stm32u5)] 556 #[cfg(stm32u5)]
diff --git a/embassy-stm32/src/usb/mod.rs b/embassy-stm32/src/usb/mod.rs
index d052934f8..62c751ac8 100644
--- a/embassy-stm32/src/usb/mod.rs
+++ b/embassy-stm32/src/usb/mod.rs
@@ -111,10 +111,8 @@ fn common_init<T: Instance>() {
111 }); 111 });
112 crate::pac::PWR.vosr().modify(|w| { 112 crate::pac::PWR.vosr().modify(|w| {
113 w.set_vdd11usbdis(false); 113 w.set_vdd11usbdis(false);
114 });
115 crate::pac::PWR.vosr().modify(|w| {
116 w.set_usbpwren(true); 114 w.set_usbpwren(true);
117 }) 115 });
118 }); 116 });
119 117
120 // Wait for USB power to stabilize 118 // Wait for USB power to stabilize
diff --git a/embassy-stm32/src/usb/otg.rs b/embassy-stm32/src/usb/otg.rs
index abf54cbad..1c3b99b93 100644
--- a/embassy-stm32/src/usb/otg.rs
+++ b/embassy-stm32/src/usb/otg.rs
@@ -330,19 +330,12 @@ impl<'d, T: Instance> Bus<'d, T> {
330 #[cfg(all(stm32wba, peri_usb_otg_hs))] 330 #[cfg(all(stm32wba, peri_usb_otg_hs))]
331 { 331 {
332 critical_section::with(|_| { 332 critical_section::with(|_| {
333 // crate::pac::RCC.apb7enr().modify(|w| {
334 // w.set_syscfgen(true);
335 // });
336 crate::pac::RCC.ahb2enr().modify(|w| { 333 crate::pac::RCC.ahb2enr().modify(|w| {
337 w.set_usb_otg_hsen(true); 334 w.set_usb_otg_hsen(true);
338 w.set_usb_otg_hs_phyen(true); 335 w.set_usb_otg_hs_phyen(true);
339 }); 336 });
340 }); 337 });
341 338
342 // pub use crate::pac::rcc::vals::Otghssel;
343 // // select HSE
344 // crate::pac::RCC.ccipr2().modify(|w| {w.set_otghssel(Otghssel::HSE);});
345
346 crate::pac::SYSCFG.otghsphytuner2().modify(|w| { 339 crate::pac::SYSCFG.otghsphytuner2().modify(|w| {
347 w.set_compdistune(0b010); 340 w.set_compdistune(0b010);
348 w.set_sqrxtune(0b000); 341 w.set_sqrxtune(0b000);