-
Notifications
You must be signed in to change notification settings - Fork 7.2k
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-S3 ESP_PD_DOMAIN_RTC_PERIPH Abnormal power consumption (IDFGH-9205) #10595
Comments
I can confirm. I have the exact same problem also using the ulp_riscv adc example an ESP32-S3-WROOM-1 N8R2 and latest master esp-idf. |
I have done a bit more testing. The issue is also present on release 5.0. However, for v4.4.4 the behavior is different, using the ulp_riscv/adc example: I hope this helps in figuring out what is wrong in v5+. |
Thanks. This good news. Probably is software bug, not in hardware. |
Indeed. Also, with the exact same hardware and latest esp-idf-master, using the deep_sleep example it consumes ~25uA in deep sleep. |
I have done a few more tests. The latest v5.0 and 5.0.1 exhibit the behavior I described previously for v4.4.4 as in: It is not ideal that it starts by consuming 1.2mA but, at least it recovers during consecutive sleeps. However, for v5.0 and v5.01 the ULP crashes intermittently. Which is not the case using the latest master. I believe the following commit is responsible for introducing the regression in master: |
I'm seeing this issue as well, so I've been doing some testing with an as-simple-as-possible ULP example that just does a My findings confirm @Veldmonster's conclusion that 5be3c21 is the problem. Here are my tests with various versions of IDF: 5be3c21 gives 1.75mA f9da48d (the commit immediately before 5be3c21) gives 430uA 5.0.1 (a4afa44) gives 417uA 4.4.4 (e8bdaf9) gives 415uA (using a version of my example tweaked to compile with 4.4.4) |
Also tested with the ULP running every 200ms and doing a 5be3c21 25.6uA f9da48d (the commit immediately before 5be3c21) 25.59uA 5.0.1 (a4afa44) 25.6uA 4.4.4 (e8bdaf9) 25.5uA |
@johnboiles this second measure session is with analog measure in RTC? If not, this is normal. ULP if run all time use ~ 400--600 uA. |
@MacWyznawca take a look at my example code in sindarin-inc/minimal-ulp. Im not doing anything with the ADC but still seeing the same behavior with the ULP. The first test did |
Thank you @johnboiles very much, for the tests and another confirmation that this is not the problem of my system. It's just a shame that Espressif isn't doing anything about it. We are about to start serial production, and I can't do analog measurements in sleep using ULP. |
FWIW I'm seeing the same behavior on IDF 5.0.1 stable. But not on f9da48d. Pulling the latest IDF master (81e1e65) and then moving |
@johnboiles Can you try it on the exampe from IDF with analog measurement in RTC? |
@johnboiles Does commenting this line fix the problem for you (and cause no other problems)?
Please take a quick look at the related closed issue. I don't think this is specific to the ULP (at least, it's not for ESP32; I haven't tried with S3). |
@boarchuz I'll try that out thanks for the suggestion. I need to collect more data but I noticed something like what you're mentioning. I think I noticed the higher power consumption even when not deep sleeping / running the ulp. Harder to see 1.6mA on top the normal active CPU current but but I think I noticed a difference. |
@boarchuz That does fix it for my trivial sindarin-inc/minimal-ulp example in IDF 5.1 (51772f4) (still testing with the ProS3)! Without your change i'm seeing: 1.36mA and with it I'm seeing 25uA. Using the same patch on my code seems to be fine. I'm not seeing any issues with it. Edit: Testing my code on my hardware (a little higher power consumption) the suggested change helps the first sleep but is the same-ish after the first sleep/wake cycle. Interesting that in my code IDF5.0.1 is busted in a similar way (but not on my minimal-ulp example)! |
If I initialize the ADC in my sindarin-inc/minimal-ulp example, I'm able to reproduce the high power consumption issue in the following IDF versions:
In all cases I'm seeing 1.3mA in the ULP. I'm simply adding this code to the top of adc_oneshot_unit_init_cfg_t adcOneshotCfg;
adc_oneshot_unit_handle_t adcOneshotHandle;
adcOneshotCfg.unit_id = ADC_UNIT_1;
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 1, 0)
adcOneshotCfg.clk_src = TIMER_SRC_CLK_APB;
#endif
adcOneshotCfg.ulp_mode = ADC_ULP_MODE_DISABLE;
ESP_ERROR_CHECK(adc_oneshot_new_unit(&adcOneshotCfg, &adcOneshotHandle)); Then of course if I deinit the ADC, it works as expected and I see 25uA again. This might be an easy quick fix for anyone running into this issue since it doesn't require a modified IDF. ESP_ERROR_CHECK(adc_oneshot_del_unit(adcOneshotHandle)); Not sure if this is expected or not. I would have expected |
@esp-lis My tests setup:
My results indicate that the suggested fix from @esp-wzh does not work. |
hello @esp-wzh , i think this is related to what i'm seeing on our devices. ESPS3 N8R8 on v4.4 (latest branch 3cec3a0 ) Deep sleep seems to work fine for amount of times below 30 minutes, and to wakeup instead at some point for 30+ minutes. here a chart of the temperature of the CPU |
Unfortunately, in the case of the ESP32-S3, this did not help. Still after using esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON); the current consumption increases from 10 uA to 1.3 mA |
Still after using esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON); current consumption increases from 10 uA to 1.3 mA. |
You can use sar_ctrl_ll_set_power_mode(SAR_CTRL_LL_POWER_FSM); If ULP ADC isn't working as expected, you may need to manually power the ADC on and off using the ULP as required using SAR_CTRL_LL_POWER_ON and SAR_CTRL_LL_POWER_OFF. Hopefully FSM works. |
@boarchuz Unfortunately, using |
|
@esp-wzh |
@esp-wzh I test now with v5.2-dev-193-gdf9310ada2-dirty. The problem persists. We need a solution to the problem very urgently. |
@MacWyznawca The key to this change to fix the abnormal current is to move the Can you try this example and share more about the application that the current is not normal? |
@esp-wzh I tested with I have exactly the same effects as in my project. Current consumption 1.3 - 1.5 mA (depending on the set wake-up frequency. |
adc_power_fix_56123.patch.txt |
Thanks @esp-wzh this patch works! |
Let's keep it open until the fix is merged. The issue will get closed automatically when the commit with the fix lands into |
Hi, thanks @ESP-Marius for pointing me to this thread, I had missed on search. I applied the above patch to IDF version v5.2-dev-503-g17451f1fb3.
Given the example code, I would expect to see a few 100s of uA for the period the ADC reading is happening, then some much lower current (few 10s of uA ) when the ULP halts and waits for the next firing of its wakeup timer?
One theory I had was that the ADC was taking too long to complete and over running the 20mS timer, but changing the time even to 500mS makes no difference:
Running @johnboiles very useful minimum ulp I get ~34uA (which is expected as I have some peripherals). So there's still something strange with the ADC? I'll build a bare bones hardware to completely rule out any weird i/o issues on my pcb and report back. |
@patrickmagee I re-verified the ulp_adc example after applying the patch on the commit point you mentioned, and the measured base current is about 17uA. I think the abnormal current may be caused by some IO leakage on your board. |
Thanks @esp-wzh , I figured a few i/o issues that were leaking current but was still seeing ~400uA which didn't seem right. Success! I'm now down to 70uA which is what I would roughly expect with the peripherals I have on the board. |
Thanks @esp-wzh, I can also confirm that the patch works. On my board with ulp_set_wakeup_period at 100ms and ulp execution time of 2ms I measure a consumption of ~90uA RMS (~67uA AVG). |
when is this going to be backported to 4.4? |
I don't speak for espressif but I don't think they backport. Your best option is to update your espidf to the master. |
@patrickmagee As a company we cannot change branch that easily (changes from 4.4 to 5.X are extensive) |
Ah , apologies for my error, you are correct given that it is a fix. |
Answers checklist.
IDF version.
v5.1-dev-2884-g8a7f6af625
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.
custom board with ESP32-S3-WROOM-1 module
Power Supply used.
Battery
What is the expected behavior?
Microamper (uA) power consumption with:
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON); enabled
and runing ULP-RISC-V program ex. ULP-RISC-V ADC Example.
What is the actual behavior?
Consumprion 1.5 mA (miliamper).
When I set rtc_gpio_isolate() for all RTC GPIO power growing to 1.8 mA.
Whit out ESP_PD_DOMAIN_RTC_PERIPH and simple use RTC GPIO (not analog - input and output only) my board use ~100 uA when ULP-RISC-V program run 10 times per second.
Other ESP_IDF ULP-RISC-V examples whit out ESP_PD_DOMAIN_RTC_PERIPH On use ~100 uA too. The problem occurs only when esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON) is used.
Steps to reproduce.
Run ULP-RISC-V ADC Example.
Debug Logs.
No response
More Information.
I use ESP32-S3-WROOM-1 module with 4 BM Flash, and no extra PSRAM.
The text was updated successfully, but these errors were encountered: