From b8745bc97361fc21e708a0079fe0e808b0b0d010 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Thu, 4 Oct 2018 03:50:19 -0400 Subject: [PATCH] stm32f1: Pull the USB D+ line low briefly to signal a device connect Signed-off-by: Kevin O'Connor --- src/stm32f1/usbserial.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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();