Skip to content

Commit f2a7b83

Browse files
committed
platforms/blackpill-f4: Fix DWC USB init (cleanup)
V-Bus Sense Disable is required both in DFU and in FW.
1 parent 0521ffd commit f2a7b83

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

src/platforms/common/blackpill-f4/blackpill-f4.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,9 @@ void platform_init(void)
8080
rcc_periph_clock_enable(RCC_OTGFS);
8181
rcc_periph_clock_enable(RCC_CRC);
8282

83-
#if 0
84-
/* Set up USB Pins and alternate function */
85-
gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO9 | GPIO11 | GPIO12);
86-
gpio_set_af(GPIOA, GPIO_AF10, GPIO9 | GPIO10 | GPIO11 | GPIO12);
87-
#else
88-
/* PA9/PA10 are not routed to USB on Blackpill-F4 */
83+
/* Set up DM/DP pins. PA9/PA10 are not routed to USB-C. */
8984
gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO11 | GPIO12);
9085
gpio_set_af(GPIOA, GPIO_AF10, GPIO11 | GPIO12);
91-
#endif
9286

9387
GPIOA_OSPEEDR &= 0x3c00000cU;
9488
GPIOA_OSPEEDR |= 0x28000008U;

src/platforms/common/blackpill-f4/usbdfu.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,9 @@ int main(void)
7373
dfu_protect(false);
7474
dfu_init(&USB_DRIVER);
7575

76-
#if 0
7776
/* https://github.com/libopencm3/libopencm3/pull/1256#issuecomment-779424001 */
7877
OTG_FS_GCCFG |= OTG_GCCFG_NOVBUSSENS | OTG_GCCFG_PWRDWN;
7978
OTG_FS_GCCFG &= ~(OTG_GCCFG_VBUSBSEN | OTG_GCCFG_VBUSASEN);
80-
#endif
8179

8280
dfu_main();
8381
}

0 commit comments

Comments
 (0)