Merge pull request #15132 from douardda/fix-usb-stm32

STM32: fix USB_reenumerate() for STM32F3
pull/15133/head
Martin Kojtal 2021-10-11 12:33:42 +02:00 committed by GitHub
commit b7c2dd01bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)
#include "drivers/DigitalOut.h"
#include "drivers/DigitalInOut.h"
void USB_reenumerate()
{
@ -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