STM32: fix USB_reenumerate() for STM32F3

for which the DP pin remained forced low after the reenumerate sequence
(low for 10ms) instead of being reconfigured as an input (PullNone).

Signed-off-by: David Douard <david.douard@sdfa3.org>
pull/15132/head
David Douard 2021-10-05 19:48:59 +02:00
parent 76c37204e0
commit d5d93a4ef1
1 changed files with 4 additions and 3 deletions

View File

@ -194,7 +194,7 @@ USBPhyHw::~USBPhyHw()
#if defined(TARGET_STM32F1) || defined(TARGET_STM32F3) || defined(SYSCFG_PMC_USB_PU) #if defined(TARGET_STM32F1) || defined(TARGET_STM32F3) || defined(SYSCFG_PMC_USB_PU)
#include "drivers/DigitalOut.h" #include "drivers/DigitalInOut.h"
void USB_reenumerate() void USB_reenumerate()
{ {
@ -204,14 +204,15 @@ void USB_reenumerate()
wait_us(10000); // 10ms wait_us(10000); // 10ms
LL_SYSCFG_EnableUSBPullUp(); LL_SYSCFG_EnableUSBPullUp();
#elif defined(USB_PULLUP_CONTROL) #elif defined(USB_PULLUP_CONTROL)
mbed::DigitalOut usb_dp_pin(USB_PULLUP_CONTROL, 0); mbed::DigitalInOut usb_dp_pin(USB_PULLUP_CONTROL, PIN_OUTPUT, PullNone, 0);
wait_us(1000); wait_us(1000);
usb_dp_pin = 1; usb_dp_pin = 1;
wait_us(1000); wait_us(1000);
#else #else
// Force USB_DP pin (with external pull up) to 0 // Force USB_DP pin (with external pull up) to 0
mbed::DigitalOut usb_dp_pin(USB_DP, 0); mbed::DigitalInOut usb_dp_pin(USB_DP, PIN_OUTPUT, PullNone, 0);
wait_us(10000); // 10ms wait_us(10000); // 10ms
usb_dp_pin.input(); // revert as input
#endif #endif
} }
#endif #endif