Skip to content

Conversation

@kfessel
Copy link
Contributor

@kfessel kfessel commented Jan 23, 2026

Contribution description

adds support for using external oscillator with xosc into pll into main_clk

the intermediate frequency is 1 -> should fit for all N MHz clk sources to N MHz cpu frequency

Testing procedure

set

#define XOSC0_FREQUENCY MHZ(24)
#define XOSC0_EXT_OSC (1)
#define USE_XOSC (1)

Frequency and XOSC<0|1> should be adjusted -> this configuration was a USB clk connect to XOSC0

do not set

EXTERNAL_OSC32_SOURCE

Issues/PRs references

@github-actions github-actions bot added Platform: ARM Platform: This PR/issue effects ARM-based platforms Area: cpu Area: CPU/MCU ports labels Jan 23, 2026
@kfessel kfessel requested review from maribu and removed request for benpicco and dylad January 23, 2026 15:08
@kfessel kfessel force-pushed the p-samd5x-xosc-pll branch 2 times, most recently from 771114f to 08df288 Compare January 23, 2026 16:28
@crasbe crasbe added Type: new feature The issue requests / The PR implemements a new feature for RIOT CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jan 24, 2026
@riot-ci
Copy link

riot-ci commented Jan 24, 2026

Murdock results

✔️ PASSED

e8b15b8 cpu/samd5x: support for using ext_osc + xosc + fdpll

Success Failures Total Runtime
11003 0 11004 12m:55s

Artifacts

crasbe
crasbe previously requested changes Jan 24, 2026
Copy link
Contributor

@crasbe crasbe left a comment

Choose a reason for hiding this comment

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

It would be good to have some documentation for the newly added defines IMO. Which are permissible values at least.

@kfessel kfessel force-pushed the p-samd5x-xosc-pll branch 2 times, most recently from 8ead4ca to e30b2de Compare January 26, 2026 12:15
cpu/samd5x/cpu.c Outdated
while (!(OSC32KCTRL->STATUS.reg & OSC32KCTRL_STATUS_XOSC32KRDY)) {}
}

/* XOSC0 is run by an external oscillator 0 (default (cristal)) or 1 (external oscillator) */
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/* XOSC0 is run by an external oscillator 0 (default (cristal)) or 1 (external oscillator) */
/* XOSC0 is run by an external oscillator 0 (default (crystal)) or 1 (external oscillator) */

cpu/samd5x/cpu.c Outdated
# define XOSC0_EXT_OSC (0)
#endif

/* XOSC1 is run by an external oscillator 0 (default (cristal)) or 1 (external oscillator) */
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/* XOSC1 is run by an external oscillator 0 (default (cristal)) or 1 (external oscillator) */
/* XOSC1 is run by an external oscillator 0 (default (crystal)) or 1 (external oscillator) */

@kfessel
Copy link
Contributor Author

kfessel commented Jan 27, 2026

@crasbe: is this good enough of documentation?

i think i did as well as the previously exiting options and if one has a not copyable board configuration they need to look in this file anyway as the clock configuration is kinda difficult and board cpu combination specific.

@crasbe crasbe dismissed their stale review January 27, 2026 11:29

Documentation provided.

@crasbe
Copy link
Contributor

crasbe commented Jan 27, 2026

@crasbe: is this good enough of documentation?

i think i did as well as the previously exiting options and if one has a not copyable board configuration they need to look in this file anyway as the clock configuration is kinda difficult and board cpu combination specific.

Looks good. My point was just to avoid having more "black box defines". And as you said, clock configuration is difficult, but it's more difficult if it's undocumented 😅

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

Labels

Area: cpu Area: CPU/MCU ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: new feature The issue requests / The PR implemements a new feature for RIOT

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants