2025-01-17 04:33 AM
I am in the process of transferring from Mbed to VSCode with the STM332 extension. I have set up a project using CubeMX set to the default settings for a NUCLEO-L073 and have no issues. I believe this setup uses the MSI clock. I am trying to implement the HSE with an external 8MHz crystal but cannot get it to work. The program does not run (basic LED blinky) and there is no clock signal on the crystal when monitored with an oscilloscope.
The changes I have made from the default NUCLEO-L073 CubeMX settings are:
Pinout & Configuration tab: RCC High Speed Clock (HSE) set to Crystal/Ceramic Resonator
Clock Configuration tab: System Clock Mux set to HSE
I have verified that there is no issue with the hardware - when running from mbed the crystal has a good 8Mhz signal.
Are there any other settings I am missing?
Is there any other code i need to add on top of the CubeMX generated output?
Thanks
2025-01-17 04:42 AM
Did you put the crystal on Nucleo board?
Check the clock options description in Nucleo board manual. Maybe you need to change some config bridges on the board.
2025-01-17 05:09 AM - edited 2025-01-17 05:12 AM
Hello @pmcew and welcome to the community,
According to the board schematics, the crystal is not soldered:
[N/A] means Not Applicable by default.
The default state is to use STLINK MCO output as clock source for the MCU target as shown in the schematics.
Need to select Bypass mode in this case.
If you soldered all the components related to the external crystal (X3, C33, C34), you need to remove the solder bridge SB50.
Hope that answers your question.
2025-01-17 05:17 AM
Hi,
Thanks for quick replies. Sorry, I was not clear - the board I am using is not actually a Nucleo, I was just using those settings as a starting point. It is a custom L073 board with crystal fitted.
2025-01-17 05:30 AM - edited 2025-01-17 05:31 AM
@pmcew wrote:
the board I am using is not actually a Nucleo,
But why you said it was a Nucleo from the first post? each question needs to be concise and focusing the issue by giving the exact environment to avoid ping pongs. See tips.
But anyway, are you sure about the crystal value and it's status (OK, KO?) what about this feedback resistor? Did you try to remove it?
According to the AN2867 "Guidelines for oscillator design on STM8AF/AL/S and STM32 MCUs/MPUs" the feedback resistor (R42) is already embedded in the MCU.
2025-01-17 05:39 AM
In my first post I said that I was using the settings for a Nucleo-L073 in CubeMX, not that I was actually using a Nucleo itself, but I agree that it was not clear and I appreciate your help on this.
I am sure the crystal is OK and there are no hardware issues, because when I apply the correct settings in mbed the crystal is running OK and i can see the 8MHz wave on an oscilloscope. In mbed I make the following additions to the mbed_app.json file to enable the HSE:
I will try removing R42 but if the crystal is working on mbed then I do not think this will solve the issue.
Are there any other settings that I may have missed in CubeMX?
Thanks
2025-01-17 06:13 AM
We are not supporting MBED environment in the community and I don't even know how it works.
But according to this:
"target.clock_source": "USE_PLL_HSE_XTAL",
You need to select HSE + PLL not directly HSE as you shown in your first screenshot.
I don't have an idea about your PLL config (multiplier and dividers)