From 20bdd3452ee331413656f5e8eb7eb7fd9d695910 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Sun, 2 Oct 2022 16:32:42 +0200 Subject: [PATCH] cpu/stm32/periph/usbdev_fs: conditional configuration of CRS Conditional configuration of CRS_CR_AUTOTRIMEN allows the compilation of the driver for STM32 MCUs that don't have Clock Recovery System. --- cpu/stm32/periph/usbdev_fs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cpu/stm32/periph/usbdev_fs.c b/cpu/stm32/periph/usbdev_fs.c index 034e58ff8b..3cd6b630db 100644 --- a/cpu/stm32/periph/usbdev_fs.c +++ b/cpu/stm32/periph/usbdev_fs.c @@ -138,8 +138,11 @@ static void _enable_usb_clk(void) #elif defined(RCC_APB1SMENR1_USBSMEN) RCC->APB1SMENR1 |= RCC_APB1SMENR1_USBSMEN; #endif + +#if defined(CRS_CR_AUTOTRIMEN) && defined(CRS_CR_CEN) /* Enable CRS with auto trim enabled */ CRS->CR |= (CRS_CR_AUTOTRIMEN | CRS_CR_CEN); +#endif } static void _enable_gpio(const stm32_usbdev_fs_config_t *conf)