|
| 1 | +.. zephyr:code-sample:: nrf_clock_control |
| 2 | + :name: nRF clock control |
| 3 | + |
| 4 | + Request minimum clock requirements at runtime. |
| 5 | + |
| 6 | +Demonstrates how to request minimum clock requirements of nordic clocks, including getting the |
| 7 | +startup time to ensure clock requirements are met in time. |
| 8 | + |
| 9 | +Requirements |
| 10 | +************ |
| 11 | + |
| 12 | +Requires a nRF54H20 based board. |
| 13 | + |
| 14 | +Building, Flashing and Running |
| 15 | +****************************** |
| 16 | + |
| 17 | +The sample is built to test a specific clock requirement for a specific clock. The clock is |
| 18 | +specified in a devicetree overlay, and the clock requirement is defined using these sample |
| 19 | +specific Kconfigs: |
| 20 | + |
| 21 | +* :kconfig:option:`CONFIG_SAMPLE_CLOCK_FREQUENCY_HZ` |
| 22 | +* :kconfig:option:`CONFIG_SAMPLE_CLOCK_ACCURACY_PPM` |
| 23 | +* :kconfig:option:`CONFIG_SAMPLE_CLOCK_PRECISION` |
| 24 | + |
| 25 | +With the following controlling how long the request is held: |
| 26 | + |
| 27 | +* :kconfig:option:`CONFIG_SAMPLE_PRE_REQUEST_TIMEOUT` |
| 28 | +* :kconfig:option:`CONFIG_SAMPLE_KEEP_REQUEST_TIMEOUT` |
| 29 | + |
| 30 | +Example configs and overlays are added for every clock, which can be found in :file:`sample.yaml`, |
| 31 | +and applied using the ``-T`` west argument. The following example builds the sample to test the |
| 32 | +FLL16M: |
| 33 | + |
| 34 | +.. zephyr-app-commands:: |
| 35 | + :zephyr-app: samples/boards/nordic/clock_control |
| 36 | + :board: nrf54h20dk/nrf54h20/cpuapp |
| 37 | + :goals: build |
| 38 | + :west-args: -T sample.boards.nrf.clock_control.fll16m |
| 39 | + :compact: |
| 40 | + |
| 41 | +Example output: |
| 42 | + |
| 43 | +.. code-block:: none |
| 44 | +
|
| 45 | + clock name: fll16m |
| 46 | + minimum frequency request: 0Hz |
| 47 | + minimum accuracy request: 30PPM |
| 48 | + minimum precision request: 0 |
| 49 | +
|
| 50 | + resolved frequency request: 16000000Hz |
| 51 | + resolved accuracy request: 30PPM |
| 52 | + resolved precision request: 0 |
| 53 | +
|
| 54 | + startup time for requested spec: 850us |
| 55 | +
|
| 56 | + requesting minimum clock specs |
| 57 | + request applied to clock in 1ms |
| 58 | +
|
| 59 | + releasing requested clock specs |
| 60 | + clock spec request released |
0 commit comments