cancel
Showing results for 
Search instead for 
Did you mean: 

Effect of using Crystal/Ceramic Clock option with MEMS oscillator

BPaik
Senior

I have a board with an STM32L0 part that uses an 8MHz MEMS oscillator as the external clock source. I recently observed that using the Crystal/Ceramic option appears to make the SYSCLK run at half the expected rate. Using the correct BYPASS option produces the expected SYSCLK frequency. I thought the BYPASS option simply frees up the clock out pin for use as a GPIO. Other boards I've made with F4 and G4 parts seem to maintain the same SYSCLK for both Crystal/Ceramic and BYPASS configurations. Obviously this is not a problem, I was just curious about the observed behavior and couldn't find more detailed information about this in the datasheets.

1 ACCEPTED SOLUTION

Accepted Solutions
Peter BENSCH
ST Employee

Of course, the different parts behave differently - precisely because the silicon is different. One cannot assume that an undefined function with undefined behaviour behaves in the same way on other parts, not even on parts of the same family.

So please always set the HSE option to BYPASS in the RCC block when using an external oscillator so that nothing unexpected happens.

If the problem is resolved, please mark this thread as answered by selecting Select as best under your preferred answer. This will help other users find that answer faster.

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

3 REPLIES 3
Peter BENSCH
ST Employee

The Crystal/Ceramic option activates the internal oscillator and uses two pins to connect an external crystal or ceramic resonator.

If an external oscillator is present, which includes MEMS oscillators, it has its own oscillator and outputs the generated signal to its output. In this case, an oscillator is no longer necessary in the STM32, the signal fed in can be passed directly to the clock logic via BYPASS and the CLKOUT that would otherwise be necessary is freed up as a GPIO.

With an external oscillator, the function of the internal oscillator is not defined with Option Crystal/Ceramic, which is why there is the BYPASS option.

Does it answer your question?

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
BPaik
Senior

My question was to try to understand why the L0 would have a reduced SYSCLK while the F4 and G4 would have a normal SYSCLK (when both used the same 8MHz external oscillator and with Crystal/Ceramic configuration). I suppose since you said the behavior in this situation is undefined, it is normal to have different behavior for different parts. Perhaps the silicon is different.

Peter BENSCH
ST Employee

Of course, the different parts behave differently - precisely because the silicon is different. One cannot assume that an undefined function with undefined behaviour behaves in the same way on other parts, not even on parts of the same family.

So please always set the HSE option to BYPASS in the RCC block when using an external oscillator so that nothing unexpected happens.

If the problem is resolved, please mark this thread as answered by selecting Select as best under your preferred answer. This will help other users find that answer faster.

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.