aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--os/hal/platforms/STM32/OTGv1/usb_lld.c8
-rw-r--r--testhal/STM32F4xx/USB_CDC/main.c2
2 files changed, 7 insertions, 3 deletions
diff --git a/os/hal/platforms/STM32/OTGv1/usb_lld.c b/os/hal/platforms/STM32/OTGv1/usb_lld.c
index 36ef53298..a33f7810d 100644
--- a/os/hal/platforms/STM32/OTGv1/usb_lld.c
+++ b/os/hal/platforms/STM32/OTGv1/usb_lld.c
@@ -479,6 +479,9 @@ void usb_lld_start(USBDriver *usbp) {
/* Soft core reset.*/
otg_core_reset();
+ /* Internal FS PHY activation.*/
+ OTG->GCCFG = GCCFG_PWRDWN;
+
/* - Forced device mode.
- USB turn-around time = TRDT_VALUE.
- Full Speed 1.1 PHY.*/
@@ -528,6 +531,7 @@ void usb_lld_stop(USBDriver *usbp) {
}
#endif
}
+ OTG->GCCFG = 0;
}
/**
@@ -720,9 +724,7 @@ usbepstatus_t usb_lld_get_status_in(USBDriver *usbp, usbep_t ep) {
*/
void usb_lld_read_setup(USBDriver *usbp, usbep_t ep, uint8_t *buf) {
- (void)usbp;
- (void)ep;
- (void)buf;
+ memcpy(buf, usbp->epc[ep]->setup_buf, 8);
}
/**
diff --git a/testhal/STM32F4xx/USB_CDC/main.c b/testhal/STM32F4xx/USB_CDC/main.c
index 3ca3b70d0..ff6b2e15b 100644
--- a/testhal/STM32F4xx/USB_CDC/main.c
+++ b/testhal/STM32F4xx/USB_CDC/main.c
@@ -421,6 +421,8 @@ int main(void) {
*/
sduObjectInit(&SDU1);
sduStart(&SDU1, &serusbcfg);
+ usbDisconnectBus(serusbcfg.usbp);
+ chThdSleepMilliseconds(100);
usbConnectBus(serusbcfg.usbp);
/*