diff options
| author | Joël Schulz-Ansres <[email protected]> | 2024-04-22 00:52:37 +0200 |
|---|---|---|
| committer | Joël Schulz-Ansres <[email protected]> | 2024-04-22 00:52:37 +0200 |
| commit | 896d0e7cd846971eb472555eb13ebe28e0b2d536 (patch) | |
| tree | 3d0e4609d4b41244322ac639ce7b9457b70d91ea /examples/stm32f4/src/bin/usb_raw.rs | |
| parent | 152d514f52fab3b6b1f58c5b5bc57b13b86b7126 (diff) | |
Add comment on vbus_detection to all USB examples
Diffstat (limited to 'examples/stm32f4/src/bin/usb_raw.rs')
| -rw-r--r-- | examples/stm32f4/src/bin/usb_raw.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/examples/stm32f4/src/bin/usb_raw.rs b/examples/stm32f4/src/bin/usb_raw.rs index 4e583aeb8..00fdff2bf 100644 --- a/examples/stm32f4/src/bin/usb_raw.rs +++ b/examples/stm32f4/src/bin/usb_raw.rs | |||
| @@ -69,6 +69,11 @@ bind_interrupts!(struct Irqs { | |||
| 69 | OTG_FS => usb::InterruptHandler<peripherals::USB_OTG_FS>; | 69 | OTG_FS => usb::InterruptHandler<peripherals::USB_OTG_FS>; |
| 70 | }); | 70 | }); |
| 71 | 71 | ||
| 72 | // If you are trying this and your USB device doesn't connect, the most | ||
| 73 | // common issues are the RCC config and vbus_detection | ||
| 74 | // | ||
| 75 | // 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 | ||
| 76 | // for more information. | ||
| 72 | #[embassy_executor::main] | 77 | #[embassy_executor::main] |
| 73 | async fn main(_spawner: Spawner) { | 78 | async fn main(_spawner: Spawner) { |
| 74 | info!("Hello World!"); | 79 | info!("Hello World!"); |
| @@ -99,7 +104,15 @@ async fn main(_spawner: Spawner) { | |||
| 99 | // Create the driver, from the HAL. | 104 | // Create the driver, from the HAL. |
| 100 | let mut ep_out_buffer = [0u8; 256]; | 105 | let mut ep_out_buffer = [0u8; 256]; |
| 101 | let mut config = embassy_stm32::usb::Config::default(); | 106 | let mut config = embassy_stm32::usb::Config::default(); |
| 107 | |||
| 108 | // Enable vbus_detection | ||
| 109 | // Note: some boards don't have this wired up and might not require it, | ||
| 110 | // as they are powered through usb! | ||
| 111 | // If you hang on boot, try setting this to "false"! | ||
| 112 | // 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 | ||
| 113 | // for more information | ||
| 102 | config.vbus_detection = true; | 114 | config.vbus_detection = true; |
| 115 | |||
| 103 | let driver = Driver::new_fs(p.USB_OTG_FS, Irqs, p.PA12, p.PA11, &mut ep_out_buffer, config); | 116 | let driver = Driver::new_fs(p.USB_OTG_FS, Irqs, p.PA12, p.PA11, &mut ep_out_buffer, config); |
| 104 | 117 | ||
| 105 | // Create embassy-usb Config | 118 | // Create embassy-usb Config |
