Commit Graph

246 Commits

Author SHA1 Message Date
Xiao Xufeng
faf6cc4f84 feat(spi_flash): implement dynamic CPU frequency switching workaround for encrypted writes
This commit implements a workaround that allows ESP32-C5 to run at 240MHz CPU frequency
normally, while automatically reducing CPU frequency during encrypted flash writes to
ensure correct operation. The frequency limit is chip revision dependent:
- v1.2 and above: limited to 160MHz during encrypted writes
- v1.0 and below: limited to 80MHz during encrypted writes

Key implementation details:
- Frequency limiting is triggered automatically when esp_flash_write_encrypted() is called
- Uses start() flags (ESP_FLASH_START_FLAG_LIMIT_CPU_FREQ) to integrate with OS layer
- Works with both PM enabled and disabled configurations
- Frequency is automatically restored after encrypted write completes
- For ESP32-C5 with 120MHz flash, Flash clock and timing registers are adjusted when
  CPU frequency is reduced to 80MHz
- SPI1 timing registers are configured during frequency switching since encrypted writes
  use SPI1 and must work correctly at reduced CPU frequencies

Code improvements:
- Use SOC_MSPI_FREQ_AXI_CONSTRAINED capability macro instead of hardcoded chip checks
- Control workaround via Kconfig (CONFIG_PM_WORKAROUND_FREQ_LIMIT_ENABLED) instead of
  hardcoded macros
- Add comprehensive test cases covering various PM configurations and edge cases

This workaround enables ESP32-C5 applications to benefit from 240MHz CPU performance
while maintaining reliable encrypted flash write functionality.
2025-12-17 03:33:29 +08:00
wuzhenghui
9d75959a11 feat(esp_hw_support): re-enable P4 sleep wakeup tests for rev3.0 2025-11-26 19:25:53 +08:00
armando
304ba1655b fix check test scripts build issue 2025-11-20 11:33:36 +08:00
armando
cdff2570c7 ci(p4): disable p4 rev3 invalid tests temporarily 2025-11-20 11:33:36 +08:00
wuzhenghui
2162471cd0 test(esp_pm): add test case for USJ printing performance during wake-up
Add a new test case to verify that USJ printing doesn't block CPU on chip
wake-up from light sleep. The test measures the average time per print
operation and ensures it's below 5000 microseconds.
2025-11-14 17:41:48 +08:00
wuzhenghui
f66d7a8a9e change(esp_hw_support): update TOP pd sleep dependency
Disable peripheral powerdown lightsleep if PSRAM if enabled on P4 v3
Force powerdown Flash if peripheral power down lightsleep is enabled
2025-10-20 17:18:57 +08:00
wuzhenghui
298087869a feat(esp_hw_support): update cpu_pd support for esp32p4 v3.0 2025-10-20 17:18:20 +08:00
Jiang Jiang Jian
3c39b32195 Chip/support esp32c61 v5.5 2025-07-22 12:21:36 +08:00
wuzhenghui
da534bf462 fix(esp_hw_support): config lact in critical 2025-06-16 17:24:46 +08:00
Li Shuai
087727a693 Revert "fix(esp_pm): esp32c5 eco2 disable top pd to avoid mem being changed during sleep"
This reverts commit d881dda91c.
2025-06-05 22:06:23 +08:00
Li Shuai
d881dda91c fix(esp_pm): esp32c5 eco2 disable top pd to avoid mem being changed during sleep 2025-05-30 16:33:37 +08:00
wuzhenghui
31149354a9 fix(esp_hw_support): update systimer step immediately when XTAL changes on esp32s2 2025-05-22 14:07:37 +08:00
wuzhenghui
833df30063 fix(esp_hw_support): update LACT clock prescale immediately when APB changes on esp32 2025-05-22 14:07:36 +08:00
Wu Zheng Hui
fe3da7167e Merge branch 'fix/fix_esp32p4_retention_cost' into 'master'
fix(esp_hw_support): optimize retention cost and update sleep time compensation

See merge request espressif/esp-idf!37920
2025-04-23 13:20:49 +08:00
wuzhenghui
a1471f4f78 feat(esp_hw_support): remeasure sleep_time_overhead_out if min_freq_mhz changed 2025-04-22 22:02:34 +08:00
Li Shuai
0cb211489f fix(ci): fix ci build error 2025-04-17 22:06:21 +08:00
Li Shuai
77a1e2931d change: fix build clang test apps job error 2025-04-17 22:01:10 +08:00
Li Shuai
b7e26d5546 change: power management iram memory usage optimization is only effective for esp32c2 2025-04-17 22:01:10 +08:00
Li Shuai
b47005a030 change: fix esp32h21 ci build error of sar_periph_ctrl_power_disable not found 2025-04-17 22:01:10 +08:00
Li Shuai
954270dda3 change(esp_hw_support): optimize sleep memory (iram or flash) usage control by PM_SLP_IRAM_OPT 2025-04-17 22:01:10 +08:00
Chen Jichang
6c4271d4bb feat(esp32h4): disable unsupported build 2025-03-28 14:41:29 +08:00
Chen Jichang
c34b4eb882 feat(esp32h4): enable ESP32H4 ci build 2025-03-28 14:41:28 +08:00
Chen Ji Chang
6474fd67ae Merge branch 'feat/h4_introduce_step8' into 'master'
feat(esp32h4): introduce hello world to ESP32H4 (stage8)

Closes IDF-9526 and IDF-12333

See merge request espressif/esp-idf!37545
2025-03-20 16:16:05 +08:00
Li Shuai
921cfa0a8e Merge branch 'feat/support_runtime_periphs_icg_ctrl_in_sleep' into 'master'
support runtime ICG control for peripherals to be used/kept during light sleep

Closes IDF-7595

See merge request espressif/esp-idf!37377
2025-03-20 13:03:48 +08:00
Chen Jichang
45ba78940f feat(esp32h4): finnal introduce hello world 2025-03-19 18:48:41 +08:00
Marius Vikhammer
55be8bdc0d feat(esp_timer): added kconfig option for placing IRAM code into flash 2025-03-18 15:23:43 +08:00
Li Shuai
157faa3344 feat(esp_hw_support): support runtime clock for peripherals to be ungated during sleep 2025-03-18 10:42:15 +08:00
Li Shuai
82ab6b8cf9 fix(power_management): fix ci warning due to unused variable config 2025-03-17 11:24:39 +08:00
Li Shuai
e351f17790 change(esp_hw_support): support power management dfs flow 2025-03-17 11:24:39 +08:00
Armando
d64ca3a5d1 fix(mspi): fixed cpu and mspi freq mismatch issue when in dfs/sleep on p4 2025-03-07 12:27:16 +08:00
igor.udot
daf2d31008 test: format all test scripts 2025-03-05 12:08:48 +08:00
wuzhenghui
6bd6be3ed8 fix(esp_hw_support): warning instead of error when enabling uart/gpio wakeup in pd_top sleep 2025-02-27 16:15:36 +08:00
Wu Zheng Hui
e57f02e920 Merge branch 'doc/add_wakeup_source_usage_precautions' into 'master'
change(doc): added more usage notes about PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP

Closes IDF-12166

See merge request espressif/esp-idf!36879
2025-02-20 21:00:15 +08:00
wuzhenghui
0f69fda3d5 change(doc): added more usage notes about PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP 2025-02-19 20:54:21 +08:00
Wu Zheng Hui
254b3210bc Merge branch 'fix/fix_sleep_clock_wait_calculation' into 'master'
fix(esp_hw_support): fix lp/hp hw clock wait time calculation

Closes PM-39

See merge request espressif/esp-idf!34583
2025-02-12 11:30:43 +08:00
gaoxu
5ef4f20778 feat(esp32h21): disable unsupported build test 2025-02-06 15:47:51 +08:00
Li Shuai
2fce894c82 change(esp_phy): fix some wifi power save issues and optimize phy sleep for esp32c5 eco1 and beta5 2025-01-17 17:16:37 +08:00
Armando
14b5db0e87 refactor(mspi): rename to mspi_ll.h 2025-01-07 16:16:06 +08:00
wuzhenghui
c80c8354db change(esp_hw_support): switch to sleep_flags earlier to identify sleep state 2025-01-06 10:18:43 +08:00
gaoxu
25731d0c1e feat(esp32h21): finnal introduce hello world support 2024-12-30 20:14:40 +08:00
wuzhenghui
a48dfae871 fix(esp_pm): enable RTC_PERIPH domain once in esp_pm_trace_init 2024-12-26 10:41:49 +08:00
wuzhenghui
7d0d95b7d8 fix(esp_hw_support): fix mspi clock freq changed after lightsleep 2024-12-13 15:47:49 +08:00
Alexey Lapshin
888b5f7e8d feat(newlib): add picolibc support 2024-12-02 21:35:56 +07:00
wuzhenghui
df52e1aa71 fix(esp_pm): fix deadlock in pm_mode switching 2024-11-13 12:12:23 +08:00
wuzhenghui
b4bd3d98bd fix(esp_pm): fix missed ccompare update when another core is already in do_switch 2024-11-13 12:11:47 +08:00
wuzhenghui
2899c1e39f fix(esp_hw_support): fix sar disable access flash in IRAM_OPT sleep 2024-11-12 12:01:52 +08:00
wuzhenghui
71ddc5a79f fix(esp_hw_support): fix mmu retention code cache safety 2024-10-22 22:10:13 +08:00
morris
aebf700919 refactor(freertos): rename SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY and move to freertos 2024-10-09 13:32:03 +08:00
Wu Zheng Hui
6abe40e590 Merge branch 'feature/optimize_esp32p4_active_power_eco1' into 'master'
feat(system): Optimize esp32p4 active state  power consumption

Closes PM-103 and IDF-7688

See merge request espressif/esp-idf!32950
2024-09-11 23:15:29 +08:00
wuzhenghui
13e42707a0 feat(esp_hw_support): add clk tree source gate management api 2024-09-11 10:53:01 +08:00