Commit Graph

215 Commits

Author SHA1 Message Date
Song Ruo Jing
4985caa38f refactor(driver/rtcio): Re-wrap RTCIO APIs with more accurate soc_caps 2023-07-05 11:47:51 +08:00
Lou Tianhao
7fd74057a3 example: bringup light sleep example for esp32h2 2023-06-26 21:05:16 +08:00
Lou Tianhao
2657d8f307 Power Management: change the IO hold interface for esp32c6 2023-06-26 21:05:16 +08:00
Lou Tianhao
8457998505 Power Management: fix REGDMA power issue when TOP domain powered down during light sleep for esp32h2 2023-06-26 20:58:59 +08:00
Lou Tianhao
6ea441c815 Power Management: support CPU powered down in light sleep for esp32h2 2023-06-26 20:57:55 +08:00
Lou Tianhao
63d32ab620 Power Management: support DFS and PMU feature for esp32h2 2023-06-26 20:57:55 +08:00
wuzhenghui
679ae47271 sleep: enable sleep reject when entering deep sleep and return err if sleep request is rejected 2023-06-21 11:27:40 +08:00
Wu Zheng Hui
1be9eee3ca Merge branch 'bugfix/fix_esp32s3_psram_access_failed_in_dfs_master' into 'master'
esp_pm: fix esp32s3 psram access failed when dfs is enabled

Closes IDF-7400 and IDF-4120

See merge request espressif/esp-idf!24144
2023-06-19 17:58:03 +08:00
wuzhenghui
8334403f3c bugfix: fix esp32s3 psram access failed when dfs is enabled 2023-06-19 10:15:04 +08:00
Song Ruo Jing
921713fff4 uart: Support LP_UART port with UART driver on esp32c6 2023-06-16 07:31:40 +00:00
Wu Zheng Hui
2b6551f84d Merge branch 'bugfix/support_esp326_xtal_xpd' into 'master'
esp32c6: support xtal xpd

Closes IDF-7318

See merge request espressif/esp-idf!22932
2023-06-12 11:28:59 +08:00
Konstantin Kondrashov
f875978fb3 Merge branch 'bugfix/incorrect_time_after_ota' into 'master'
esp_hw_support: Fix invalid system time if s_esp_rtc_time_us & s_rtc_last_ticks were moved around

Closes IDFGH-7930

See merge request espressif/esp-idf!23030
2023-06-09 00:30:52 +08:00
KonstantinKondrashov
cb6e2133f0 esp_hw_support: Fix invalid system time if s_esp_rtc_time_us & s_rtc_last_ticks were moved around
The commit fixes the case:
If variables in RTC RAM have been moved around by the linker,
they will be filled with garbage data. Any reset other than OTA would work fine
because the variables would still be initialized from the initial bootup.

So now system time will be valid even after OTA.

Closes https://github.com/espressif/esp-idf/issues/9448
2023-06-08 21:59:21 +08:00
wuzhenghui
71563e0995 sleep: Fix domain power down status cannot get updated accordingly with the allowance of retention in runtime 2023-06-08 17:26:18 +08:00
wuzhenghui
713da85988 bugfix: fix sleep failed caused by uart clk lost 2023-06-02 20:52:25 +08:00
wuzhenghui
2981d38000 bugfix: fix some flash funcs called in sleep wakeup process 2023-05-31 17:56:46 +08:00
wuzhenghui
4236644071 feature: skip console uart flush and sleep when estimated uart flush time exceeds the sleep duration to avoid rtos tick jump failed 2023-05-29 16:35:03 +08:00
wuzhenghui
5c74093300 bugfix: treat too short sleep duration as sleep reject by software 2023-05-29 16:35:03 +08:00
wuzhenghui
d197c59eaa bugfix: move adc_oneshot_power_acquire/release to adc_oneshot_read
Closes https://github.com/espressif/esp-idf/issues/10595
Closes https://github.com/espressif/esp-idf/issues/11386
2023-05-18 10:29:50 +08:00
Zim Kalinowski
099ffe6243 Merge branch 'feature/c6_ulp_timer' into 'master'
ulp: lp timer support for lp core

Closes IDF-6956, IDF-6830, and IDF-6835

See merge request espressif/esp-idf!23453
2023-05-10 03:06:35 +08:00
Wu Zheng Hui
35bb946653 Merge branch 'bugfix/update_esp32c6eco1_sleep_fosc_cal_cycles' into 'master'
bugfix: update esp32c6eco1 / esp32h2eco2 fosc calibration cycles during sleep and support calibrate OSC clock every N times lightsleep

Closes IDF-7287

See merge request espressif/esp-idf!23489
2023-05-09 18:44:20 +08:00
Marius Vikhammer
3ced7b12e8 ulp: add support for using lp timer with lp core on C6 2023-05-06 14:13:14 +08:00
Armando
dbf3612d6d spi_flash: replace flash clock src change API with mspi timing API 2023-05-04 17:05:35 +08:00
wuzhenghui
dcab6368ce feature: support configuration of sleep clock calibration frequency 2023-05-04 12:09:26 +08:00
wuzhenghui
dd4d1bbe90 bugfix: fix esp32c6eco1 fosc calibration cycles during sleep 2023-05-04 11:46:21 +08:00
Marius Vikhammer
359b237cc5 ulp: added sleep support for lp core
Added support for running LP core while hp core sleeps, as well
as waking up the hp core.
2023-04-25 11:51:35 +08:00
laokaiyao
b7053b46ef esp32h4: remove esp32h4 target from peripherals 2023-04-20 15:19:45 +08:00
wuzhenghui
bd80be3b83 bugfix: fix deepsleep saradc leakage 2023-03-31 15:49:43 +08:00
wuzhenghui
c50e5d45a3 feature: add deep sleep prepare callback hook 2023-03-17 19:45:56 +08:00
wuzhenghui
acecfe4ba5 bugfix: Slow clock power domain management has been maintained in pd_flags 2023-03-17 19:42:01 +08:00
Jiang Jiang Jian
73c06b5039 Merge branch 'bugfix/sleep_current_issue_caused_by_sar_adc' into 'master'
sleep current issue caused by sar adc

Closes IDF-6111 and WIFI-4370

See merge request espressif/esp-idf!22769
2023-03-17 17:32:59 +08:00
Jiang Jiang Jian
3f3a2cf560 Merge branch 'bugfix/fix_systimer_stall_issue_in_lightsleep' into 'master'
rtc_sleep: workaround systimer stall issue during sleep on ESP32C3

See merge request espressif/esp-idf!22739
2023-03-17 14:16:36 +08:00
Li Shuai
a25ce78392 sleep: fix sleep current issue caused by sar adc 2023-03-17 13:06:39 +08:00
liuning
14ca81f03f rtc_sleep: workaround systimer stall issue during lightsleep on ESP32C3 2023-03-15 20:33:03 +08:00
wanlei
d0c70aa7ac mspi: turn down freq to fix crash when sleep 2023-03-15 11:26:34 +08:00
Jiang Jiang Jian
abc43d8e94 Merge branch 'bugfix/some_small_fix_for_sleep' into 'master'
esp_hw_support/sleep: update soc caps for chips that support power down modem

Closes WIFI-4424

See merge request espressif/esp-idf!20198
2023-03-13 10:47:26 +08:00
Wu Zheng Hui
c8364fb921 Merge branch 'feature/add_wakeup_cost_info_to_dslp_wakestub_example' into 'master'
feature: add wake up time cost info to deep_sleep_wake_stub example

See merge request espressif/esp-idf!22683
2023-03-11 15:11:53 +08:00
C.S.M
b0b99a9a1b Merge branch 'feature/flash_support_h2' into 'master'
spi_flash: Allow clock frequency up to 64M on ESP32H2

See merge request espressif/esp-idf!22476
2023-03-10 19:13:03 +08:00
wuzhenghui
8820efe2e1 feature: add wake up time cost info to deep_sleep_wake_stub example 2023-03-10 16:37:02 +08:00
jingli
cb0f517fe3 soc/soc_caps: update soc caps for chips that support power-down of modem hardware
Closes WIFI-4424
2023-03-10 14:15:27 +08:00
Cao Sen Miao
bc655a6890 spi_flash: Allow clock frequency up to 64M, and make it default on ESP32H2 2023-03-10 11:39:53 +08:00
Marius Vikhammer
284dabf17f ulp: added basic support for building and running a binary in the lp core 2023-03-09 10:12:23 +08:00
wuzhenghui
fd7e8abd73 workaround: bypass esp32c6 flash powedown sleep time adjustment 2023-03-04 00:17:40 +08:00
wuzhenghui
45c2900ec0 resolve WIFI-5150
bugfix: Don't hold CS pin when VDDSDIO is power down to reduce the base current
2023-03-04 00:17:40 +08:00
Li Shuai
1a10eabe41 Power Management: refactor the configuration of each module in sleep mode 2023-03-04 00:17:40 +08:00
Li Shuai
200f69e6eb auto beacon: support esp32c6 autobeacon (advanced DTIM sleep feature)
modem retention: Support esp32c6 wifi MAC and baseband sleep retention

