aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32f4/src/bin/usb_ethernet.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_ethernet.rs
parent152d514f52fab3b6b1f58c5b5bc57b13b86b7126 (diff)
Add comment on vbus_detection to all USB examples
Diffstat (limited to 'examples/stm32f4/src/bin/usb_ethernet.rs')
-rw-r--r--examples/stm32f4/src/bin/usb_ethernet.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/examples/stm32f4/src/bin/usb_ethernet.rs b/examples/stm32f4/src/bin/usb_ethernet.rs
index d2cbeea1b..284c74564 100644
--- a/examples/stm32f4/src/bin/usb_ethernet.rs
+++ b/examples/stm32f4/src/bin/usb_ethernet.rs
@@ -40,6 +40,11 @@ bind_interrupts!(struct Irqs {
40 HASH_RNG => rng::InterruptHandler<peripherals::RNG>; 40 HASH_RNG => rng::InterruptHandler<peripherals::RNG>;
41}); 41});
42 42
43// If you are trying this and your USB device doesn't connect, the most
44// common issues are the RCC config and vbus_detection
45//
46// 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
47// for more information.
43#[embassy_executor::main] 48#[embassy_executor::main]
44async fn main(spawner: Spawner) { 49async fn main(spawner: Spawner) {
45 info!("Hello World!"); 50 info!("Hello World!");
@@ -71,7 +76,15 @@ async fn main(spawner: Spawner) {
71 static OUTPUT_BUFFER: StaticCell<[u8; 256]> = StaticCell::new(); 76 static OUTPUT_BUFFER: StaticCell<[u8; 256]> = StaticCell::new();
72 let ep_out_buffer = &mut OUTPUT_BUFFER.init([0; 256])[..]; 77 let ep_out_buffer = &mut OUTPUT_BUFFER.init([0; 256])[..];
73 let mut config = embassy_stm32::usb::Config::default(); 78 let mut config = embassy_stm32::usb::Config::default();
79
80 // Enable vbus_detection
81 // Note: some boards don't have this wired up and might not require it,
82 // as they are powered through usb!
83 // If you hang on boot, try setting this to "false"!
84 // 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
85 // for more information
74 config.vbus_detection = true; 86 config.vbus_detection = true;
87
75 let driver = Driver::new_fs(p.USB_OTG_FS, Irqs, p.PA12, p.PA11, ep_out_buffer, config); 88 let driver = Driver::new_fs(p.USB_OTG_FS, Irqs, p.PA12, p.PA11, ep_out_buffer, config);
76 89
77 // Create embassy-usb Config 90 // Create embassy-usb Config