2022-08-14 11:35 PM
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.
Solved! Go to Solution.
2022-08-16 05:33 AM
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
2022-08-15 12:14 AM
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
2022-08-15 05:56 PM
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.
2022-08-16 05:33 AM
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