Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source for clk_sys is not switched to pll_sys after PLLs are set up #5

Open
kahara opened this issue May 16, 2021 · 1 comment
Open

Comments

@kahara
Copy link

kahara commented May 16, 2021

To verify, looked at CLK_SYS_CTRL with debugger and it shows 0x00000000, so the clock source is pointing to clk_ref as expected. And CLK_SYS_SELECTED shows 0x00000001 which, if I've interpreted the datasheet correctly, also means that clk_ref is selected.

Is there a reason for setting up pll_sys and then not wiring clk_sys to it?

I tried something like this but it doesn't speed up the blinking:

clocks.clk_sys_ctrl.modify(|_, w| w.auxsrc().clksrc_pll_sys() );
clocks.clk_sys_ctrl.modify(|_, w| w.src().clksrc_clk_sys_aux() );
while clocks.clk_sys_selected.read().bits() != 2 {}
@kahara
Copy link
Author

kahara commented May 22, 2021

The problem seems to be that PLL::configure() erroneously sets REFDIV to the crystal's megahertz value:

p.cs.write(|w| unsafe { w.bits(ref_mhz as _) });

REFDIV is 1 on boot, so setting it isn't necessary. Removing the call above combined with the stuff mentioned in the earlier comment makes Pico run at full speed. I'll make a PR about this.

kahara added a commit to kahara/sample-project that referenced this issue May 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant