From b60f5283ae2d7a63a51b1392e383beb7ef866b18 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Tue, 23 Jun 2015 11:51:56 +0200 Subject: [PATCH] Fix usage of USB_VBUS USB_VBUS is not an alternate function, it is an additionnal function which is always enabled. If configured as an alternate function, it will draw current from VBUS. --- src/platforms/f4discovery/platform.c | 5 ++--- src/platforms/f4discovery/usbdfu.c | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/platforms/f4discovery/platform.c b/src/platforms/f4discovery/platform.c index e85ebd5..e0d1d9f 100644 --- a/src/platforms/f4discovery/platform.c +++ b/src/platforms/f4discovery/platform.c @@ -55,9 +55,8 @@ void platform_init(void) rcc_peripheral_enable_clock(&RCC_AHB1ENR, RCC_AHB1ENR_CRCEN); /* Set up USB Pins and alternate function*/ - gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, - GPIO9 | GPIO11 | GPIO12); - gpio_set_af(GPIOA, GPIO_AF10, GPIO9 | GPIO11 | GPIO12); + gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO11 | GPIO12); + gpio_set_af(GPIOA, GPIO_AF10, GPIO11 | GPIO12); GPIOC_OSPEEDR &=~0xF30; GPIOC_OSPEEDR |= 0xA20; diff --git a/src/platforms/f4discovery/usbdfu.c b/src/platforms/f4discovery/usbdfu.c index 6a40295..101824f 100644 --- a/src/platforms/f4discovery/usbdfu.c +++ b/src/platforms/f4discovery/usbdfu.c @@ -60,8 +60,8 @@ int main(void) /* Set up USB Pins and alternate function*/ gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, - GPIO9 | GPIO10 | GPIO11 | GPIO12); - gpio_set_af(GPIOA, GPIO_AF10, GPIO9 | GPIO10| GPIO11 | GPIO12); + GPIO10 | GPIO11 | GPIO12); + gpio_set_af(GPIOA, GPIO_AF10, GPIO10 | GPIO11 | GPIO12); dfu_init(&stm32f107_usb_driver); dfu_main();