cancel
Showing results for 
Search instead for 
Did you mean: 

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

Chubs
Senior

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. 

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

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

View solution in original post

6 REPLIES 6
TDK
Guru

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".
Chubs
Senior

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?

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

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.

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

The RM says that it is (at least for G4, didn't check G0) and the RM is generally accurate. I don't have a G4 or G0.

Would bet that it works on the H7 per the RM. As soon as STM32CubeIDE stops freezing I can confirm.

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

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