espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.61k stars 7.27k forks source link

ESP32-C6低功耗电流是怎么才能达到手册上面的180uA? (IDFGH-11302) #12453

Closed TkoSky closed 5 months ago

TkoSky commented 1 year ago

Answers checklist.

General issue report

目前我使用light_sleep例程,电流要440uA,我应该怎么弄才能达到手册上面描述的180uA呢?

TkoSky commented 1 year ago

然后我使用deep_sleep例程测试,验证一下电路是否有漏电,待机电流为7uA,那么这样是不是能够说明我的电路是正确的 IDF版本为5.1 模组是ESP32-C6-Wroom-1

esp-wzh commented 1 year ago

Hi~ @king592

  1. 两百多uA的漏电值怀疑是从 IO 上泄露的,可否找颗所有IO都浮空的开发板再次测试?
  2. Deepsleep 会关闭外设电源域,其中包括 GPIO,并不能说明电路上没有问题。
  3. sdkconfig 是否为默认配置?如果不是能否附上 sdkconfig 文件?
TkoSky commented 1 year ago

SDK文件是这样的,目前我的模组上面是没有接任何外部电路的,是 否还会出现你说的漏电呢?

TkoSky commented 1 year ago

sdkconfig.txt

TkoSky commented 1 year ago

@esp-wzh 我这边试了一下找了一颗ESP32-C3的模组,也是跑light_sleep这个例程,功耗是能够达到手册上写的130uA的,实测出来是132uA

huming2207 commented 1 year ago

检查一下休眠前一刻的Flash的CS脚有没有正确配置(要拉高),以及检查一下其他的GPIO上下拉配置

Edit: 你这个sdkconfig的CONFIG_ESP_SLEEP_POWER_DOWN_FLASH已经设置了y了,可能是别的问题。。。

TkoSky commented 1 year ago

乐鑫这边能否提供一下固件,我直接烧录进去看看电流数据是否正常,模组是ESP32-C6-Wroom-1 M4N4

esp-wzh commented 1 year ago

Hi, @king592,

esp32c6 在 light sleep 可配置下电的电源域有 3 个,分别为 CPU 电源域,Modem 电源域和外设电源域

由于light sleep是不会丢失运行上下文的休眠,则在休眠期间如果配置下电某电源域,则需要作相应的初始化以支持进出睡眠时对掉电电源域内外设的上下文进行保存和恢复。

Datasheet 中的 180uA 为在休眠期间下电 CPU 与 Modem 模块时的电流数据。

当前 IDF 如果使用esp_pm组件进行电源管理,是支持自动下电这些电源域的,而此例程 并未支持自动retention。(即当前用户调用esp_light_sleep_start时,CPU 电源域,Modem 电源域和外设电源域并不受menuconfig中的配置控制,这个问题很快会修复)

如果期望在esp_light_sleep_start时下电CPU,可以在之前包含头文件#include "esp_private/sleep_cpu.h"并调用sleep_cpu_configure(true);, CPU下电后将降低功耗30~40uA。

如果应用不使用wifi/bt等modem模块,可以将esp-idf/components/esp_hw_support/sleep_modem.c中的modem_domain_pd_allowed 函数直接 return true 以允许休眠时下电modem电源域,modem 下电后将降低功耗 90~120uA。

如果应用需使用wifi/bt等modem模块,请参考对应example中的power_save例程,如 wifi power_save

esp-wzh commented 1 year ago

乐鑫这边能否提供一下固件,我直接烧录进去看看电流数据是否正常,模组是ESP32-C6-Wroom-1 M4N4

PowerPerf_firmware.tar.gz

TkoSky commented 1 year ago

我这边测试了一下电流分别是,38uA和200uA左右,是基本对得上手册上面的参数了感谢?IDF大约什么时候能够修复这个问题呢?

esp-wzh commented 1 year ago

Modem 电源域默认不允许下电的问题将在v5.2中修复并backport到v5.1。

但对于用户应用通过 esp_lightsleep_start 主动调用的lightsleep,短期内没有支持下电 CPU / Modem / Peripheral 的计划。如果对功耗有要求,请使用 esp_pm 组件托管 lightsleep,refer: Power Management

AxelLin commented 11 months ago

Modem 电源域默认不允许下电的问题将在v5.2中修复并backport到v5.1。

When will this fix available in v5.1?

但对于用户应用通过 esp_lightsleep_start 主动调用的lightsleep,短期内没有支持下电 CPU / Modem / Peripheral 的计划。如果对功耗有要求,请使用 esp_pm 组件托管 lightsleep,refer: Power Management

You should support powerdown CPU / Modem / Peripheral when use esp_lightsleep_start which is a much simpler use case. (I think this is a BUG if it does not work).

esp-wzh commented 11 months ago

@AxelLin Thanks for care about this.

When will this fix available in v5.1?

The fix for master is in internal reviewing and it will backport to v5.1, but it's a big change and involves many peripherals, we need more time to discuss and reviewing. If everything goes well, it is expected to be fixed on the master this week.

You should support powerdown CPU / Modem / Peripheral when use esp_lightsleep_start which is a much simpler use case. (I think this is a BUG if it does not work).

Yes, this is indeed a reasonable request, after discussion, we have added support for this feature into the support plan, but the peripherals of each power domain have different retention strategies. We still need time to abstract the API and organize documents to clearly explain all this.

AxelLin commented 11 months ago

@esp-wzh Do you have update for the peripherals that are not yet supported for Light-sleep Peripheral Power Down? Which peripherals will be supported in the near future? https://docs.espressif.com/projects/esp-idf/en/latest/esp32c6/api-reference/system/power_management.html#light-sleep-peripheral-power-down

esp-wzh commented 11 months ago

GDMA/UART1 is in progress, will be supported soon. In the driver of crypto peripherals, the module will be re-initialized for each calculation, so there is no need to support retention for them, and ETM/TIMG1/ SPI2/I2C/I2S will support soon also, There are plans to support PCNT/TWAI/LEDC/MCPWM/RMT/SARADC/SDIO/PARL_IO but the priority won't be high. There's no plan to support ASSIST_DEBUG / Trace / USB-Serial-JTAG retention.

AxelLin commented 10 months ago

@AxelLin Thanks for care about this.

When will this fix available in v5.1?

The fix for master is in internal reviewing and it will backport to v5.1, but it's a big change and involves many peripherals, we need more time to discuss and reviewing. If everything goes well, it is expected to be fixed on the master this week.

@esp-wzh I wait yet another month but still don't find this in recent esp-idf update.

esp-wzh commented 10 months ago

@AxelLin Things didn't go as planned, during the review process, some larger refactoring work was proposed. I don't think it can be integrated into master soon.

I want to know what are the specific problems you encounter when you need this feature, maybe I can provide you with a workaround solution at the application layer.

AxelLin commented 9 months ago

GDMA/UART1 is in progress, will be supported soon. In the driver of crypto peripherals, the module will be re-initialized for each calculation, so there is no need to support retention for them, and ETM/TIMG1/ SPI2/I2C/I2S will support soon also,

But there is no update so far...

esp-wzh commented 5 months ago

https://github.com/espressif/esp-idf/commit/0c68b9b06c7df83ba3edc1873cc3506e79cbc769 should solved this problem, in applications that do not use a modem peripheral, modem_domain_pd_allowed will not block the peripheral power domain from powering down.

AxelLin commented 5 months ago

0c68b9b should solved this problem, in applications that do not use a modem peripheral, modem_domain_pd_allowed will not block the peripheral power domain from powering down.

@esp-wzh See the regressions in https://github.com/espressif/esp-idf/issues/13683#issuecomment-2109298560 and https://github.com/espressif/esp-idf/issues/13288#issuecomment-2047151358 . I'm still waiting for the regression fixes.

esp-wzh commented 5 months ago

@AxelLin

The MR to fix issue https://github.com/espressif/esp-idf/issues/13683#issuecomment-2109298560 has been proposed in the same way as in patch and will be merged soon.

We are debugging the https://github.com/espressif/esp-idf/issues/13288#issuecomment-2047151358 issue, this doesn't seem to be a very tricky issue and will be fixed soon, thank you very much for reporting it, you can fall back to the version that is fine to use!

Indastri commented 5 months ago

Closing this issue as solved (via 0c68b9b). If the issue will persist feel free to reopen this or create a new issue.