diff --git a/os/hal/ports/STM32/LLD/USBv1/hal_usb_lld.c b/os/hal/ports/STM32/LLD/USBv1/hal_usb_lld.c index 20607b735..e35dc5513 100644 --- a/os/hal/ports/STM32/LLD/USBv1/hal_usb_lld.c +++ b/os/hal/ports/STM32/LLD/USBv1/hal_usb_lld.c @@ -477,6 +477,11 @@ void usb_lld_start(USBDriver *usbp) { /* Clock activation.*/ #if STM32_USB_USE_USB1 if (&USBD1 == usbp) { + + osalDbgAssert((STM32_USBCLK >= (48000000U - STM32_USB_48MHZ_DELTA)) && + (STM32_USBCLK <= (48000000U + STM32_USB_48MHZ_DELTA)), + "invalid clock frequency"); + /* USB clock enabled.*/ rccEnableUSB(true); /* Powers up the transceiver while holding the USB in reset state.*/ diff --git a/os/hal/ports/STM32/LLD/USBv1/hal_usb_lld.h b/os/hal/ports/STM32/LLD/USBv1/hal_usb_lld.h index 1270172fc..1c00de8a8 100644 --- a/os/hal/ports/STM32/LLD/USBv1/hal_usb_lld.h +++ b/os/hal/ports/STM32/LLD/USBv1/hal_usb_lld.h @@ -166,11 +166,6 @@ #error "invalid STM32_USB_48MHZ_DELTA setting, it must not exceed 250000" #endif -#if (STM32_USBCLK < (48000000 - STM32_USB_48MHZ_DELTA)) || \ - (STM32_USBCLK > (48000000 + STM32_USB_48MHZ_DELTA)) -#error "the USB driver requires a 48MHz clock" -#endif - /*===========================================================================*/ /* Driver data structures and types. */ /*===========================================================================*/ diff --git a/os/hal/ports/STM32/STM32G4xx/hal_lld.h b/os/hal/ports/STM32/STM32G4xx/hal_lld.h index 19a9db32c..574cdd5c2 100644 --- a/os/hal/ports/STM32/STM32G4xx/hal_lld.h +++ b/os/hal/ports/STM32/STM32G4xx/hal_lld.h @@ -1345,7 +1345,7 @@ * @brief LPTIM1 clock frequency. */ #if (STM32_LPTIM1SEL == STM32_LPTIM1SEL_PCLK1) || defined(__DOXYGEN__) - #define STM32_LPTIM1CLK hal_lld_get_clock_point(CLK_PCLK1 + #define STM32_LPTIM1CLK hal_lld_get_clock_point(CLK_PCLK1) #elif STM32_LPTIM1SEL == STM32_LPTIM1SEL_LSI #define STM32_LPTIM1CLK STM32_LSICLK diff --git a/readme.txt b/readme.txt index 41be3bcec..583c8cbdd 100644 --- a/readme.txt +++ b/readme.txt @@ -74,7 +74,7 @@ ***************************************************************************** *** Next *** -- NEW: USARTv2, USARTv3 updated for dynamic clocking. +- NEW: STM32 USARTv2, USARTv3 updated for dynamic clocking. - NEW: Dynamic support implemented for STM32G4xx. - NEW: Dynamic clocks support in HAL. - NEW: Reload feature added to RT virtual timers.