cancel
Showing results for 
Search instead for 
Did you mean: 

Struggling with HSE

pmcew
Visitor

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

 

 

6 REPLIES 6
gbm
Lead III

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.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
SofLit
ST Employee

Hello @pmcew and welcome to the community,

According to the board schematics, the crystal is not soldered:

[N/A] means Not Applicable by default.

SofLit_0-1737119159605.png

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.

SofLit_1-1737119264913.png

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.

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.
PS: This is NOT an online support (https://ols.st.com) but a collaborative space. So please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help/support.
pmcew
Visitor

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.

pmcew_0-1737119755153.png

 


@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.

SofLit_0-1737120521466.png

 

 

 

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.
PS: This is NOT an online support (https://ols.st.com) but a collaborative space. So please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help/support.
pmcew
Visitor

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:

"target.clock_source": "USE_PLL_HSE_XTAL",
"target.lse_available": "0"

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

 

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.

SofLit_0-1737123142581.png

I don't have an idea about your PLL config (multiplier and dividers)

 

 

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.
PS: This is NOT an online support (https://ols.st.com) but a collaborative space. So please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help/support.