Skip to content

stm32g0: mco: enable usage of MCO for STM32G0 #90923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

schuam
Copy link

@schuam schuam commented Jun 1, 2025

To be able to use the microcontroller clock output of the STM32G0 microcontrollers some macros and device tree entries were missing. This pull requests add them. Additionally a sample overlay for the NUCLEO-G0B1RE board was added to the mco sample.

@@ -35,6 +35,9 @@
#define STM32_SRC_PLL_Q (STM32_SRC_PLL_P + 1)
#define STM32_SRC_PLL_R (STM32_SRC_PLL_Q + 1)

/** @brief RCC_CFGR register offset */
#define CFGR_REG 0x08
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpicking: could you indent the macro value with 2 tabs, as done for the other macro definitions above and below?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@etienne-lms Thank you for your review.

Before I opened the pull request, I had the macro (and some others for that matter) formatted as you suggested (two tabs). When I ran ./scripts/ci/check_compliance.py -c upstream/main.. as suggested by Running CI Tests Locally, I got errors. For example:

You may want to run clang-format on this change:
-#define CFGR_REG		0x08
+#define CFGR_REG 0x08

So my question would be: Ignore the errors given by check_compliance.py and use tabs? Or comply to the checker?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question! I don't think I have enough background in Zephyr to ask you to go against some of its compliance sanity tools. I'll cross-check. In the mean time, I guess you can feel free to dismiss my old developer habits driven comments.

Copy link
Author

@schuam schuam Jun 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I appreciate your sense for consistency, I just didn't know what to do here.
I did remove the second empty line you mentioned in your other comment.

@fabiobaltieri
Copy link
Member

Hey, this needs a rebase and force push to pick up the CI error workaround.

schuam added 3 commits June 4, 2025 21:56
Adds macros to be able to use the microcontroller clock output (MCO) on the
STM32G0 microcontroller.

Signed-off-by: Andreas Schuster <[email protected]>
The newly added mcos node contains two childreen `mco1` and `mco2` that can
be used to output different clocks on the MCO pins of the stm32g0
microcontrollers.

Signed-off-by: Andreas Schuster <[email protected]>
Add overlay file to enable the MCO1&2 output clock on the nucleo_g0b1re.

Signed-off-by: Andreas Schuster <[email protected]>
Copy link

sonarqubecloud bot commented Jun 4, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants