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/stm32h7/src/bin | |
| parent | 152d514f52fab3b6b1f58c5b5bc57b13b86b7126 (diff) | |
Add comment on vbus_detection to all USB examples
Diffstat (limited to 'examples/stm32h7/src/bin')
| -rw-r--r-- | examples/stm32h7/src/bin/usb_serial.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/examples/stm32h7/src/bin/usb_serial.rs b/examples/stm32h7/src/bin/usb_serial.rs index 576506ad3..725c9bb02 100644 --- a/examples/stm32h7/src/bin/usb_serial.rs +++ b/examples/stm32h7/src/bin/usb_serial.rs | |||
| @@ -15,6 +15,11 @@ bind_interrupts!(struct Irqs { | |||
| 15 | OTG_FS => usb::InterruptHandler<peripherals::USB_OTG_FS>; | 15 | OTG_FS => usb::InterruptHandler<peripherals::USB_OTG_FS>; |
| 16 | }); | 16 | }); |
| 17 | 17 | ||
| 18 | // If you are trying this and your USB device doesn't connect, the most | ||
| 19 | // common issues are the RCC config and vbus_detection | ||
| 20 | // | ||
| 21 | // 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 | ||
| 22 | // for more information. | ||
| 18 | #[embassy_executor::main] | 23 | #[embassy_executor::main] |
| 19 | async fn main(_spawner: Spawner) { | 24 | async fn main(_spawner: Spawner) { |
| 20 | info!("Hello World!"); | 25 | info!("Hello World!"); |
| @@ -47,7 +52,15 @@ async fn main(_spawner: Spawner) { | |||
| 47 | // Create the driver, from the HAL. | 52 | // Create the driver, from the HAL. |
| 48 | let mut ep_out_buffer = [0u8; 256]; | 53 | let mut ep_out_buffer = [0u8; 256]; |
| 49 | let mut config = embassy_stm32::usb::Config::default(); | 54 | let mut config = embassy_stm32::usb::Config::default(); |
| 55 | |||
| 56 | // Enable vbus_detection | ||
| 57 | // Note: some boards don't have this wired up and might not require it, | ||
| 58 | // as they are powered through usb! | ||
| 59 | // If you hang on boot, try setting this to "false"! | ||
| 60 | // 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 | ||
| 61 | // for more information | ||
| 50 | config.vbus_detection = true; | 62 | config.vbus_detection = true; |
| 63 | |||
| 51 | let driver = Driver::new_fs(p.USB_OTG_FS, Irqs, p.PA12, p.PA11, &mut ep_out_buffer, config); | 64 | let driver = Driver::new_fs(p.USB_OTG_FS, Irqs, p.PA12, p.PA11, &mut ep_out_buffer, config); |
| 52 | 65 | ||
| 53 | // Create embassy-usb Config | 66 | // Create embassy-usb Config |
