aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshufps <[email protected]>2024-01-14 22:43:22 +0100
committershufps <[email protected]>2024-01-14 22:43:22 +0100
commit018c48cf1ce54effe73f2287cb78fabbdede215c (patch)
treea3e1452cc086ba836ee04b93613aa778fdb4d881
parent131ef00658903420fb08e4666c01d93c3b5fd943 (diff)
changes to get usb working on a L1. Adds a usb_serial example too
-rw-r--r--embassy-stm32/src/usb/usb.rs6
-rw-r--r--examples/stm32l1/Cargo.toml1
2 files changed, 7 insertions, 0 deletions
diff --git a/embassy-stm32/src/usb/usb.rs b/embassy-stm32/src/usb/usb.rs
index 04b1b35e8..364076739 100644
--- a/embassy-stm32/src/usb/usb.rs
+++ b/embassy-stm32/src/usb/usb.rs
@@ -286,7 +286,10 @@ impl<'d, T: Instance> Driver<'d, T> {
286 #[cfg(not(usb_v4))] 286 #[cfg(not(usb_v4))]
287 regs.btable().write(|w| w.set_btable(0)); 287 regs.btable().write(|w| w.set_btable(0));
288 288
289 #[cfg(not(stm32l1))]
289 dp.set_as_af(dp.af_num(), AFType::OutputPushPull); 290 dp.set_as_af(dp.af_num(), AFType::OutputPushPull);
291
292 #[cfg(not(stm32l1))]
290 dm.set_as_af(dm.af_num(), AFType::OutputPushPull); 293 dm.set_as_af(dm.af_num(), AFType::OutputPushPull);
291 294
292 // Initialize the bus so that it signals that power is available 295 // Initialize the bus so that it signals that power is available
@@ -444,6 +447,9 @@ impl<'d, T: Instance> driver::Driver<'d> for Driver<'d, T> {
444 #[cfg(any(usb_v3, usb_v4))] 447 #[cfg(any(usb_v3, usb_v4))]
445 regs.bcdr().write(|w| w.set_dppu(true)); 448 regs.bcdr().write(|w| w.set_dppu(true));
446 449
450 #[cfg(stm32l1)]
451 crate::pac::SYSCFG.pmc().modify(|w| w.set_usb_pu(true));
452
447 trace!("enabled"); 453 trace!("enabled");
448 454
449 let mut ep_types = [EpType::BULK; EP_COUNT - 1]; 455 let mut ep_types = [EpType::BULK; EP_COUNT - 1];
diff --git a/examples/stm32l1/Cargo.toml b/examples/stm32l1/Cargo.toml
index c0b35b716..322c41262 100644
--- a/examples/stm32l1/Cargo.toml
+++ b/examples/stm32l1/Cargo.toml
@@ -9,6 +9,7 @@ embassy-sync = { version = "0.5.0", path = "../../embassy-sync", features = ["de
9embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] } 9embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "defmt", "integrated-timers"] }
10embassy-time = { version = "0.3.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 10embassy-time = { version = "0.3.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
11embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "stm32l151cb-a", "time-driver-any", "memory-x"] } 11embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = [ "defmt", "stm32l151cb-a", "time-driver-any", "memory-x"] }
12embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] }
12 13
13defmt = "0.3" 14defmt = "0.3"
14defmt-rtt = "0.4" 15defmt-rtt = "0.4"