Skip to main content
Graduate II
April 21, 2023
Solved

From which output of the Crystal oscillator is the signal for clocking the microcontroller taken?

  • April 21, 2023
  • 6 replies
  • 5988 views

STM32F407


_legacyfs_online_stmicro_images_0693W00000biXIiQAM.png
_legacyfs_online_stmicro_images_0693W00000biXIdQAM.pngUsually the signal is taken from the PH1-OSC_OUT pin if it is a parallel resonant oscillator circuit.

The signal for clocking the microcontroller is formed on the Crystal oscillator X2, fed to the microcontroller and amplified in the microcontroller.

If so, why is PH0-OSC_IN also connected to the microcontroller?

The MCO(PH0-OSC_IN) signal is needed only to generate a signal on the Crystal oscillator X2, why is this signal fed to the microcontroller?

If you disable PH0-OSC_IN from the microcontroller, then the signal from the Crystal oscillator X2 will continue to be fed to the microcontroller via  PH1-OSC_OUT.

Why is PH0-OSC_IN connected to the microcontroller then?

    This topic has been closed for replies.
    Best answer by AScha.3

    >From which output of the Crystal oscillator is the signal for clocking the microcontroller taken?

    what you ask about ? disco board? ok, i assume: STM32F407G-DISC1

    so see manual->schematic -> clk for F407 (osz-in) is coming from st-link F103 (MCO).

    as long as F103 is powered and send MCO (8MHz) clk, F407 oszillator and X2 crystal are just "decoration" .

    question answered. - ok ?

    6 replies

    Graduate II
    April 21, 2023

    In your 2nd picture there is only a passive crystal which does nothing on its own, only with the MCU's internal "amp" it's becoming an oscillator. Both IN and OUT are needed to create a positive feedback loop to keep it oscillating.

    If you are using an external active oscillator (which usually has voltage supply, GND, and an output), then you connect it only to the IN of the MCU - and must set that in software accordingly (HSE_BYPASS or so).

    The external active oscillator basically consists of a crystal and the amplifier circuit integrated in the MCU, usually with a stronger driver.

    MMust.5Author
    Graduate II
    May 20, 2023


    _legacyfs_online_stmicro_images_0693W00000bkToUQAU.pngIf this is an input, then why does the Pierce generator need a signal on PH0-OSC_IN?

    The Pierce oscillator generates a signal using an inverter, a quartz resonator and capacitors.

    MMust.5Author
    Graduate II
    May 20, 2023

    MCO - Main Clock Output.

    I don't understand the signs very well.

    MCO should be an output, what does the yellow MCO arrow pointing to the microcontroller mean then?

    0693W00000bkTrdQAE_inv.png

    MMust.5Author
    Graduate II
    May 20, 2023

    There is such a description, but it is not clear from it exactly where the MCO signal is generated.

    The description says: MCO from ST-LINK. MCO generated in ST-LINK?

    ------------------

    MCO from ST-LINK: MCO output of ST-LINK MCU is used as input clock. This frequency cannot be changed, it is fixed at 8 MHz and connected to PF0/PD0/PH0-OSC_IN of STM32 microcontroller.

    AScha.3Answer
    Super User
    May 20, 2023

    >From which output of the Crystal oscillator is the signal for clocking the microcontroller taken?

    what you ask about ? disco board? ok, i assume: STM32F407G-DISC1

    so see manual->schematic -> clk for F407 (osz-in) is coming from st-link F103 (MCO).

    as long as F103 is powered and send MCO (8MHz) clk, F407 oszillator and X2 crystal are just "decoration" .

    question answered. - ok ?

    MMust.5Author
    Graduate II
    May 20, 2023

    What is X2 for then?

    Super User
    May 20, 2023

    now : useless.

    if you remove/de-solder R68 (= disconnect MCO ), X2 + F407 set to external clock are the 8MHz source then.

    the designer was probably drunk, because this clk circuit looks like.

    also on my F407 board LSE , 32kHz crystal, is fitted, but in diagram is marked as "not fitted" .

    on some newer boards the circuit is clear: (nucleo-G0B1RE MB 1360 )


    _legacyfs_online_stmicro_images_0693W00000bkU9rQAE.pngclk coming from st-link MCO and other parts not fitted.

    0693W00000bkUA1QAM_image.png

    but to try, can fit missing parts and open SB17 , then local crystal is clk source.

    on (old) F407 boards this "switch" SB is missing.

    MMust.5Author
    Graduate II
    May 20, 2023

    Somewhere there is a Solder Bridge that shorts out C15.

    I'll look for one tomorrow. I didn't find it on the diagram.

    MMust.5Author
    Graduate II
    May 20, 2023

    I have another question on the same topic.

    HSE is formed by a crystal and is equal to 8 megahertz.

    HSI is formed inside the STM32F407 microcontroller and is equal to 16 MHz.

    Are there settings for the 8 MHz MCO signal that comes from ST Link? (I know that this frequency is unchangeable, maybe some other settings, for example, setting MCO 8 MHz from ST Link as a clock source.)

    Or is ST Link's 8 MHz MCO just a fallback for HSE?

    There are no separate settings for MCO 8 MHz from ST Link? STM32F407 microcontroller sees MCO 8 MHz from ST Link as HSE?

    Super User
    May 21, 2023

    > Are there settings for the 8 MHz MCO signal that comes from ST Link?

    no. except you set in clock settings an external 8M clock.

    >Or is ST Link's 8 MHz MCO just a fallback for HSE?

    no. is cheap standard clock on most nucleo boards, because stlink anyway there.

    >There are no separate settings for MCO 8 MHz from ST Link? 

    no.

    > STM32F407 microcontroller sees MCO 8 MHz from ST Link as HSE?

    yes. is same as external clock oscillator for F407 ; can use the "bypass" clock setting.

    (you have changed this, now F407 on his own crystal clock. )