<h3>Contribution description</h3>
<p>Right now the main clock on samd5x always uses DPLL directly.<br>
According to the data sheet, DPLL must run at at least 96 MHz, so running the CPU at a lower frequency is currently not possible.</p>
<p>There are some constraints to the oscillators on the samd5x.</p>
<ul>
<li>DFLL is fixed to run at 48 MHz</li>
<li>DPLL can run at 96 to 200 MHz</li>
</ul>
<p>This makes the core clock always use DFLL for frequencies <= 48 MHz.<br>
For frequencies >= 96 MHz, it uses DPLL directly as before.<br>
For frequencies < 96 MHz, DPLL is clocked at twice the desired frequency, then a divider is used to reach the target frequency.</p>
<h3>Testing procedure</h3>
<p>Configure a different <code>CLOCK_CORECLOCK</code> in <code>boards/same54-xpro/include/periph_conf.h</code>.</p>
<p>Try, e.g. 8 MHz, 16 MHz or 64 MHz.</p>
<h3>Issues/PRs references</h3>
<p><a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="482822453" data-permission-text="Issue title is private" data-url="https://github.com/RIOT-OS/RIOT/issues/12037" data-hovercard-type="issue" data-hovercard-url="/RIOT-OS/RIOT/issues/12037/hovercard" href="https://github.com/RIOT-OS/RIOT/issues/12037">#12037</a> if you want to use i2c, it is currently necessary to use a lower clock speed.<br>
But a lower clock is also desirable for battery powered devices that don't need the full 120 MHz.</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/RIOT-OS/RIOT/pull/12222'>https://github.com/RIOT-OS/RIOT/pull/12222</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>cpu/samd5x: allow more flexible selection of CLOCK_CORECLOCK</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/12222/files#diff-0">cpu/samd5x/cpu.c</a>
    (30)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/12222/files#diff-1">cpu/samd5x/include/periph_cpu.h</a>
    (15)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/RIOT-OS/RIOT/pull/12222.patch'>https://github.com/RIOT-OS/RIOT/pull/12222.patch</a></li>
  <li><a href='https://github.com/RIOT-OS/RIOT/pull/12222.diff'>https://github.com/RIOT-OS/RIOT/pull/12222.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/RIOT-OS/RIOT/pull/12222?email_source=notifications&email_token=ABE7WYGHQS5WFARZ572KOKTQJOYCHA5CNFSM4IWRNKJKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HLITBEA">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABE7WYBXRKOJ2NDIRYWSWN3QJOYCHANCNFSM4IWRNKJA">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABE7WYATTXVSOORUCJZCHV3QJOYCHA5CNFSM4IWRNKJKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HLITBEA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/RIOT-OS/RIOT/pull/12222?email_source=notifications\u0026email_token=ABE7WYGHQS5WFARZ572KOKTQJOYCHA5CNFSM4IWRNKJKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HLITBEA",
"url": "https://github.com/RIOT-OS/RIOT/pull/12222?email_source=notifications\u0026email_token=ABE7WYGHQS5WFARZ572KOKTQJOYCHA5CNFSM4IWRNKJKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HLITBEA",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>