Cant use ULP and timer wake up right

Matheus.Goulart
Posts: 4
Joined: Thu Jan 23, 2020 5:48 pm

Cant use ULP and timer wake up right

Postby Matheus.Goulart » Mon Mar 09, 2020 8:19 pm

Hello,

In the last week i've been struggling with the ULP usage. The project idea was to periodically wake up esp so he can send data over BLE and while in deep sleep, the ULP will monitor the adc input and if there's any significant change in the readings, it will immediately wake up and send the data. If there's any alteration in the ADC reading with ULP, the system works flawless. The problem is, if ESP wake up on time based, it never wakes up again with ADC reading.Can someone give me any hints on why is this happening?

Best regards,
sleep-activity.c
(3.33 KiB) Downloaded 456 times
ulp-activity.c
(2.16 KiB) Downloaded 463 times
ulp.c
(1.89 KiB) Downloaded 461 times

wevets
Posts: 112
Joined: Sat Mar 09, 2019 2:56 am

Re: Cant use ULP and timer wake up right

Postby wevets » Tue Mar 10, 2020 7:51 pm

I struggled to get the ULP to behave myself.

Every time I restart the ULP and go into deep sleep, I call, in order,

ulp_run((&ulp_entry - RTC_SLOW_MEM) / sizeof(uint32_t));
esp_sleep_enable_ulp_wakeup();
esp_deep_sleep_start();

I'm guessing, and it is a guess, that you're lacking the middle call to esp_sleep_enable_ulp_wakeup() when you go back into deep sleep.
If you stop the ULP clock to prevent the ULP from running while the system is running, the ulp_run() will restart the clock. If either of these calls aren't made, I think you'd see the same symptom you seem to be describing.

Matheus.Goulart
Posts: 4
Joined: Thu Jan 23, 2020 5:48 pm

Re: Cant use ULP and timer wake up right

Postby Matheus.Goulart » Tue Mar 10, 2020 8:30 pm

Ty for your answer,

I actually calling esp_sleep_enable_ulp_wake_up() and esp_deep_sleep() inside the ulp_sleep() function.
Recently I figured out that's some problem with the acquisition, but i still cant manage to properly wake up after a timer wake up.

The esp_sleep routine goes like this:

Code: Select all

ESP_ERROR_CHECK( esp_sleep_enable_ulp_wakeup() );
esp_deep_sleep(45* 1000* 1000);

chegewara
Posts: 2310
Joined: Wed Jun 14, 2017 9:00 pm

Re: Cant use ULP and timer wake up right

Postby chegewara » Fri Mar 13, 2020 8:17 pm

try this:

Code: Select all

esp_sleep_enable_timer_wakeup(us_time);

Who is online

Users browsing this forum: dr_glenn, jdbaptista and 103 guests