aboutsummaryrefslogtreecommitdiff
path: root/embassy-usb-synopsys-otg
diff options
context:
space:
mode:
authorMatt Ickstadt <[email protected]>2024-05-21 14:23:32 -0500
committerMatt Ickstadt <[email protected]>2024-05-21 14:42:37 -0500
commit9d6746e650381c2b6624c2018e54e6aa4b2ba5e4 (patch)
tree435a2594a65697cf327c46a8fbaaca28b1424205 /embassy-usb-synopsys-otg
parentbb82a1bd607d717d845baa5d6d473f53ee17b43e (diff)
usb: add transceiver delay option
Diffstat (limited to 'embassy-usb-synopsys-otg')
-rw-r--r--embassy-usb-synopsys-otg/src/lib.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/embassy-usb-synopsys-otg/src/lib.rs b/embassy-usb-synopsys-otg/src/lib.rs
index 34dcd1497..b90e059f6 100644
--- a/embassy-usb-synopsys-otg/src/lib.rs
+++ b/embassy-usb-synopsys-otg/src/lib.rs
@@ -293,11 +293,22 @@ pub struct Config {
293 /// If you set this to true, you must connect VBUS to PA9 for FS, PB13 for HS, possibly with a 293 /// If you set this to true, you must connect VBUS to PA9 for FS, PB13 for HS, possibly with a
294 /// voltage divider. See ST application note AN4879 and the reference manual for more details. 294 /// voltage divider. See ST application note AN4879 and the reference manual for more details.
295 pub vbus_detection: bool, 295 pub vbus_detection: bool,
296
297 /// Enable transceiver delay.
298 ///
299 /// Some ULPI PHYs like the Microchip USB334x series require a delay between the ULPI register write that initiates
300 /// the HS Chirp and the subsequent transmit command, otherwise the HS Chirp does not get executed and the deivce
301 /// enumerates in FS mode. Some USB Link IP like those in the STM32H7 series support adding this delay to work with
302 /// the affected PHYs.
303 pub xcvrdly: bool,
296} 304}
297 305
298impl Default for Config { 306impl Default for Config {
299 fn default() -> Self { 307 fn default() -> Self {
300 Self { vbus_detection: false } 308 Self {
309 vbus_detection: false,
310 xcvrdly: false,
311 }
301 } 312 }
302} 313}
303 314
@@ -581,6 +592,9 @@ impl<'d, const MAX_EP_COUNT: usize> Bus<'d, MAX_EP_COUNT> {
581 r.dcfg().write(|w| { 592 r.dcfg().write(|w| {
582 w.set_pfivl(vals::Pfivl::FRAME_INTERVAL_80); 593 w.set_pfivl(vals::Pfivl::FRAME_INTERVAL_80);
583 w.set_dspd(phy_type.to_dspd()); 594 w.set_dspd(phy_type.to_dspd());
595 if self.config.xcvrdly {
596 w.set_xcvrdly(true);
597 }
584 }); 598 });
585 599
586 // Unmask transfer complete EP interrupt 600 // Unmask transfer complete EP interrupt