Code: Select all
/**
* @brief 48MHz clock frequency.
*/
#if (STM32_CLK48SEL == STM32_CLK48SEL_NOCLK) || defined(__DOXYGEN__)
#define STM32_48CLK 0
#elif STM32_CLK48SEL == STM32_CLK48SEL_PLLSAI1
#define STM32_48CLK (STM32_PLLSAI1VCO / STM32_PLLSAI1Q_VALUE)
#elif STM32_CLK48SEL == STM32_CLK48SEL_PLL
#define STM32_48CLK (STM32_PLLVCO / STM32_PLLQ_VALUE)
#elif STM32_CLK48SEL == STM32_CLK48SEL_MSI
#define STM32_48CLK STM32_MSICLK
#else
#error "invalid source selected for 48CLK clock"
#endif
#define STM32_USBCLK STM32_48CLK
..........
In contrast, the code hal code for the stm32f0xx does provide such a method:
Code: Select all
/**
* @brief USB frequency.
*/
#if (STM32_USBSW == STM32_USBSW_HSI48) || defined(__DOXYGEN__)
#define STM32_USBCLK STM32_HSI48CLK
#elif STM32_USBSW == STM32_USBSW_PCLK
#define STM32_USBCLK STM32_PLLCLKOUT
#else
#error "invalid source selected for USB clock"
#endif
...........
I wouldn't mind, but I couldn't find a workaround short of hacking the hal_lld.h file which I hate to do. BTW, with a little work, the CRS + USB combo works quite well on the STM32L432.
Geoffrey Brown