Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP32-C6 deep sleep current >1mA (IDFGH-11526) #12651

Closed
3 tasks done
NoNullptr opened this issue Nov 23, 2023 · 1 comment
Closed
3 tasks done

ESP32-C6 deep sleep current >1mA (IDFGH-11526) #12651

NoNullptr opened this issue Nov 23, 2023 · 1 comment
Assignees
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Type: Bug bugs in IDF

Comments

@NoNullptr
Copy link

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

master

Espressif SoC revision.

ESP32-C6FH4 (QFN32) (revision v0.0)

Operating System used.

macOS

How did you build your project?

Command line with idf.py

If you are using Windows, please specify command line type.

None

Development Kit.

ESP32-C6-Mini-1

Power Supply used.

USB

What is the expected behavior?

Current consumption should be around 7µA in deep sleep, according to datasheet.

What is the actual behavior?

ESP32-C6 consumes >1mA when both cores are sleeping (in deep sleep), which is substantially more than even the stated value for light sleep.

Steps to reproduce.

A simple test app that starts both cores and goes to sleep.

sdconfig.defaults:

CONFIG_ULP_COPROC_ENABLED=y
CONFIG_ULP_COPROC_TYPE_LP_CORE=y

lp_main.c:

#include <ulp_lp_core_utils.h>

void main()
{
    ulp_lp_core_halt();
}

main.c:

#include <esp_sleep.h>
#include <ulp_lp_core.h>

extern const uint8_t lp_core_main_bin_start[] asm("_binary_lp_core_main_bin_start");
extern const uint8_t lp_core_main_bin_end[]   asm("_binary_lp_core_main_bin_end");

void app_main()
{
    esp_err_t ret = ESP_OK;

    ulp_lp_core_cfg_t cfg = {
        .wakeup_source = ULP_LP_CORE_WAKEUP_SOURCE_HP_CPU,
    };

    ret = ulp_lp_core_load_binary(lp_core_main_bin_start, (lp_core_main_bin_end - lp_core_main_bin_start));
    if (ret != ESP_OK) {
        printf("failed to load LP core\n");
        abort();
    }
    ret = ulp_lp_core_run(&cfg);
    if (ret != ESP_OK) {
        printf("failed to run LP core\n");
        abort();
    }

    esp_deep_sleep_start();
}

Debug Logs.

No response

More Information.

No response

@NoNullptr NoNullptr added the Type: Bug bugs in IDF label Nov 23, 2023
@espressif-bot espressif-bot added the Status: Opened Issue is new label Nov 23, 2023
@github-actions github-actions bot changed the title ESP32-C6 deep sleep current >1mA ESP32-C6 deep sleep current >1mA (IDFGH-11526) Nov 23, 2023
@espressif-bot espressif-bot added Status: In Progress Work is in progress and removed Status: Opened Issue is new labels Dec 7, 2023
@esp-wzh
Copy link
Collaborator

esp-wzh commented Dec 7, 2023

Hi! @NoNullptr

Sorry for the late relpy, the reason for the high power consumption is that the LP CPU does not enter sleep state, LP CPU is in sleep state by default when soc startup. In ulp_lp_core_run->lp_core_ll_hp_wake_lp of your code, the LP_CPU is awakened through the ULP_LP_CORE_WAKEUP_SOURCE_HP_CPU interrupt, and then the corresponding interrupt status bit is set. when ULP requests sleep, because the interrupt source is not been cleared, sleep is rejected.

This problem can be solved by set PMU_HP_SW_TRIGGER_INT_CLR bit in PMU_LP_INT_CLR_REG to clear this interrupt source before LP_CPU goes to sleep. Of course, we will also fix it in IDF master and backport to v5.1 and v5.2 soon.

Fix in components/ulp/lp_core/lp_core/lp_core_utils.c

void ulp_lp_core_halt(void)
{
+++ REG_SET_FIELD(PMU_LP_INT_CLR_REG, PMU_HP_SW_TRIGGER_INT_CLR, 1);
    REG_SET_FIELD(PMU_LP_CPU_PWR1_REG, PMU_LP_CPU_SLEEP_REQ, 1);

    while(1);
}

Thank you for reporting this issue!

@espressif-bot espressif-bot added Status: Reviewing Issue is being reviewed and removed Status: In Progress Work is in progress labels Dec 8, 2023
@espressif-bot espressif-bot added Status: Done Issue is done internally Resolution: NA Issue resolution is unavailable and removed Status: Reviewing Issue is being reviewed labels Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

3 participants