Skip to content

Udpate H2 and C6 clocks. Remove i2c_clock for all chips but ESP32 #592

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

Merged
merged 6 commits into from
Jun 19, 2023

Conversation

SergioGasquez
Copy link
Member

@SergioGasquez SergioGasquez commented Jun 15, 2023

  • Update clocks and add missing clocks for H2 and C6
  • Align i2c0 C6 fields with H2
  • Remove i2c_clocks for all chips but esp32

Gathered some information about I2C clocks in the different chips in this HackMD: https://hackmd.io/@SergioGasquez/r1dvX1AHh

Checked the I2C freq for some devices:

  • ESP32:
I2C_ESP32 - ESP32-C6: I2C_C6 - ESP32-H2: I2C_H2

Draft PR until PACs are updated (esp-rs/esp-pacs#130 and esp-rs/esp-pacs#129)

Comment on lines -163 to -169

let pcr = unsafe { &*crate::peripherals::PCR::PTR };

// switch spimem to PLL 64Mhz clock
unsafe {
pcr.mspi_conf.modify(|_, w| w.mspi_clk_sel().bits(0b10));
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines -178 to -179
pcr.ahb_freq_conf
.modify(|_, w| w.ahb_div_num().bits(_div - 1));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were duplicating the clk_ll_ahb_set_divider fn

Comment on lines 96 to 111
#[cfg(any(esp32c6, esp32h2))]
Pll48MHz,
#[cfg(esp32h2)]
Pll64MHz,
#[cfg(esp32c6)]
Pll80MHz,
#[cfg(esp32h2)]
Pll96MHz,
#[cfg(esp32c6)]
Pll160MHz,
#[cfg(esp32c6)]
Pll240MHz,
#[cfg(not(any(esp32c2, esp32c6, esp32h2)))]
Pll320MHz,
#[cfg(not(esp32h2))]
Pll480MHz,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pll_48m_clock: HertzU32::MHz(48),
crypto_clock: HertzU32::MHz(96),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See CRYPTO_CLK of the Resets and clocks chapter of the H2 TRM

@SergioGasquez SergioGasquez marked this pull request as ready for review June 15, 2023 12:41
Copy link
Contributor

@bjoernQ bjoernQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@jessebraham jessebraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for cleaning this all up!

@jessebraham jessebraham merged commit d8c3856 into esp-rs:main Jun 19, 2023
@SergioGasquez SergioGasquez deleted the fix/esp32h2-clocks branch June 19, 2023 10:32
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

Successfully merging this pull request may close these issues.

3 participants