Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8051

General • Re: RP2350 external clock source

$
0
0
When driving an external clock into XIN, you must configure the XOSC to pass through the XIN signal.
Still the question remains unanswered: how the heck are we supposed to do it?
That is a good question:
  • On the one hand, if it were necessary to use a distinct mode for the XOSC then it would not be possible in USB-booting devices, as the bootrom has already enabled the XOSC in crystal mode before user code gets a chance.
  • On the other hand, there is no mode bit in the XOSC registers, and experiment shows that it works just fine without any special configuration.
  • One possible reading of the sentence you quoted is that you must configure (enable) the XOSC as the at-reset default is totally disabled and prevents it from passing through the external clock - so the "you must configure" is the same configuration as for xtal mode, it's just that "not configured at all" won't work.
  • Another possible reading of it is that pass-through mode is given by the enable bit being off in the XOSC CTRL register, but the XOSC module must be out of reset. That would mean that the XOSC CTRL.ENABLE bit just controls the analogue part of the XOSC and XOUT, with the XIN pin always acting as an input.
I don't know which of those last two is correct - I suspect that CTRL.ENABLE must be on, but I've never tried turning it off. It certainly does work if you ignore the difference between xtal and external clock and just leave it configured as by the bootrom/SDK default.


Another curiosity in this area is the SDK function xosc_disable() which is documented:
void xosc_disable (void)
Disable the Crystal oscillator.
Turns off the crystal oscillator source, and waits for it to become unstable
Why on earth would you want to wait for it to become unstable? Normally you are turning off XOSC to save power and so it's wasteful to busy-wait for it to stop, and no harm done if the xtal just sits there wobbling a bit as you go into sleep mode or whatever. And if the ENABLE bit is needed for the input to detect anything, then you aren't going to be able to detect what the crystal is doing after you have turned off ENABLE so it's all a waste of time, or alternatively if the input side is always active and the ENABLE just powers the oscillator/XOUT, then you can't call this function with an external oscillator as it will hang forever - despite this being apparently the function you would want for external mode.

Statistics: Posted by arg001 — Mon Apr 07, 2025 3:01 pm



Viewing all articles
Browse latest Browse all 8051

Trending Articles