In the board STM32F103C8_MINIMAL, the macro usb_lld_disconnect_bus, it is a NOP, as this board doesn't have a mosfet to turn on/off the pull up on the USB line D+.
There is a work around that configures the port as output and pull the pin low, this will be equivalent to turning on/off the pull up. I use this with success for some time.
I don't know how to colaborate to the project, I'm used to GitHub Pull Requests, but in SourceForge I'm a dummy.
Here is the patch:
diff --git a/os/hal/boards/STM32F103C8_MINIMAL/board.h b/os/hal/boards/STM32F103C8_MINIMAL/board.h
index 9350c1388..d2360e096 100644
--- a/os/hal/boards/STM32F103C8_MINIMAL/board.h
+++ b/os/hal/boards/STM32F103C8_MINIMAL/board.h
@@ -136,7 +136,10 @@
/*
* USB bus de-activation macro, required by the USB driver.
*/
-#define usb_lld_disconnect_bus(usbp) /* always connected */
+#define usb_lld_disconnect_bus(usbp) do { \
+ palSetPadMode(GPIOA, GPIOA_USBDP, PAL_MODE_OUTPUT_PUSHPULL); \
+ palClearPad(GPIOA, GPIOA_USBDP); \
+ } while(0);
#if !defined(_FROM_ASM_)
#ifdef __cplusplus
Hi,
You need to provide the code also for usb_lld_connect_bus(usbp) or it would not be very useful. Posting small patches here is fine as approach, alternatively you may post on the ChibiOS forum.
Hi!
Here we go:
In my case I added a
chThdSleepMilliseconds(2000);after disconnect, but I don't know if this is necessary in this#define.Like this: