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

Calling configure_clock runs a todo!() if gpin0 or gpin1 is supplied as clock source #879

Open
PietPtr opened this issue Dec 18, 2024 · 1 comment

Comments

@PietPtr
Copy link

PietPtr commented Dec 18, 2024

Minimal example:

    let gpin0: Pin<Gpio20, FunctionClock, PullNone> = pins.gpio20.reconfigure();

    clocks
        .system_clock
        .configure_clock(&gpin0, 12.MHz()) // 12 MHz is I guess a placeholder, true frequency is unknown (and unnecessary to be known) for my application.
        .unwrap();

Triggers this todo: https://github.com/rp-rs/rp-hal/blob/main/rp2040-hal/src/clocks/clock_sources.rs#L79

I could of course set this clock up manually, but I'd like to use the rp-hal functions for switching clocks as they already implement switching the glitchy mux correctly. If some other way of nicely doing this is already available I'd love to hear about it!

@thejpster
Copy link
Member

You might be the first person to try this. I guess when the clock is coming from an external GPIO pin we have to rely on the user to tell us what the clock rate is, and to store that value somewhere for use later (e.g. when calculating UART baud rate dividers).

I would be happy to accept a PR to make this use-case work better.

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

2 participants