Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STM32: fix USB_reenumerate() for STM32F3 #15132

Merged
merged 1 commit into from
Oct 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions targets/TARGET_STM/USBPhy_STM32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ USBPhyHw::~USBPhyHw()

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

#include "drivers/DigitalOut.h"
#include "drivers/DigitalInOut.h"

void USB_reenumerate()
{
Expand All @@ -204,14 +204,15 @@ void USB_reenumerate()
wait_us(10000); // 10ms
LL_SYSCFG_EnableUSBPullUp();
#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);
usb_dp_pin = 1;
wait_us(1000);
#else
// 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
usb_dp_pin.input(); // revert as input
#endif
}
#endif
Expand Down