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