Skip to content

Commit b7c2dd0

Browse files
authored
Merge pull request #15132 from douardda/fix-usb-stm32
STM32: fix USB_reenumerate() for STM32F3
2 parents 46bbfbd + d5d93a4 commit b7c2dd0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

targets/TARGET_STM/USBPhy_STM32.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ USBPhyHw::~USBPhyHw()
194194

195195
#if defined(TARGET_STM32F1) || defined(TARGET_STM32F3) || defined(SYSCFG_PMC_USB_PU)
196196

197-
#include "drivers/DigitalOut.h"
197+
#include "drivers/DigitalInOut.h"
198198

199199
void USB_reenumerate()
200200
{
@@ -204,14 +204,15 @@ void USB_reenumerate()
204204
wait_us(10000); // 10ms
205205
LL_SYSCFG_EnableUSBPullUp();
206206
#elif defined(USB_PULLUP_CONTROL)
207-
mbed::DigitalOut usb_dp_pin(USB_PULLUP_CONTROL, 0);
207+
mbed::DigitalInOut usb_dp_pin(USB_PULLUP_CONTROL, PIN_OUTPUT, PullNone, 0);
208208
wait_us(1000);
209209
usb_dp_pin = 1;
210210
wait_us(1000);
211211
#else
212212
// Force USB_DP pin (with external pull up) to 0
213-
mbed::DigitalOut usb_dp_pin(USB_DP, 0);
213+
mbed::DigitalInOut usb_dp_pin(USB_DP, PIN_OUTPUT, PullNone, 0);
214214
wait_us(10000); // 10ms
215+
usb_dp_pin.input(); // revert as input
215216
#endif
216217
}
217218
#endif

0 commit comments

Comments
 (0)