aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32f4/src/bin/usb_hid_mouse.rs
diff options
context:
space:
mode:
authorJoël Schulz-Ansres <[email protected]>2024-04-22 00:52:37 +0200
committerJoël Schulz-Ansres <[email protected]>2024-04-22 00:52:37 +0200
commit896d0e7cd846971eb472555eb13ebe28e0b2d536 (patch)
tree3d0e4609d4b41244322ac639ce7b9457b70d91ea /examples/stm32f4/src/bin/usb_hid_mouse.rs
parent152d514f52fab3b6b1f58c5b5bc57b13b86b7126 (diff)
Add comment on vbus_detection to all USB examples
Diffstat (limited to 'examples/stm32f4/src/bin/usb_hid_mouse.rs')
-rw-r--r--examples/stm32f4/src/bin/usb_hid_mouse.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/examples/stm32f4/src/bin/usb_hid_mouse.rs b/examples/stm32f4/src/bin/usb_hid_mouse.rs
index 0bc236119..2b8e2f147 100644
--- a/examples/stm32f4/src/bin/usb_hid_mouse.rs
+++ b/examples/stm32f4/src/bin/usb_hid_mouse.rs
@@ -18,6 +18,11 @@ bind_interrupts!(struct Irqs {
18 OTG_FS => usb::InterruptHandler<peripherals::USB_OTG_FS>; 18 OTG_FS => usb::InterruptHandler<peripherals::USB_OTG_FS>;
19}); 19});
20 20
21// If you are trying this and your USB device doesn't connect, the most
22// common issues are the RCC config and vbus_detection
23//
24// See https://embassy.dev/book/dev/faq.html#_the_usb_examples_are_not_working_on_my_board_is_there_anything_else_i_need_to_configure
25// for more information.
21#[embassy_executor::main] 26#[embassy_executor::main]
22async fn main(_spawner: Spawner) { 27async fn main(_spawner: Spawner) {
23 let mut config = Config::default(); 28 let mut config = Config::default();
@@ -46,7 +51,15 @@ async fn main(_spawner: Spawner) {
46 // Create the driver, from the HAL. 51 // Create the driver, from the HAL.
47 let mut ep_out_buffer = [0u8; 256]; 52 let mut ep_out_buffer = [0u8; 256];
48 let mut config = embassy_stm32::usb::Config::default(); 53 let mut config = embassy_stm32::usb::Config::default();
54
55 // Enable vbus_detection
56 // Note: some boards don't have this wired up and might not require it,
57 // as they are powered through usb!
58 // If you hang on boot, try setting this to "false"!
59 // See https://embassy.dev/book/dev/faq.html#_the_usb_examples_are_not_working_on_my_board_is_there_anything_else_i_need_to_configure
60 // for more information
49 config.vbus_detection = true; 61 config.vbus_detection = true;
62
50 let driver = Driver::new_fs(p.USB_OTG_FS, Irqs, p.PA12, p.PA11, &mut ep_out_buffer, config); 63 let driver = Driver::new_fs(p.USB_OTG_FS, Irqs, p.PA12, p.PA11, &mut ep_out_buffer, config);
51 64
52 // Create embassy-usb Config 65 // Create embassy-usb Config