Commit Graph

255 Commits

Author SHA1 Message Date
Xiao Xufeng
ae7124abe3 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 01:21:45 +08:00
Song Ruo Jing
62899cbba6 refactor(gpio): split GPIO HAL into separate component
cleaned up some includes in GPIO peripheral files
2025-12-08 14:33:26 +08:00
wuzhenghui
3136994010 feat(esp_hw_support): re-enable P4 sleep wakeup tests for rev3.0 2025-11-26 17:24:21 +08:00
armando
714b022a43 ci(p4): disable p4 rev3 invalid tests temporarily 2025-11-21 02:48:05 +00:00
Jiang Jiang Jian
56a284e0aa Merge branch 'fix/check_usj_status_before_access_v6.0' into 'release/v6.0'
fix(esp_driver_usb_serial_jtag): check USJ accessibility before read/write (v6.0)

See merge request espressif/esp-idf!43392
2025-11-18 12:29:48 +08:00
wuzhenghui
baa138bf2a 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:10:40 +08:00
wuzhenghui
5c10e4b719 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-11-11 21:56:26 +08:00
wuzhenghui
065dd70056 change(esp_hw_support): move ESP_SLEEP_POWER_DOWN_CPU to Kconfig 2025-10-14 16:33:30 +08:00
wuzhenghui
af1c8a568d feat(esp_hw_support): update cpu_pd support for esp32p4 v3.0 2025-10-14 16:33:28 +08:00
Chen Chen
a4710cc206 refactor(driver): remove redundant driver dependencies
now the driver component only contains legacy code for i2c, twai and
touch sensor
2025-09-30 15:47:45 +08:00
C.S.M
b145ede835 refactor(mspi): Make mspi hal layer independent 2025-09-26 14:57:54 +08:00
Alexey Lapshin
9281e78381 change(esp_libc): rename newlib component to esp_libc 2025-09-09 22:00:44 +08:00
Li Shuai
b43f0ddc70 feat(sleep): Modify the build system 2025-08-27 09:50:21 +08:00
Marek Fiala
9d35d63651 feat(cmake): Update minimum cmake version to 3.22 (whole repository) 2025-08-19 14:44:32 +02:00
C.S.M
0121a14699 refactor(temperature_sensor): Move temperature calculation from hw_support to hal 2025-08-11 11:47:20 +08:00
Song Ruo Jing
9a2984b4c0 fix(gpio): fix ESP32 GPIO sleep mode handling
The previous workaround does not work, the backup/restore should apply to RTC IO registers.
Also moved the workaround to sleep_gpio.c to avoid gpio hal using kconfig.
2025-08-05 21:02:09 +08:00
wuzhenghui
f861b7dd65 fix(esp_hw_support): config lact in critical 2025-06-13 20:38:46 +08:00
Li Shuai
f8832b583c Revert "fix(esp_pm): esp32c5 eco2 disable top pd to avoid mem being changed during sleep"
This reverts commit 8c2ea986b4.
2025-06-04 14:15:16 +08:00
Li Shuai
8c2ea986b4 fix(esp_pm): esp32c5 eco2 disable top pd to avoid mem being changed during sleep 2025-05-29 20:14:13 +08:00
wuzhenghui
65b7e70564 feat(driver): support acquire/release clock source dependency for all drivers 2025-05-27 21:21:38 +08:00
wuzhenghui
022614b1d3 fix(esp_hw_support): update systimer step immediately when XTAL changes on esp32s2 2025-05-22 13:58:54 +08:00
wuzhenghui
2931aa23b6 fix(esp_hw_support): update LACT clock prescale immediately when APB changes on esp32 2025-05-22 13:58:50 +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