Code Monkey home page Code Monkey logo

Comments (7)

peterharperuk avatar peterharperuk commented on August 16, 2024

I think you should ask your question on the forum. There's clock_configure_gpin which allows you to run a clock from an input on a gpio pin.

from pico-sdk.

kilograham avatar kilograham commented on August 16, 2024

Can you point out particular areas of concern

  1. are there methods doing calculations based on XOSC_KHZ that need to change
  2. Is there initial hw setup that needs to change in response to an XOSC change

from pico-sdk.

warcow105 avatar warcow105 commented on August 16, 2024

Can you point out particular areas of concern

  1. are there methods doing calculations based on XOSC_KHZ that need to change
  2. Is there initial hw setup that needs to change in response to an XOSC change

If I am wrong please tell me, but I am pretty sure all delays/sleeps are based on the frequency the core is running at, and it bases the "frequency" on the osc/clock input frequency through the synth and clock tree. If the system boots up and runs for a portion of its time on a 12mhz clock then the circuit feeding the clock to the rp2040 kicks up to say 24.576mhz and asserts a gpio to let my code on the rp2040 know we just switched frequencies. As far as the pico sdk code is concerned we are still running at the same frequency and all the delays and sleeps are now out of whack. It would be convenient in rare use cases like this to be able to call a function where I can let the sdk know the new osc frequency.

This is probably a very rare use case, but I can see where the rp2040 is an aux processor to a larger processor that is in charge of the board clocks for power saving or whatever. Right now all my delays use a scaling factor that is updated when the external circuit changes the clock frequency.

from pico-sdk.

lurch avatar lurch commented on August 16, 2024

Are you looking for https://www.raspberrypi.com/documentation/pico-sdk/high_level.html#gab3a273e837ba1947bb5fd8fc97cf47e5 ?

from pico-sdk.

warcow105 avatar warcow105 commented on August 16, 2024

Are you looking for https://www.raspberrypi.com/documentation/pico-sdk/high_level.html#gab3a273e837ba1947bb5fd8fc97cf47e5 ?

Nope, that is for actually setting the hardware. In the case that I am describing the external OSC input to the rp2040 has already changed so all of the frequencies are different.

I just want to tell the sdk functions that the system is actually running at a different speed than it thinks it is.

from pico-sdk.

lurch avatar lurch commented on August 16, 2024

Ahhh, in that case I guess you'll need to look at the places in the SDK where XOSC_KHZ is actually used then, which is basically what Graham already said.
https://github.com/search?q=repo%3Araspberrypi%2Fpico-sdk%20XOSC_KHZ&type=code

from pico-sdk.

warcow105 avatar warcow105 commented on August 16, 2024

I think for my use case I need to make modified versions of some of the SDK functions that take a XOSC value, then use them and also reconfigure the clock tree whenever I change frequencies. You can close this unless someone wants to add an all-in-one function to the sdk, otherwise I will do a PR if I ever get around to making the changes on my end.

Michael

from pico-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.