zephyr/samples/boards/st/mco
Martin Durietz 022903f01b samples: boards: Add MCO support for nucleo_wl55jc
Added overlay and modified sample.yaml to support the nucleo_wl55jc
board in the MCO example.

Signed-off-by: Martin Durietz <martin.durietz@gmail.com>
2025-03-24 19:23:09 +01:00
..
boards samples: boards: Add MCO support for nucleo_wl55jc 2025-03-24 19:23:09 +01:00
src samples: boards: stm32 mco output control 2024-12-05 19:59:47 -05:00
CMakeLists.txt
prj.conf
README.rst samples: boards: stm32 mco output control 2024-12-05 19:59:47 -05:00
sample.yaml samples: boards: Add MCO support for nucleo_wl55jc 2025-03-24 19:23:09 +01:00

.. zephyr:code-sample:: stm32_mco
   :name: Master Clock Output (MCO)
   :relevant-api: pinctrl_interface

   Output an internal clock for external use by the application.

Overview
********

This sample is a minimum application to demonstrate how to output one of the internal clocks for
external use by the application.

Requirements
************

The SoC should support MCO functionality and use a pin that has the MCO alternate function.
To support another board, add a dts overlay file in boards folder.
Make sure that the output clock is enabled in dts overlay file.
Depending on the stm32 serie, several clock source and prescaler are possible for each MCOx.
The clock source is set by the DTS among the possible values for each stm32 serie.
The prescaler is set by the DTS, through the property ``prescaler = <MCOx_PRE(MCO_PRE_DIV_n)>;``

See :zephyr_file:`dts/bindings/clock/st,stm32-clock-mco.yaml`

It is required to check the Reference Manual to  configure the DTS correctly.


Building and Running
********************

.. zephyr-app-commands::
   :zephyr-app: samples/boards/st/mco
   :board: nucleo_u5a5zj_q
   :goals: build flash

After flashing, the LSE clock will be output on the MCO pin enabled in Device Tree.
The clock can be observed using a probing device, such as a logic analyzer.