Arm Mbed OS support forum

STM32F767ZI Crashing when forced to use HSE crystal

Hello yet again. I imagine I might be getting annoying with all my posting but I am on some time constraints with the project this is for.

I did not know that the clock source is selected by a sort of process of elimination, and for the past few weeks I’ve been testing, I’ve assumed it has been using the external 8MHz crystal, the same one that is in the schematic for the nucleo board. Now that I’ve forced it to set the target clock source to the external crystal, it crashes saying “SetSysClock failed”. Why might this be? The crystal is present, close to the chip, and pretty much copied from the nucleo board schematic.

Hello Lane,

The crystal is present, close to the chip, and pretty much copied from the nucleo board schematic.

My NUCLEO-F767ZI might be different than yours but this is what it is equipped with:

Crystal    Frequency     Puspose            Present on board
X1          8 MHz        ST-LINK/V2-1       Yes
X2     32.768 kHz        Real Time Clock    Yes
X3          8 MHz        Main Clock         No
X4         25 Mhz        Ethernet Phy       Yes

As you can see my board is not equipped with an 8 MHz crystal for the main clock. This is consistent with the info in the user manual which says that the default source of HSE is the MCO from the ST-Link programmer and that the HSE on-board oscillator from X3 crystal is not provided:

6.8.1 OSC clock supply

There are four ways to configure the pins corresponding to the external high-speed clock

  • MCO from ST-LINK (Default): MCO output of ST-LINK is used as input clock. This
    frequency cannot be changed, it is fixed at 8MHz and connected to the
    PF0/PH0-OSC_IN of STM32 microcontroller. The configuration must be:
    – SB148 OFF
    – SB112 and SB149 ON
    – SB8 and SB9 OFF
  • HSE on-board oscillator from X3 crystal (not provided): for typical frequencies and
    its capacitors and resistors, refer to the STM32 microcontroller datasheet and to the
    Oscillator design guide for STM8S, STM8A and STM32 microcontrollers Application
    note (AN2867) for the oscillator design guide. The X3 crystal has the following
    characteristics: 8MHz, 8pF, 20ppm. It is recommended to use NX3225GD-8.000M-
    EXS00A-CG04874 manufactured by NIHON DEMPA KOGYO CO., LTD. The
    configuration must be:
    – SB148 and SB163 OFF
    – SB8 and SB9 soldered
    – C37 and C38 soldered with 4.3pF capacitors
    – SB112 and SB149 OFF
  • Oscillator from external PF0/PH0: from an external oscillator through the pin 29 of
    the CN11 connector. The configuration must be:
    –SB148 ON
    –SB112 and SB149 OFF
    –SB8 and SB9 removed
  • HSE not used: PF0/PH1 and PF1/PH1 are used as GPIOs instead of as clock. The
    configuration must be:
    – SB148 and SB163 ON
    – SB112 and SB149 (MCO) OFF
    – SB8 and SB9 removed

If your board is equipped with an 8 MHz HSE crystal for the main clock then make sure the configuration is set accordingly (the solder bridges SB148, SB163, SB8, SB9, SB112 an SB149 should be configured as indicated above).

With best regards, Zoltan

Thanks for the response. My NUCLEO-F767ZI is the same as yours, but I reconfigured it to use the 8MHz external crystal. It too crashes in the same way that my custom board does, so to me that must mean there is something wrong in the ST HAL or mbed. I am using the 4.3pF capacitors and the exact same crystal, so I would think there wouldn’t be an issue there, but that isn’t the case

I use this board all the time, fit the HSE Xtal and capacitors and ‘snap off’ the STM-link section.

Use the same part numbers as listed in the ST’s 144 board BOM ( I think Zoltan has listed Xtal for you).
I get mine from Mouser and works every time.
The system defaults to check if the HSE will start so you should not need to change any code.