fix(ulp): Ulp core does not start with UlpCoreWakeupSource::HpCpu.#5410
fix(ulp): Ulp core does not start with UlpCoreWakeupSource::HpCpu.#5410bugadani merged 5 commits intoesp-rs:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes a regression in the ESP32-S2/S3 ULP core bring-up path where UlpCoreWakeupSource::HpCpu would not start the ULP core because the ULP sleep timer wasn’t enabled (regression introduced by the timer-support work in #5134).
Changes:
- Refactors ULP wakeup-source configuration to share timer setup via a local helper.
- Ensures
UlpCoreWakeupSource::HpCpualso enables the ULP sleep timer (configured for immediate wake) so the ULP core actually starts. - Applies the same fix to both ESP32-S2 and ESP32-S3 implementations.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| esp-hal/src/soc/esp32s3/ulp_core.rs | Enables/configures the ULP sleep timer even for HpCpu wakeup to avoid ULP start hang on ESP32-S3. |
| esp-hal/src/soc/esp32s2/ulp_core.rs | Mirrors the same wakeup-source/timer enabling fix for ESP32-S2. |
789a806 to
e4c0018
Compare
161fc2c to
7f2c28c
Compare
|
I don't know why the changelog check fails. I verified that the added line starts as same as the other lines. |
|
New commits in main has made this PR unmergable. Please resolve the conflicts. |
|
There was a problem with the changelog format - it's fixed on main and a rebase should fix it I guess otherwise this is fine |
|
@leighleighleigh could you please take a look at this PR? |
|
Thank you for the review.
Do you have any further suggestions? |
|
New commits in main have made this PR unmergeable. Please resolve the conflicts. |
|
@bugadani I have reproduced this, and confirmed the changes fix the regression. |
Pull Request Details 📖
Description
This PR fixes a regression where the ULP core fails to start when using
UlpCoreWakeupSource::HpCpu. This issue was introduced in #5134.Specifically, the
lp_blinkyexample currently hangs because the ULP core never starts. The root cause is that the sleep timer is not enabled withinulp_config_wakeup_sourcewhen this wakeup source is selected.This PR resolves the issue by ensuring the timer is enabled even when
UlpCoreWakeupSource::HpCpuis specified. The timer is configured to wake the ULP core immediately.Detailed explanation
According to Section 2.4 of the ESP32-S3 Technical Reference Manual (v1.8), the sleep timer must be enabled to wake the ULP core, even when triggered by RTC GPIO or software:
In ESP-IDF, there is no direct equivalent to our
UlpCoreWakeupSource::HpCpu.Instead, it defaults to
ULP_RISCV_WAKEUP_SOURCE_TIMER:ulp_riscv.h#L32 (esp-idf)
Discussion
I have set the sleep cycles (
RTC_CNTL_ULP_CP_TIMER_SLP_CYCLE) to 0 to ensure the ULP core wakes up immediately once the timer is enabled.However, the hardware default value is 200.
Should I use the hardware default?
Testing
Tested with the
lp_blinkyexample on an ESP32-S3-DevKitC-1:Submission Checklist 📝
cargo xtask fmt-packagescommand to ensure that all changed code is formatted correctly.CHANGELOG.mdin the proper section.Extra: