Skip to main content
Associate
March 27, 2025
Solved

Is OSC_IN actually the output and OSC_OUT the input on STM32F030?

  • March 27, 2025
  • 1 reply
  • 1023 views

Can someone tell me if I’m understanding this correctly?

In the documentation for the STM32F030R8T6 chip, specifically the "RM0360 Reference Manual", there’s a diagram showing how to connect an external crystal oscillator ("Figure 12. HSE/LSE clock sources"). In this diagram, the crystal is connected directly to the OSC_IN and OSC_OUT pins, with no series resistor on the OSC_OUT line to limit the drive level.

However, on the STM32F030 DISCOVERY board, there is such a resistor – R22 – even though the crystal is not installed by default. I added the crystal I wanted to use and measured the current through it (using a current clamp), and it became clear that it was being driven beyond its specified power limits. That’s when I realized the need for the series resistor (R22). I calculated the appropriate resistance value and installed it – but it didn’t reduce the current through the crystal at all.

After further investigation, I discovered that the OSC_OUT pin on the microcontroller is actually a high-impedance input, while OSC_IN is the output. So I tried placing the resistor in series with OSC_IN instead – and, as expected, this reduced the power dissipated in the crystal.

Is my understanding correct? And if so, does that mean the diagram in the official documentation is actually incorrect?

Best answer by Andrew Neil

@mega3psp wrote:

In the documentation for the STM32F030R8T6 chip, specifically the "RM0360 Reference Manual", there’s a diagram showing how to connect an external crystal oscillator ("Figure 12. HSE/LSE clock sources"). In this diagram, the crystal is connected directly to the OSC_IN and OSC_OUT pins,?


No - in the case of an external oscillator (ie, an external clock), it is connected to OSC_IN only - the OSC_OUT pin is free for use as GPIO:

AndrewNeil_0-1743096811780.png

 

Both pins are only used in the case of an external crystal:

AndrewNeil_1-1743096872327.png

Difference between an oscillator an a crystal:

https://community.st.com/t5/stm32-mcus-products/stm32f4-osc-problem/m-p/664136/highlight/true#M241592

 


@mega3psp wrote:

on the STM32F030 DISCOVERY board, ... I added the crystal I wanted to use 


Did you also remove  SB16 et al - to disconnect the drive from the ST-Link?

AndrewNeil_2-1743097397647.png

 

1 reply

Andrew Neil
Andrew NeilBest answer
Super User
March 27, 2025

@mega3psp wrote:

In the documentation for the STM32F030R8T6 chip, specifically the "RM0360 Reference Manual", there’s a diagram showing how to connect an external crystal oscillator ("Figure 12. HSE/LSE clock sources"). In this diagram, the crystal is connected directly to the OSC_IN and OSC_OUT pins,?


No - in the case of an external oscillator (ie, an external clock), it is connected to OSC_IN only - the OSC_OUT pin is free for use as GPIO:

AndrewNeil_0-1743096811780.png

 

Both pins are only used in the case of an external crystal:

AndrewNeil_1-1743096872327.png

Difference between an oscillator an a crystal:

https://community.st.com/t5/stm32-mcus-products/stm32f4-osc-problem/m-p/664136/highlight/true#M241592

 


@mega3psp wrote:

on the STM32F030 DISCOVERY board, ... I added the crystal I wanted to use 


Did you also remove  SB16 et al - to disconnect the drive from the ST-Link?

AndrewNeil_2-1743097397647.png

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
mega3pspAuthor
Associate
March 28, 2025

The issue was indeed caused by the SB18 solder bridge being in place. After I removed it, everything started working as expected. That is, OSC_IN is the input and OSC_OUT is the output. So, to limit the drive level, the R22 resistor on the STM32F030 DISCOVERY board should be used.
Huge thanks for your help!