Add comment on vbus_detection to all USB examples
This commit is contained in:
@@ -16,6 +16,11 @@ bind_interrupts!(struct Irqs {
|
||||
OTG_FS => usb::InterruptHandler<peripherals::USB_OTG_FS>;
|
||||
});
|
||||
|
||||
// If you are trying this and your USB device doesn't connect, the most
|
||||
// common issues are the RCC config and vbus_detection
|
||||
//
|
||||
// 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
|
||||
// for more information.
|
||||
#[embassy_executor::main]
|
||||
async fn main(_spawner: Spawner) {
|
||||
info!("Hello World!");
|
||||
@@ -46,7 +51,15 @@ async fn main(_spawner: Spawner) {
|
||||
// Create the driver, from the HAL.
|
||||
let mut ep_out_buffer = [0u8; 256];
|
||||
let mut config = embassy_stm32::usb::Config::default();
|
||||
|
||||
// Enable vbus_detection
|
||||
// Note: some boards don't have this wired up and might not require it,
|
||||
// as they are powered through usb!
|
||||
// If you hang on boot, try setting this to "false"!
|
||||
// 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
|
||||
// for more information
|
||||
config.vbus_detection = true;
|
||||
|
||||
let driver = Driver::new_fs(p.USB_OTG_FS, Irqs, p.PA12, p.PA11, &mut ep_out_buffer, config);
|
||||
|
||||
// Create embassy-usb Config
|
||||
|
||||
Reference in New Issue
Block a user