diff --git a/os/hal/ports/STM32/LLD/USBv1/usb_lld.c b/os/hal/ports/STM32/LLD/USBv1/usb_lld.c index ac8c2189f..b8e2ed114 100644 --- a/os/hal/ports/STM32/LLD/USBv1/usb_lld.c +++ b/os/hal/ports/STM32/LLD/USBv1/usb_lld.c @@ -448,7 +448,9 @@ void usb_lld_start(USBDriver *usbp) { STM32_USB->CNTR = CNTR_FRES; /* Enabling the USB IRQ vectors, this also gives enough time to allow the transceiver power up (1uS).*/ +#if STM32_USB1_HP_NUMBER != STM32_USB1_LP_NUMBER nvicEnableVector(STM32_USB1_HP_NUMBER, STM32_USB_USB1_HP_IRQ_PRIORITY); +#endif nvicEnableVector(STM32_USB1_LP_NUMBER, STM32_USB_USB1_LP_IRQ_PRIORITY); /* Releases the USB reset.*/ STM32_USB->CNTR = 0; @@ -473,7 +475,9 @@ void usb_lld_stop(USBDriver *usbp) { if (usbp->state == USB_STOP) { #if STM32_USB_USE_USB1 if (&USBD1 == usbp) { +#if STM32_USB1_HP_NUMBER != STM32_USB1_LP_NUMBER nvicDisableVector(STM32_USB1_HP_NUMBER); +#endif nvicDisableVector(STM32_USB1_LP_NUMBER); STM32_USB->CNTR = CNTR_PDWN | CNTR_FRES; rccDisableUSB(FALSE); diff --git a/os/hal/ports/STM32/LLD/USBv1/usb_lld.h b/os/hal/ports/STM32/LLD/USBv1/usb_lld.h index b32597921..2067ad518 100644 --- a/os/hal/ports/STM32/LLD/USBv1/usb_lld.h +++ b/os/hal/ports/STM32/LLD/USBv1/usb_lld.h @@ -71,7 +71,8 @@ /** * @brief USB1 interrupt priority level setting. */ -#if !defined(STM32_USB_USB1_HP_IRQ_PRIORITY) || defined(__DOXYGEN__) +#if (!defined(STM32_USB_USB1_HP_IRQ_PRIORITY) && \ + (STM32_USB1_HP_NUMBER != STM32_USB1_LP_NUMBER)) || defined(__DOXYGEN__) #define STM32_USB_USB1_HP_IRQ_PRIORITY 13 #endif @@ -95,6 +96,7 @@ #endif #if STM32_USB_USE_USB1 && \ + (STM32_USB1_HP_NUMBER != STM32_USB1_LP_NUMBER) && \ !CORTEX_IS_VALID_KERNEL_PRIORITY(STM32_USB_USB1_HP_IRQ_PRIORITY) #error "Invalid IRQ priority assigned to USB HP" #endif diff --git a/testhal/STM32/STM32F0xx/USB_CDC/mcuconf.h b/testhal/STM32/STM32F0xx/USB_CDC/mcuconf.h index fc28e745e..9f967fd6f 100644 --- a/testhal/STM32/STM32F0xx/USB_CDC/mcuconf.h +++ b/testhal/STM32/STM32F0xx/USB_CDC/mcuconf.h @@ -162,5 +162,4 @@ */ #define STM32_USB_USE_USB1 TRUE #define STM32_USB_LOW_POWER_ON_SUSPEND FALSE -#define STM32_USB_USB1_HP_IRQ_PRIORITY 2 #define STM32_USB_USB1_LP_IRQ_PRIORITY 3 diff --git a/testhal/STM32/STM32F0xx/USB_CDC/readme.txt b/testhal/STM32/STM32F0xx/USB_CDC/readme.txt index 39055f999..1b367fcb7 100644 --- a/testhal/STM32/STM32F0xx/USB_CDC/readme.txt +++ b/testhal/STM32/STM32F0xx/USB_CDC/readme.txt @@ -1,14 +1,14 @@ ***************************************************************************** -** ChibiOS/RT HAL - USB-CDC driver demo for STM32F30x. ** +** ChibiOS/RT HAL - USB-CDC driver demo for STM32F072. ** ***************************************************************************** ** TARGET ** -The demo runs on an ST STM32F3-Discovery board. +The demo runs on an ST STM32F072B-Discovery board. ** The Demo ** -The application demonstrates the use of the STM32F30x USB driver. +The application demonstrates the use of the STM32F072 USB driver. ** Build Procedure **