sleep_modem: wifi MAC modem wakeup protect in modem state before PMU trigger sleep enable request

sleep modem: provide a interface to get whether the Modem power domain is allowed to power off during sleep

add i2c_ana master header file to project

auto beacon: release PMU's lock on root clock source (it is locked in the PLL)

wifi receiving beacon frame in PMU modem state strongly depends on the BBPLL
clock, PMU will forcibly lock the root clock source as PLL, when the root
clock source of the software system is selected as PLL, we need to release
the root clock source locking.

When it is judged that the PLL is locked by PMU after wakeing up from the PMU
modem state, switch the root clock source to the PLL in the sleep process (a
critical section).

auto beacon: fix the failure to receive broadcast/multicast frames in modem state

When the multicast field in the beacon frame received in the PMU modem state is
True, the PMU switches to the PMU active state (the PMU waits for the HP LDO to
stabilize and then restores the MAC context) and starts to receive
broadcast/multicast frames (Broadcast/Multicast frames will be sent after a
minimum delay of 48 us after the beacon frame), because the PMU waits for the HP
LDO to stabilize too long (~154 us), which will cause broadcast/multicast frame
reception to be missed.

auto beacon: select the PLL clock source as the REGDMA backup clock source when the PMU switches to ACTIVE from MODEM state

update Digital Peripheral (M2A switch) REGDMA restore time parameter

auto beacon: fix the issue that only channel 1 can connect to AP in modem state
2023-03-04 00:17:40 +08:00
Li Shuai
93c02fed3b light sleep: add modem power domain and power down the modem power domain during sleep 2023-03-04 00:17:40 +08:00
Li Shuai
3a5fe2ab63 light sleep: rename sleep mac bb to modem, it includes MAC and baseband of wifi, bt and ieee802.15.4 modules 2023-03-04 00:17:40 +08:00
wuzhenghui
186da9af93 codeclean: rename sleep_periph to sleep_sys_periph 2023-03-04 00:17:40 +08:00
wuzhenghui
7ee64bd8e8 refactor: always jump to wake stub wrapper after wakeup 2023-03-02 18:10:06 +08:00
wuzhenghui
9eae151f7c esp32c6: bringup deepsleep examples 2023-03-02 15:06:05 +08:00
wuzhenghui
d3ec7880fe bugfix: support GPIO current leakage workaround for esp32c6/esp32h2 2023-03-02 15:06:05 +08:00
wuzhenghui
709adaaa37 soc_caps: since esp32c6 only support one ext wakeup src, split SOC_PM_SUPPORT_EXT_WAKEUP
Close IDF-5924
2023-03-02 15:06:05 +08:00
Jing Li
75a82988f1 Merge branch 'refactor/wdt_use_unified_type' into 'master'
wdt: refactor wdt codes to use unified type

Closes IDF-5653

See merge request espressif/esp-idf!22378
2023-02-21 09:46:06 +08:00
jingli
9c37441b17 wdt: refactor wdt codes to use unified type 2023-02-15 12:08:55 +08:00
wuzhenghui
a0492202b7 bugfix: unhold SPI CS pin in pd_top lightsleep 2023-02-15 11:46:41 +08:00
wuzhenghui
248aa6109d codeclean: add sleep_mode args to esp_sleep_start() 2023-02-15 11:46:40 +08:00
Li Shuai
aec3f6db1d light sleep: supported SoC TOP domain powered down 2023-02-15 11:46:40 +08:00
wuzhenghui
75d15e8b80 bugfix: remove redundant SOC_PM_SUPPORT_XTAL_PD wrapping
Closes https://github.com/espressif/esp-idf/issues/10681
2023-02-07 20:25:59 +08:00
jingli
f8cc2ec86d esp32c2: support rtc time feature depend on rtc memory, since c2 does not have rtc memory 2023-02-02 20:25:59 +08:00
wuzhenghui
cd9d914ba0 codeclean: clean esp32c6 rtc_sleep related code 2023-01-31 22:12:58 +08:00
Li Shuai
68594abe05 sleep: light sleep supported for esp32c6 2023-01-31 22:12:58 +08:00
wuzhenghui
a5467f42a0 codeclean: only S series chip VDDSDIO is configurable 2023-01-31 22:12:58 +08:00
Li Shuai
1c39d64f95 cpu retention: refactor cpu retention and add cpu retention versions option in soc caps 2023-01-31 22:12:50 +08:00
Li Shuai
02f5df3b3e Power Management: added protection to the configuration of each power domain 2023-01-31 22:12:27 +08:00
Li Shuai
59cf87fe7d pmu: sleep initialization and sleep start support for esp32c6
Initialize the pmu sleep machine constant when pmu is initialized, and calculate
the pmu sleep time adjustment value and hardware configuration value according
to the machine constant during system sleep.

