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

I would say, that CLOCKS_CLK_REF_CTRL_AUXSRC_VALUE_LPOSC_CLKSRC definition is missing #2047

Open
matsobdev opened this issue Nov 16, 2024 · 3 comments
Assignees
Milestone

Comments

@matsobdev
Copy link

...inside https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2350/hardware_regs/include/hardware/regs/clocks.h, according to https://www.raspberrypi.com/documentation/pico-sdk/hardware.html#group_hardware_clocks. It seems to me, but I'm not sure, tho.

@lurch
Copy link
Contributor

lurch commented Nov 16, 2024

A bit more fully-fleshed info, after a bit of digging...
I think the complaint is that this table in the documentation:
Screenshot from 2024-11-16 22-30-58
which is in the RP2350 section of https://www.raspberrypi.com/documentation/pico-sdk/hardware.html#detailed-description-4 says that clk_ref can use the Aux Sources "GPIO in 0" (CLOCKS_CLK_REF_CTRL_AUXSRC_VALUE_CLKSRC_GPIN0), "GPIO in 1" (CLOCKS_CLK_REF_CTRL_AUXSRC_VALUE_CLKSRC_GPIN1), "USB PLL" (CLOCKS_CLK_REF_CTRL_AUXSRC_VALUE_CLKSRC_PLL_USB) or "LPOSC" (CLOCKS_CLK_REF_CTRL_AUXSRC_VALUE_LPOSC_CLKSRC). However https://github.com/raspberrypi/pico-sdk/blob/develop/src/rp2350/hardware_regs/include/hardware/regs/clocks.h#L543 only lists the values for CLOCKS_CLK_REF_CTRL_AUXSRC of CLOCKS_CLK_REF_CTRL_AUXSRC_VALUE_CLKSRC_PLL_USB, CLOCKS_CLK_REF_CTRL_AUXSRC_VALUE_CLKSRC_GPIN0, CLOCKS_CLK_REF_CTRL_AUXSRC_VALUE_CLKSRC_GPIN1 and CLOCKS_CLK_REF_CTRL_AUXSRC_VALUE_CLKSRC_PLL_USB_PRIMARY_REF_OPCG and therefore appears to be "missing" CLOCKS_CLK_REF_CTRL_AUXSRC_VALUE_LPOSC_CLKSRC.

However, if we look at the CLOCKS: CLK_REF_CTRL register on page 532 of https://datasheets.raspberrypi.com/rp2350/rp2350-datasheet.pdf we can see that it also only lists the possible values of AUXSRC as being CLKSRC_PLL_USB, CLKSRC_GPIN0, CLKSRC_GPIN1 and CLKSRC_PLL_USB_PRIMARY_REF_OPCG. (Also, as AUXSRC is only a 2-bit field, it can't have more than 4 different values.)

The table in the HTML documentation linked above is ultimately derived from https://github.com/raspberrypi/pico-sdk/blob/develop/src/rp2_common/hardware_clocks/include/hardware/clocks.h#L105 so I guess either the register descriptions for the CLOCKS: CLK_REF_CTRL.AUXSRC fields are mis-labeled, or that Doxygen table in clocks.h is wrong? 🤔
ping @liamfraser

@lurch
Copy link
Contributor

lurch commented Nov 16, 2024

P.S. I didn't know what OPCG was, but after a bit of searching it seems to be "On-Product Clock Generator" and it seems to be related purely to the factory-testing of chips. https://www.youtube.com/watch?v=XUJVGjDfJJg (ATE = Automated Test Equipment)

@matsobdev
Copy link
Author

matsobdev commented Nov 17, 2024

Problem was, when I was trying to run chip from LPOSC by:

clock_configure(clk_ref, CLOCKS_CLK_REF_CTRL_SRC_VALUE_LPOSC_CLKSRC, 0, 32768, 32768);
clock_configure(clk_sys, CLOCKS_CLK_SYS_CTRL_SRC_VALUE_CLK_REF, 0, 32768, 32768);

and it just won't deliver. Turning LED right after that and it stays like that, but should blink in a loop. Adding some sleep, then turning LED - nothing happens. Then I turned to auxiliary but it's not there. Now using:

clock_configure(clk_ref, CLOCKS_CLK_REF_CTRL_SRC_VALUE_CLKSRC_CLK_REF_AUX,
CLOCKS_CLK_REF_CTRL_AUXSRC_VALUE_CLKSRC_PLL_USB_PRIMARY_REF_OPCG, 32768, 32768);

instead is not working.

@kilograham kilograham added this to the 2.1.0 milestone Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants