Skip to content

Commit 5d348a8

Browse files
committed
Add notes about internal USB regulator to examples
1 parent f83198b commit 5d348a8

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

examples/usb_passthrough.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ fn main() -> ! {
3333
let _ = ccdr.clocks.hsi48_ck().expect("HSI48 must run");
3434
ccdr.peripheral.kernel_usb_clk_mux(UsbClkSel::HSI48);
3535

36+
// If your hardware uses the internal USB voltage regulator in ON mode, you
37+
// should uncomment this block.
38+
// unsafe {
39+
// let pwr = &*stm32::PWR::ptr();
40+
// pwr.cr3.modify(|_, w| w.usbregen().set_bit());
41+
// while pwr.cr3.read().usb33rdy().bit_is_clear() {}
42+
// }
43+
3644
// IO
3745
let gpioa = dp.GPIOA.split(ccdr.peripheral.GPIOA);
3846
let gpiob = dp.GPIOB.split(ccdr.peripheral.GPIOB);

examples/usb_serial.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ fn main() -> ! {
3232
let _ = ccdr.clocks.hsi48_ck().expect("HSI48 must run");
3333
ccdr.peripheral.kernel_usb_clk_mux(UsbClkSel::HSI48);
3434

35+
// If your hardware uses the internal USB voltage regulator in ON mode, you
36+
// should uncomment this block.
37+
// unsafe {
38+
// let pwr = &*stm32::PWR::ptr();
39+
// pwr.cr3.modify(|_, w| w.usbregen().set_bit());
40+
// while pwr.cr3.read().usb33rdy().bit_is_clear() {}
41+
// }
42+
3543
// IO
3644
#[cfg(any(feature = "rm0433", feature = "rm0399"))]
3745
let (pin_dm, pin_dp) = {

0 commit comments

Comments
 (0)