Deep sleep ulp interrupt pulse counter high power consumption

kapucin22
Posts: 3
Joined: Tue Nov 19, 2024 8:40 pm

Deep sleep ulp interrupt pulse counter high power consumption

Postby kapucin22 » Tue Nov 19, 2024 9:23 pm

Hello,
I'm trying to determine if my test results are accurate or deep-sleep code could be improved somehow.

Set-up:
Hardware: ESP32-C6, DFRobot DFR1075 FireBeetle2
Test equipment: Nordic Power profiler Kit II
Example: system/ulp/lp_core/gpio_intr_pulse_counter
IDF: v5.3.1

Problem:
during deep sleep phase the board consumes 1.3mA on average

Other deep-sleep example from DFRobot (ULP timer wakep) gives me power consumption of about 0.019mA.
It looks like that the biggest contributor to the power usage is ULP program running in a while(1) loop and ulp_lp_core_wait_for_intr() call.

I tried to isolate and/or reset all pins (ULP and/or GPIO) that are not being used for the interrupt. The power usage reduced by 1mA maybe, but that' all.

Can you confirm that what I'm seeing is about accurate power consumption given the specific example?
Is there anything in IDF I could use to reduce the power consumption for ULP programs handling interrupts?

ESP_Sprite
Posts: 9765
Joined: Thu Nov 26, 2015 4:08 am

Re: Deep sleep ulp interrupt pulse counter high power consumption

Postby ESP_Sprite » Wed Nov 20, 2024 4:21 am

I would not be surprised if it is; the ULP and peripherals are still powered on.

MicroController
Posts: 1734
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Deep sleep ulp interrupt pulse counter high power consumption

Postby MicroController » Wed Nov 20, 2024 8:56 am

kapucin22 wrote:
Tue Nov 19, 2024 9:23 pm
Is there anything in IDF I could use to reduce the power consumption for ULP programs handling interrupts?
Waking up the ULP by LP IO, processing one edge of the signal, then halting the ULP again waiting for the next LP IO wakeup can save a lot of power; if the pulse frequency isn't too high.

kapucin22
Posts: 3
Joined: Tue Nov 19, 2024 8:40 pm

Re: Deep sleep ulp interrupt pulse counter high power consumption

Postby kapucin22 » Wed Nov 20, 2024 1:04 pm

Waking up the ULP by LP IO
What exactly is that LP IO, isn't the interrupt already one of them?

How I understand it is the signal on the pin is one half of waking-up process, the other half is ULP listening for that trigger so as to invoke the interrupt function. So it must be listening to handle the interrupts. The doc says the following (but the power draw still looks high):
void ulp_lp_core_wait_for_intr(void)
Puts the CPU into a wait state until an interrupt is triggered.
Note
The CPU will draw less power when in this state compared to actively running

kapucin22
Posts: 3
Joined: Tue Nov 19, 2024 8:40 pm

Re: Deep sleep ulp interrupt pulse counter high power consumption

Postby kapucin22 » Wed Nov 20, 2024 9:02 pm

Waking up the ULP by LP IO
I found the example that demonstrates it: [lp_core_gpio_wake_up]examples/system/ulp/lp_core/gpio_wakeup/main/lp_core_gpio_wake_up_example_main.c[/url]; it works only with master (latest).
Deep sleep consumption is around 0.02mA. Much better.

Thanks!

MicroController
Posts: 1734
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Deep sleep ulp interrupt pulse counter high power consumption

Postby MicroController » Thu Nov 21, 2024 12:01 pm

kapucin22 wrote:
Wed Nov 20, 2024 1:04 pm
Waking up the ULP by LP IO
What exactly is that LP IO, isn't the interrupt already one of them?
Yeah, GPIO, LP IO... ;-) I just meant ULP_LP_CORE_WAKEUP_SOURCE_LP_IO.
How I understand it is the signal on the pin is one half of waking-up process, the other half is ULP listening for that trigger so as to invoke the interrupt function. So it must be listening to handle the interrupts.
I see it like this: If you already have a program running on the ULP doing <stuff>, you can use an IO interrupt to make the program also handle asynchronous IO events.
If you want to only handle IO events, you don't need the interrupt; or put differently: int main (void) can be your "interrupt handler" handling the IO event(s) configured to wake up the ULP.

Having the ULP powered up but idle waiting for an interrupt is sure to consume more energy than shutting down (i.e. halting) the ULP.

Who is online

Users browsing this forum: No registered users and 219 guests