Page 1 of 1

Complex ULP programs (DHT-22 protocol) hang after a while

Posted: Fri Sep 29, 2017 6:48 pm
by tomtor
I am experimenting with the ULP processor.

A simple hart beat LED blinking program is reliable (it runs for days), but a more complex program (bit-banging the DHT-11/22 protocol)
stops after a random period, eg 30 successful read outs.

I inspected with a scope and there is no issue with the DHT-22 communication. Also reading the internal temperature sensor (this code is much simpler) stops after a while.

The source is here:

https://gist.github.com/tomtor/99e2a33b ... 94fc0df804

Any hints about the potential cause would be much appreciated!

EDIT:

I can prevent the hang by keeping the ULP program running (remove the I_END()).

In the original version the ULP program executes I_END() and wakes the main processor from deep sleep.
The main processor restarts the ULP program with ulp_run(0).

So either sometimes a wakeup fails or the ulp_run() fails to start the ULP program. I expect some race condition.

Re: Complex ULP programs (DHT-22 protocol) hang after a while

Posted: Sat Oct 07, 2017 12:50 pm
by tomtor
Perhaps related:

Switching timer register, eg

Code: Select all

I_SLEEP_CYCLE_SEL(1)
only works when setting the power domain:

Code: Select all

esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
In the default setting register 0 remains active!