cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L151C8T6A clock configuration in CubeMX

CraigMeyers
Associate II

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?

0693W00000LweunQAB.png

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

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.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

6 REPLIES 6
TDK
Guru

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?

If you feel a post has answered your question, please click "Accept as Solution".
CraigMeyers
Associate II

Fails immediately, with dialog box Clock Wizard saying "Cannot found solution for some constraints" and "Searching Solution, Please Wait..." progress bar zipping back and forth.

I've attached the IOC file.

CraigMeyers
Associate II

screenshot of resolver results...attached.

TDK
Guru

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.

If you feel a post has answered your question, please click "Accept as Solution".
CraigMeyers
Associate II

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:

0693W00000LwhVpQAJ.pngBut 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:0693W00000LwhWKQAZ.png 

Thanks for the answers!!

Swhit.2
Associate

That was really helpful and brief guide