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

We need a way to configure clock rates #44

Closed
bjoernQ opened this issue Apr 5, 2022 · 6 comments · Fixed by #111
Closed

We need a way to configure clock rates #44

bjoernQ opened this issue Apr 5, 2022 · 6 comments · Fixed by #111
Assignees
Milestone

Comments

@bjoernQ
Copy link
Contributor

bjoernQ commented Apr 5, 2022

In the first iteration it would be sufficient to just configure all clocks and freeze them

@bjoernQ
Copy link
Contributor Author

bjoernQ commented Apr 27, 2022

The simplest to start with would be a "boot-default" configuration without actually changing any clock settings. This way drivers can get the clock rates and as soon as we actually make it possible to change clock rates things should "just work"

@jessebraham jessebraham added this to the v0.1.0 milestone Apr 28, 2022
@bjoernQ
Copy link
Contributor Author

bjoernQ commented May 10, 2022

I wonder which clocks need to be contained in the clock config struct?

I can think of these:

  • CPU CLK
  • APB_CLK
  • Option: XTAL_CLK
  • Option: FOSC_CLK
  • Option: RTC8M
  • Option: APLL_CLOCK
  • Option: REF_TICK
  • Option: PLL_160M
  • Option: PLL_240M
  • Option: PLL_CLK
  • Option: PLL_D2_CLK

Probably there are more.

The "Option" prefixed ones are not available for all targets. Should they be wrapped by an Option in the struct or just not be contained if not available for the target?

@MabezDev
Copy link
Member

Option: XTAL_CLK

Is this really an option? I thought all esp's had some form of crystal clock? It's also the default clock source for a lot of peripherals (at least on the c3, when I skimmed the TRM).

I haven't looked through all the chip trms but this looks like a solid base (maybe we can do some smart grepping of the SVDs to find all clock sources?). It should be easy to determine what clocks are available to the driver and pick the best one. It might get interesting for peripherals like LEDC, where the input clock puts a limitation of certain output frequencies... but we'll worry about that later 😆.

@bjoernQ
Copy link
Contributor Author

bjoernQ commented May 10, 2022

Option: XTAL_CLK

Is this really an option? I thought all esp's had some form of crystal clock? It's also the default clock source for a lot of peripherals (at least on the c3, when I skimmed the TRM).

Ah true - I just looked at the "Peripheral Clock Usage" table and e.g. S2 doesn't list it as a direct clock source for peripherals but it's an indirect clock source ... 🕵️‍♂️ good point - we should include it

@bjoernQ
Copy link
Contributor Author

bjoernQ commented Jun 9, 2022

First part (basically introducing ClockConfig with boot-defaults) has been done in #77

Next task is adding support for actually changing the clock rates

@bjoernQ bjoernQ removed their assignment Jun 10, 2022
@bjoernQ bjoernQ self-assigned this Jul 20, 2022
@bjoernQ
Copy link
Contributor Author

bjoernQ commented Jul 21, 2022

CPU clock settings for ESP32 and ESP32-C3 are implemented in #110

Will continue with ESP32-S2 and ESP32-S3 then ... after that I would consider this to be done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants