aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32/STM32F4xx/USB_CDC_IAD
diff options
context:
space:
mode:
Diffstat (limited to 'testhal/STM32/STM32F4xx/USB_CDC_IAD')
-rw-r--r--testhal/STM32/STM32F4xx/USB_CDC_IAD/Makefile2
-rw-r--r--testhal/STM32/STM32F4xx/USB_CDC_IAD/usbcfg.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/testhal/STM32/STM32F4xx/USB_CDC_IAD/Makefile b/testhal/STM32/STM32F4xx/USB_CDC_IAD/Makefile
index 56351076a..d5e19d9a2 100644
--- a/testhal/STM32/STM32F4xx/USB_CDC_IAD/Makefile
+++ b/testhal/STM32/STM32F4xx/USB_CDC_IAD/Makefile
@@ -5,7 +5,7 @@
# Compiler options here.
ifeq ($(USE_OPT),)
- USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16
+ USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16
endif
# C specific options here (added to USE_OPT).
diff --git a/testhal/STM32/STM32F4xx/USB_CDC_IAD/usbcfg.c b/testhal/STM32/STM32F4xx/USB_CDC_IAD/usbcfg.c
index 5abf0f520..873bea31e 100644
--- a/testhal/STM32/STM32F4xx/USB_CDC_IAD/usbcfg.c
+++ b/testhal/STM32/STM32F4xx/USB_CDC_IAD/usbcfg.c
@@ -394,6 +394,13 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
chSysUnlockFromISR();
return;
case USB_EVENT_SUSPEND:
+ chSysLockFromISR();
+
+ /* Disconnection event on suspend.*/
+ sduDisconnectI(&SDU1);
+ sduDisconnectI(&SDU2);
+
+ chSysUnlockFromISR();
return;
case USB_EVENT_WAKEUP:
return;