2022-04-02 04:53 AM
The Clock Configuration tab in CubeMX is not happy and I cannot figure out what the problem is exactly. I only want to use HSE a 25MHz external clock source in BYPASS. And I do not intend to use the PLL. Is this a bug in the tool? How can I satisfy this clock configurator?
Solved! Go to Solution.
2022-04-02 05:15 PM
The issue is that USB must be clocked from a crystal, but you're clocking it from HSI16 (by way of the PLL), which isn't accurate enough. Certain families support crystal-less USB, but the STM32L1 is not one of them.
CubeMX could and should be better at explaining why it flagged the error, but it's correct to flag it as an issue.
There's no good solution for you here since 25 MHz is too high for VCOInput. Using a different crystal is an option, but your SYSCLK speed will need to change in order to satisfy USB requirements.
2022-04-02 06:04 AM
Seems like a bug, but maybe there's a reason. What does it do if you click Resolve Clock Issues? Can you attach your IOC?
2022-04-02 03:28 PM
2022-04-02 03:29 PM
2022-04-02 05:15 PM
The issue is that USB must be clocked from a crystal, but you're clocking it from HSI16 (by way of the PLL), which isn't accurate enough. Certain families support crystal-less USB, but the STM32L1 is not one of them.
CubeMX could and should be better at explaining why it flagged the error, but it's correct to flag it as an issue.
There's no good solution for you here since 25 MHz is too high for VCOInput. Using a different crystal is an option, but your SYSCLK speed will need to change in order to satisfy USB requirements.
2022-04-03 07:47 AM
I have access to 8MHz oscillator that I can use. Problem is, my system operates on 25MHz clock.
And the datasheet is misleading WRT crystal-less USB:
But I see the USB interface requires a 48MHz clock, which requires the PLL. If I select HSE (of 25MHz), it's too large for VCOInput (limited to 24MHz). And you cannot make a 48MHz clock from a 25MHz clock:
Thanks for the answers!!
2022-04-03 11:52 AM
That was really helpful and brief guide