Like this: usbDisconnectBus(usbcdc_cfg.usbp); // A delay is inserted in order to computer sense the change chThdSleepMilliseconds(2000); usbStart(usbcdc_cfg.usbp, &usb_cfg); usbConnectBus(usbcdc_cfg.usbp);
In my case I added a chThdSleepMilliseconds(2000); after disconnect, but I don't know if this is necessary in this #define.
Hi! Here we go: diff --git a/os/hal/boards/STM32F103C8_MINIMAL/board.h b/os/hal/boards/STM32F103C8_MINIMAL/board.h index 9350c1388..fbdaf7e2a 100644 --- a/os/hal/boards/STM32F103C8_MINIMAL/board.h +++ b/os/hal/boards/STM32F103C8_MINIMAL/board.h @@ -131,12 +131,17 @@ /* * USB bus activation macro, required by the USB driver. */ -#define usb_lld_connect_bus(usbp) /* always connected */ +#define usb_lld_connect_bus(usbp) do { \ + palSetPadMode(GPIOA, GPIOA_USBDP, PAL_MODE_INPUT); \ + } while(0); /*...
Board STM32F103C8_MINIMAL USB Disconnect alternative