RTC slow memory appears to be cleared after ULP wakeup
Posted: Sun Jan 16, 2022 9:40 pm
I'm using the ulpcc compiler to generate assembly for the ULP coprocessor. I have two arrays declared:
The ulpcc compiler creates globals from these in assembly:
And I can access them as expected in the main code using:
The ULP code watches for edges on some GPIO and sets values in these arrays as it runs, and after a certain amount of time, issues a wake command.
I don't believe there are issues with the ULP code, as when I run it without entering deep sleep, these arrays are populated as expected and can be read by the main program.
However, if run the ULP code and enter deep sleep as follows:
Upon waking, the memory appears to be cleared, as both arrays only contain zeroes.
Any ideas?
Code: Select all
unsigned int rain_readings[MAX_READING];
unsigned int wind_readings[MAX_READING];
Code: Select all
.global wind_readings
wind_readings:
.space 120
.global rain_readings
rain_readings:
.space 120
Code: Select all
extern uint32_t ulp_wind_readings;
extern uint32_t ulp_rain_readings;
I don't believe there are issues with the ULP code, as when I run it without entering deep sleep, these arrays are populated as expected and can be read by the main program.
However, if run the ULP code and enter deep sleep as follows:
Code: Select all
err = ulp_load_binary(0, ulp_main_bin_start, (ulp_main_bin_end - ulp_main_bin_start) / sizeof(uint32_t));
ESP_ERROR_CHECK(err);
ulp_set_wakeup_period(0, 20000);
err = esp_sleep_enable_ulp_wakeup();
ESP_ERROR_CHECK(err);
err = ulp_run(&ulp_entry - RTC_SLOW_MEM);
ESP_ERROR_CHECK(err);
esp_deep_sleep_start();
Any ideas?