diff options
Diffstat (limited to 'testhal/STM32F4xx/USB_CDC/main.c')
-rw-r--r-- | testhal/STM32F4xx/USB_CDC/main.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/testhal/STM32F4xx/USB_CDC/main.c b/testhal/STM32F4xx/USB_CDC/main.c index 0ae9c81e0..99acdc894 100644 --- a/testhal/STM32F4xx/USB_CDC/main.c +++ b/testhal/STM32F4xx/USB_CDC/main.c @@ -296,13 +296,18 @@ static void usb_event(USBDriver *usbp, usbevent_t event) { case USB_EVENT_ADDRESS:
return;
case USB_EVENT_CONFIGURED:
+ chSysLockFromIsr();
+
/* Enables the endpoints specified into the configuration.
Note, this callback is invoked from an ISR so I-Class functions
must be used.*/
- chSysLockFromIsr();
usbInitEndpointI(usbp, USB_CDC_DATA_REQUEST_EP, &ep1config);
usbInitEndpointI(usbp, USB_CDC_INTERRUPT_REQUEST_EP, &ep2config);
usbInitEndpointI(usbp, USB_CDC_DATA_AVAILABLE_EP, &ep3config);
+
+ /* Resetting the state of the CDC subsystem.*/
+ sduConfigureHookI(usbp);
+
chSysUnlockFromIsr();
return;
case USB_EVENT_SUSPEND:
@@ -437,10 +442,10 @@ int main(void) { /*
* Activates the USB driver and then the USB bus pull-up on D+.
*/
+ usbDisconnectBus(serusbcfg.usbp);
+ chThdSleepMilliseconds(1000);
sduObjectInit(&SDU1);
sduStart(&SDU1, &serusbcfg);
- usbDisconnectBus(serusbcfg.usbp);
- chThdSleepMilliseconds(100);
usbConnectBus(serusbcfg.usbp);
/*
|