aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-10-04 03:50:19 -0400
committerKevin O'Connor <kevin@koconnor.net>2018-10-11 10:50:51 -0400
commitb8745bc97361fc21e708a0079fe0e808b0b0d010 (patch)
treebba7ae9fba7451d881f8efc5fc7fad003f210138
parentbc5e961d735f2994fab8f13cb2c39190c515774d (diff)
downloadkutter-b8745bc97361fc21e708a0079fe0e808b0b0d010.tar.gz
kutter-b8745bc97361fc21e708a0079fe0e808b0b0d010.tar.xz
kutter-b8745bc97361fc21e708a0079fe0e808b0b0d010.zip
stm32f1: Pull the USB D+ line low briefly to signal a device connect
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--src/stm32f1/usbserial.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/stm32f1/usbserial.c b/src/stm32f1/usbserial.c
index 067bba07..f9e46d8c 100644
--- a/src/stm32f1/usbserial.c
+++ b/src/stm32f1/usbserial.c
@@ -10,6 +10,8 @@
#include "board/usb_cdc_ep.h" // USB_CDC_EP_BULK_IN
#include "sched.h" // DECL_INIT
#include "stm32f1xx.h" // USB
+#include "stm32f1xx_ll_gpio.h" // LL_GPIO_SetOutputPin
+#include "stm32f1xx_ll_utils.h" // LL_mDelay
/****************************************************************
@@ -218,6 +220,12 @@ usb_set_configure(void)
void
usb_init(void)
{
+ // Pull the D+ pin low briefly to signal a new connection
+ LL_GPIO_ResetOutputPin(GPIOA, LL_GPIO_PIN_12);
+ LL_GPIO_SetPinMode(GPIOA, LL_GPIO_PIN_12, LL_GPIO_MODE_OUTPUT);
+ LL_mDelay(5);
+ LL_GPIO_SetPinMode(GPIOA, LL_GPIO_PIN_12, LL_GPIO_MODE_FLOATING);
+
// Setup USB packet memory
btable_configure();