Calibrate fast OSC before each sleep and use the calibration value to calculate
PMU hardware wait cycles when use the fast OSC as the work clock.
2023-01-31 22:12:27 +08:00
Song Ruo Jing
4c8fdc31f9 gpio: Add support for esp32h2 2023-01-18 11:41:12 +08:00
jiangguangming
f74a43d002 use LL function to get wakeup cause 2023-01-10 17:03:54 +08:00
zhangwenxu
0479cce5d9 CI: fix fast template app due to function unused. 2022-12-30 15:25:12 +08:00
Jiang Jiang Jian
c681c92e4c Merge branch 'feature/bringup_esp32c6_chip_wifi_rebase_master' into 'master'
esp_wifi: add basic support for esp32c6

Closes WIFI-5174, WIFI-5175, WIFI-5176, WIFI-5185, WIFI-5188, WIFI-5193, WIFI-5141, WIFI-5157, WIFI-5154, WIFI-5155, WIFI-5156, WIFI-5200, WIFI-5168, WIFI-5160, and WIFI-5214

See merge request espressif/esp-idf!21715
2022-12-30 10:08:29 +08:00
Jiang Guang Ming
8464186e67 Merge branch 'bugfix/update_esp_rom_rtc_header' into 'master'
update esp rom rtc header

See merge request espressif/esp-idf!21802
2022-12-29 18:16:13 +08:00
lvshisheng
bba409eec1 wifi: update wifi libs to support wifi6 features and fix build error 2022-12-29 13:13:35 +08:00
Cao Sen Miao
4713a9a7f2 ESP32H2: Introduce new chip target esp32h2, hello_world example supported 2022-12-29 12:29:14 +08:00
yuexia
58b7fc1d8b esp32c6: enable wifi 2022-12-29 11:48:35 +08:00
jiangguangming
fe2984a52d esp_hw_support: support riscv call 2022-12-28 17:35:12 +08:00
wuzhenghui
aa20825659 soc_caps: rename ESP_PD_DOMAIN_RTC8M to ESP_PD_DOMAIN_FOSC 2022-12-27 21:31:21 +08:00
Li Shuai
17f9285524 esp32c6: add SOC_MODEM_CLOCK_IS_INDEPENDENT soc_cap and more pd_caps 2022-12-27 21:31:21 +08:00
laokaiyao
7a002ab7a6 rtcio: support rtcio on c6 2022-12-22 14:14:38 +08:00
Song Ruo Jing
d0a7dc3e9f gpio: Fix IO hold function related problems
1. Fix deep sleep wakeup IOs can not be unhold issue
2. Correct hold related APIs' description
3. Fix gpio_force_hold_all API

docs: Add GPIO wakeup source to sleep_modes doc for ESP32C3 and C2
2022-11-11 20:39:04 +08:00
laokaiyao
8677216576 esp32h2: renaming esp32h2 to esp32h4 2022-11-08 17:05:33 +08:00
Song Ruo Jing
be0fdfa176 soc: Add a soc cap, SOC_CLK_RC_FAST_D256_SUPPORTED, for whether the target has the RC_FAST_D256 clock 2022-11-01 11:23:26 +08:00
Jiang Jiang Jian
f191b2f034 Merge branch 'bugfix/fix_xtal_related_rtc_params_for_esp32' into 'master'
esp32/rtc: fix xtal unstable in some cases when sleep

Closes ESPCS-869

