Skip to main content
Associate III
July 28, 2023
Solved

In Clock Source BYPASS mode, can we use the OSC_OUT as GPIO?

  • July 28, 2023
  • 6 replies
  • 2816 views

Hello Community,

We are using MEMS OScillator for the clock source for STM32G474 MCU. And are unsure if we can use the OSC_OUT pin as a GPIO pin when using the MCU in Clock Source BYPASS mode.

The datasheet mentions we can, I, however, would like to confirm once if this pin needs to be left unconnected, grounded or can be used as GPIO without any issues.

The function set for the GPIO on this pin shall be for RESET and similar infrequent signals.

Looking forward for valuable insights. 

This topic has been closed for replies.
Best answer by TDK

It works on the H7 just as the RM says it will. Clock is in bypass mode. PH0 and PH1 are both initialized as GPIO output and toggled, only PH1 responds to the toggle. Verified with a scope but also reflected in IDR. Bypass mode configuration takes precedence over gpio config, so GPIO functions on PH0 have no effect.

TDK_2-1690563014372.png

TDK_0-1690562883242.png

TDK_1-1690562948526.png

 

6 replies

TDK
July 28, 2023

You can use OSC_OUT as a GPIO when clock is used in BYPASS mode. This varies by family, but it works here.

TDK_0-1690553500219.png

 

"If you feel a post has answered your question, please click ""Accept as Solution""."
ChubsAuthor
Associate III
July 28, 2023

Hello TDK,

Yes, I have read this in the Hardware design guidelines, but unsure if this really works as it is being discussed in the below thread-> 
https://community.st.com/t5/stm32-mcu-products/can-i-use-ph1-as-gpio-if-i-config-ph0-as-hse-bypass-clock-source/m-p/236607/highlight/true#M53245

Why do they conclude it does not work? Any updates since this post?

TDK
July 28, 2023

That post is for a different family of chips and may not be relevant here, but I can test it on the H7. Doesn't seem like anyone did in that post. But I can double check at least for my own knowledge.

There was a poster who said it didn't work on the L0 series, but the reference manual doesn't imply that it will work.

"If you feel a post has answered your question, please click ""Accept as Solution""."
ChubsAuthor
Associate III
July 28, 2023

That would be helpful for many community members & designers @TDK,

You can post your observations here as well on that post for reference for everyone who end up reading these posts.

Can you suggest if this is a valid use case in STM32G474 & STM32G0B0?

We are short of pins & would like to use the OSC_OUT as GPIO to toggle Reset on another circuit.

TDK
TDKBest answer
July 28, 2023

It works on the H7 just as the RM says it will. Clock is in bypass mode. PH0 and PH1 are both initialized as GPIO output and toggled, only PH1 responds to the toggle. Verified with a scope but also reflected in IDR. Bypass mode configuration takes precedence over gpio config, so GPIO functions on PH0 have no effect.

TDK_2-1690563014372.png

TDK_0-1690562883242.png

TDK_1-1690562948526.png

 

"If you feel a post has answered your question, please click ""Accept as Solution""."