-
Notifications
You must be signed in to change notification settings - Fork 356
Redo ESP32-C2 clocktree, remove ESP_HAL_CONFIG_XTAL_FREQUENCY
#4517
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
base: main
Are you sure you want to change the base?
Conversation
3aec60a to
542e3cf
Compare
ESP_HAL_CONFIG_XTAL_FREQUENCY
1314a69 to
f6eb79b
Compare
3b794cb to
f42ff8d
Compare
|
/hil full |
|
Triggered full HIL run for #4517. Run: https://github.com/esp-rs/esp-hal/actions/runs/19533125842 Status update: ❌ HIL (full) run failed (conclusion: failure). |
f42ff8d to
447bd22
Compare
|
/hil full |
|
Triggered full HIL run for #4517. Run: https://github.com/esp-rs/esp-hal/actions/runs/19533561326 Status update: ✅ HIL (full) run succeeded. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the ESP32-C2 clock tree implementation and removes the ESP_HAL_CONFIG_XTAL_FREQUENCY configuration option. The changes introduce a comprehensive clock tree structure for ESP32-C2 with proper clock node definitions, multiplexers, and dividers. The clock frequency is now automatically detected at runtime rather than configured at compile time.
- Introduces a complete clock tree definition for ESP32-C2 including all clock sources, multiplexers, and dividers
- Removes the
ESP_HAL_CONFIG_XTAL_FREQUENCYbuild-time configuration in favor of runtime detection - Cleans up ESP32 peripheral clock handling by removing redundant
TIMG0/1_PERIPHERAL_CLOCKnodes
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| esp-metadata/devices/esp32c2.toml | Adds comprehensive clock tree definition with system clocks, peripheral clocks, and timer-specific clock configurations |
| esp-metadata/devices/esp32.toml | Removes TIMG peripheral clock definitions and adds TODO comment about APB clock tracking |
| esp-metadata-generated/src/_generated_esp32c2.rs | Generates clock tree types, configuration structs, and management functions for ESP32-C2 |
| esp-metadata-generated/src/_generated_esp32.rs | Removes generated code for TIMG peripheral clocks |
| esp-metadata-generated/src/_build_script_utils.rs | Updates build script configuration flags for new clock nodes |
| esp-hal/src/timer/timg.rs | Adds clock configuration for TIMG0 function clock |
| esp-hal/src/soc/esp32c2/mod.rs | Adds public clocks module |
| esp-hal/src/soc/esp32c2/clocks.rs | New implementation file with clock detection, PLL configuration, and clock tree management |
| esp-hal/src/soc/esp32/clocks.rs | Removes peripheral clock handling and updates crystal frequency detection logic |
| esp-hal/src/rtc_cntl/rtc/esp32c2.rs | Comments out RTC clock configuration (marked for future work) |
| esp-hal/src/clock/mod.rs | Removes ESP_HAL_CONFIG_XTAL_FREQUENCY handling and simplifies XTAL frequency measurement |
| esp-hal/src/clock/clocks_ll/esp32c2.rs | Removes old clock configuration functions (moved to new implementation) |
| esp-hal/esp_config.yml | Removes xtal-frequency configuration option |
| esp-hal/CHANGELOG.md | Documents removal of ESP_HAL_CONFIG_XTAL_FREQUENCY option |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
447bd22 to
0e3f226
Compare
|
Current status: |
0e3f226 to
dcabda9
Compare
|
Ok, so the issue wasn't that a clock wasn't running. Instead the problem was caused by trying to store the XTAL frequency in Hz instead of in MHz in RTC_CNTL_STORE4, which ended up setting the |
ccc44de to
629f6ec
Compare
629f6ec to
c7a8e0c
Compare
c7a8e0c to
9c5c98b
Compare
cc #4502