See merge request espressif/esp-idf!20425
2022-10-26 15:57:48 +08:00
Song Ruo Jing
6d24e8bcf4 gpio: Add support for esp32c6 2022-10-18 12:38:36 +08:00
jingli
5f60c4345e esp_hw_support/sleep: remove redundant spinlock protection for deep sleep 2022-10-11 12:11:36 +08:00
jingli
b903a2253b esp_hw_support/sleep: fix current leakage when hold digital io during deep sleep 2022-10-11 12:11:28 +08:00
jingli
101c2c6c3e esp_hw_support/sleep: fix light sleep wakeup flag
light sleep wakeup flag is true to indicate the most recent successful wakeup from light sleep,
which means the most recent light sleep occurred successfully and then wakes up by wakeup source
2022-10-09 19:59:24 +08:00
jingli
0a44d09f4f esp32/rtc: fix xtal unstable in some cases when sleep
1. add xtal buf wait to fix high temperature restart issue
2. add min sleep value to fix xtal stop due to too short sleep time issue
2022-10-09 19:58:58 +08:00
wuzhenghui
23e37393a7 esp32c6: add esp_hw_support 2022-09-26 20:32:13 +08:00
Omar Chebib
53c7dd4efc WDT: implement interrupt wdt and task wdt for ESP32-C2
ESP32-C2 has a single group timer, thus it will use it for the interrupt watchdog,
which is more critical than the task watchdog. The latter is implement in
software thanks to the `esp_timer`component.
2022-09-15 14:37:59 +08:00
Michael (XIAO Xufeng)
aff90b9853 sleep_modes: allow using touch/ULP with RTC_PERIPH domain (including EXT0 wakeup source) 2022-08-25 12:27:28 +08:00
laokaiyao
62ab4456a8 touch_sleep: complete the support for touch sleep 2022-08-15 20:04:57 +08:00
Darian Leung
a73dd07d12 esp_hw_support: Fix esp_light_sleep_start() deadlock
esp_light_sleep_start() will stall the other CPU via esp_ipc_isr_stall_other_cpu(). After stalling the other CPU,
will call esp_clk_... API which themselves take locks. If the other stalled CPU is holding those locks, this will
result in a deadlock.

This commit adds a workaround calling esp_clk_private_lock() to take the lock before stalling the other CPU.
2022-08-10 18:52:32 +08:00
Li Shuai
4afc115397 Power Management: fix the issue of sleeping time error beacause external 32kHz xtal does not exist 2022-08-04 14:01:34 +08:00
jingli
7211b0a89a esp_hw_support/sleep: fix cannot pd cpu and rc fast at the same time during light sleep
Since cpu retention dma use rc fast as clk source, so rc_fast_digi
will be enabled when we config to pd cpu. And cpu retention does not
need rc fast keep on during light sleep. So, if we use rc_fast_digi
to determine whether rc fast can be powered down, then cpu and and
rc fast cannot pd at the same time.
2022-07-28 11:10:58 +08:00
Darian
c8ee369a7c Merge branch 'feature/deprecate-old-cpu-api' into 'master'
HAL: Deprecate old CPU/SoC/Interrupt Controller HAL API

Closes IDF-4919 and IDF-5032

See merge request espressif/esp-idf!18987
2022-07-23 00:37:33 +08:00
morris
741b031e83 soc: added SOC_TOUCH_SENSE_SUPPORTED macro 2022-07-22 00:12:36 +00:00
Guillaume Souchere
6005cc9163 hal: Deprecate interrupt_controller_hal.h, cpu_hal.h and cpu_ll.h interfaces
This commit marks all functions in interrupt_controller_hal.h, cpu_ll.h and cpu_hal.h as deprecated.
Users should use functions from esp_cpu.h instead.
2022-07-22 00:06:06 +08:00
Darian Leung
781d06af73 esp_hw_support: Remove compare_set.h API
This function removes the following legacy atomic CAS functions:

From compare_set.h (file removed):
- compare_and_set_native()
- compare_and_set_extram()

From portmacro.h
- uxPortCompareSet()
- uxPortCompareSetExtram()

Users should call esp_cpu_compare_and_set() instead as this function hides the details
of atomic CAS on internal and external RAM addresses.

Due to the removal of compare_set.h, some missing header includes are also fixed in this commit.
2022-07-22 00:06:06 +08:00
Ivan Grokhotkov
0e53b32d2e
esp_hw_support: perform sleep initialization using ESP_SYSTEM_INIT_FN 2022-07-12 16:58:15 +02:00
Marius Vikhammer
e8b5096f52 ulp-riscv: add support for using ADC as well as an example show-casing it. 2022-07-11 09:31:22 +08:00